Search Results for 'code'
-
AuthorSearch Results
-
May 5, 2007 at 12:25 am #55853
fel64
MemberThat’s strange, it works for me. At a guess the root of it is that $post doesn’t exist, or that $post->ID is nonexistant.
Can you replace
function forumreplylink() { ... }
with:function forumreplylink() {
//must be called from within the loop yadda yadda
global $post;
if( $post ) {
$rl = get_option( 'wpbb_path' ) . '/topic.php?id=';
$tid = felblogtotopicid( $post->ID );
echo '<a href="' . $rl . $tid . '">Reply!</a>' . "n";
} else {
echo 'ouch!';
}
}If it outputs ouch we’ll know that a missing global $post is indeed the problem. You are using it inside The Loop, aren’t you?
May 5, 2007 at 12:07 am #55852Griffology
MemberThanks for the help, but my error is now:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘LIMIT 1’ at line 1]
SELECT topic_id FROM
wp_bbpress_post_posts
WHEREpost_id
= LIMIT 1;after the error it adds the reply function but with an empty id: IE: “http://www.website.com/topic.php?id= “
May 4, 2007 at 11:23 pm #55851fel64
MemberThat’s very simple; go to wp-admin > Options > Discussion and set it so comments are off. You can also modify your template by deleting all the code for comments.
To get the ‘discuss in forums’ link, simply open your template file, and replace the
<?php comments_popup_link(' make a comment', '1 comment', '% comments','','comments off'); ?>
or similar with this:<?php forumreplylink(); ?>
That’ll give you what you want. Note that you’ll need to put
felblogtotopicid()
into a WP plugin, like so:<?php
/*
Plugin Name: HFFIB
Plugin URI:
Description: Helper function for integrating bbPress into your theme.
Version: 0
Author: fel64
Author URI: http://www.loinhead.net/
*/
function felblogtotopicid( $felpostID ) {
global $table_prefix, $wpdb;
$posts_table = $table_prefix . "bbpress_post_posts";
$topic_id = $wpdb->get_var("SELECT topic_id FROM <code>$posts_table</code> WHERE <code>post_id</code> = $felpostID LIMIT 1;");
return $topic_id;
}
function forumreplylink() {
//must be called from within the loop yadda yadda
global $post;
$rl = get_option( 'wpbb_path' ) . '/topic.php?id=';
$tid = felblogtotopicid( $post->ID );
echo '<a href="' . $rl . $tid . '">Reply!</a>' . "n";
}
?>If you do that, you have to take it out of the hack should you implement it.
May 4, 2007 at 9:59 pm #55850Griffology
MemberThanks fel64. I’m looking to do away with the wordpress comments completely, just shut them off. However the bbpress post plugin posts the “discus in forms(0)” link at the end of the post. I have a bar at the bottom of each post and would like to format it in there. I’ve opened bbpress_post.php and saw the output of the post gets thrown into 1 variable. I would like to call a function in my wordpress php files, for example index.php, that calls the function from bbpress_post.php to display the “discuss in form” link.
Hope that makes sense, but after read the thread you linked I don’t think it’s quite what i’m looking for. I’ll read it again thought as I’m tired.
Thanks again.
May 4, 2007 at 8:51 pm #57412In reply to: *seamless* wordpress integration
Vili
ParticipantThe way I have integrated the two over at http://akirakurosawa.info/ is by editing the bbPress template so that it calls the WordPress headers instead of the bbPress ones.
I presume that you have installed both WordPress and bbPress, and that you have integrated their user databases and installed the required plug-ins as outlined at https://bbpress.org/documentation/integration-with-wordpress/ .
So, if you now go through the template files for your bbPress installation, you will need to replace all instances of “<?php bb_get_header(); ?>” with the WordPress command “<?php get_header(); ?>”. The same thing goes for the footers, so you change all instances of “<?php bb_get_footer(); ?>” to “<?php get_footer(); ?>”.
However, in order to get that to work properly, I have also edited my WordPress template so that the (WordPress) header and footer files contain everything except for the actual content that is going to be shown on the page. In other words, all the “container” DIV-elements and such are opened in the header and closed in the footer. While this is perhaps not absolutely necessary, it makes your life easier.
Finally, I use a boolean check in the WordPress header to see whether I am serving a bbPress page, and modify the header information accordingly. While I currently set the boolean myself by including
<?php global $forumpage;
$forumpage = TRUE; ?>at the very beginning of each relevant bbPress template page (i.e. those pages that call the header files), fel64 has pointed out that one could simply use a variable that bbPress uses anyway, for example $bbdb.
I use these checks to modify the title:
<?php if ($forumpage == TRUE) {
bb_title();
echo " :.: AKN&I";
} else ...to add the forum feed:
<?php if ($forumpage == TRUE) bb_feed_head(); ?>
as well as do some other things (disable Ultimate Tag Warrior’s meta tags for the page, etc.).
So, it takes a little bit of playing around with your templates, but in the end it is doable without any actual hackery.
May 4, 2007 at 7:27 pm #55849fel64
MemberThere are a few things you can do. This WP plugin will, using also the bbPress Post plugin, show replies from the appropriate thread in your forum under your newspost, plus links to the thread to reply to it. You can also transfer existing comments; you need to be careful to only do it once, but that can also be found in that thread. It hasn’t yet been successfully made so that you can reply to the forum from the wordpress part of the site, as far as I know, but I’m sure it’s possible and will be done.
So it’s perhaps 2/3rds of the way there.
May 4, 2007 at 5:05 pm #55848Griffology
MemberMatt, have you finished this. I’ve tried to do it myself but with no luck I always end up throwing a sql error.
May 4, 2007 at 4:36 pm #55364In reply to: Pretty Permalinks Not Working
serimu
MemberI checked it again, and it is partially working. Forum links are accessible, but topic and others are not. I again tried three combination
1) just adding multipleviews to htaccess = not working
2) adding this solution = not working
# BEGIN BBPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /forum/
Options +MultiViews
</IfModule>
# END BBPress3. adding the code generated by rewrite-rules.php. = partially working
May 4, 2007 at 4:03 pm #55363In reply to: Pretty Permalinks Not Working
serimu
Member+1
I did also all the things(at least three or more times, and even I create a mirror template for bbpress to match with my wordpress template when I was tired of trying the same things to make permalinks to work),. So, for those people who uses Godaddy;
It is not working with Godaddy. (Correction: It works for me, read below)
But it only took a couple of hours to update my wordpress, install and integrate bbpress with wordpress (even, partially, templates). For now, I will not move to another hosting company for permalink option. But it is a bit annoying because rewrite rules are working on Godaddy. I have installed wordpress(10 or more different websites), and drupal(3 or more websites), and no problem with permalinks. When you create your htaccess file for the first time, you need to wait for a couple of hours (in avarage 2-3 hours). After that first initialization, every change in htaccess are applied instantly. Namely you just need to wait only for the first time.
I also tried a simple redirect to check my htaccess file in forum root directory. And it was working.
So as the creator team of bbpress is the same for wordpress. And as wordpress is ok with godaddy. The team may suggest an alternative way for rewrite rules. I dont know much about rewrite rules. And I believe the file (bb-admin/rewrite-rules. php) creates correct rules for the most of the servers.
SOLUTION:
I wrote all the above information and then I think to add my config.php file to here. So I find out something, that I dont use akismet, so I add
//
to beginning of that line, namely://$bb->akismet_key = ''; // Example: '0123456789ab'
and it is working now
May 4, 2007 at 8:41 am #57392In reply to: Trying to integrate bbpress with my wordpress
fel64
MemberThat’s because you’re using a left-hand margin on your sidebar and your main div to push them to the right.
<div id="main">
<div id="discussions">
<div id="secondary">That’s roughly your HTML structure.
Main
is the full width of the central white bar, so there’s no way you can getSecondary
next to it.Discussions
is a sub-part ofMain
, and it’s pushed over to the right by a large margin on the left.Secondary
is not part ofMain
, and pushed over to the far right because it has a humoungous 71% margin.Firstly you want to put
Secondary
into yourMain
div, otherwise there’s no way to do it. Then you need to put either one on the left; the way to do this would be to get rid of its giant margin. That should work.Otherwise, if you’re not doing it by the margin property, you could put
Secondary
intoMain
again, then giveSecondary
andDiscussions
afloat: left;
and afloat: right;
property (or the other way around). If there’s enough room, they should now be side by side – otherwise make them narrower.You can also get rid of the
wrapper
‘sborder
properties, that’s what’s giving you the double-width line.That’s a nice theme you made, though.
May 3, 2007 at 8:14 pm #57390In reply to: Adding a link to forum in my wordpress site
chrishajer
ParticipantFrom the looks of your site, it worked.
May 3, 2007 at 4:36 pm #56563In reply to: limit forums included in latest discussions
fel64
MemberYup! Find this (or similar) codeblock in your theme’s
front-page.php
.<tr<?php topic_class(); ?>>
<td><a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></td>
<td class="num"><?php topic_posts(); ?></td>
<td class="num"><?php topic_last_poster(); ?></td>
<td class="num"><small><?php topic_time(); ?></small></td>
</tr>Around it put
<?php if( $topic->forum_id != 666 ) { ?>
... that code block ...
<?php } ?>You will probably want to change
666
to whatever forum id you actually want to exclude. You can put any conditional logic you like inside those if( … ) brackets, so for example to filter for two forums you would putif( $topic->forum_id != 666 && $topic->forum_id != 999 )
. Hope that helps.May 3, 2007 at 4:31 pm #57401fel64
MemberI think
require_once
(orrequire
,include
orinclude_once
for that matter) need a path to the file rather than a URL. A path would be like the addresses you get when you’re browsing folders on your computer. I can’t say what your path would be, but mine is/home/username/public_html/wordpress/wp-config.php
. Ask your hosting provider if you don’t know what to use.It might be easier to recreate the theme anyway, if I remember rightly a fair few folks come here with problems when trying to stick bb into the WP theme like that.
May 3, 2007 at 12:25 pm #1821csl749
MemberHi folks,
I have WP and BB running off the same DB, integrating users etc as far as I can tell, and each working perfectly. But, following the instructions on the docs page on how to integrate WP functions so they can be called in BB, I get errors.
I put the
require_once('www.mywebsite.com/wp-blog-header.php');
at the top of the BB config.php, in the hope that the WP functions would be discovered, but each time I try to add, say, a line to front-page.php like get_header or get_footer, to visually sandwich BB inside my WP header/footer, I get an error:Fatal error: Call to undefined function: get_header() in /home/csleary/public_html/forum/my-templates/lemodie/front-page.php on line 1
I’m very much a novice with all this, so I’m just following instructions at the moment hoping things will work. But as far as I can tell I’ve done everything correctly – please may someone offer some ideas as to what’s going wrong? While searching other integration threads, I came across one that said to make sure WP was loaded first, so BB could then load the functions, but I don’t know how to ensure this. BB is currently in siteroot/forum, and wordpress is in the root dir itself.
Any help would be fantastic, thanks.
May 3, 2007 at 4:09 am #57384In reply to: phpbb -> bbPress success…almost (SQL HELP!)
chrishajer
ParticipantCan you do it from a command line rather than a web interface to avoid the upload problem?
Can you upload the file and then do something like this on the command line:
mysql -u UserName -p DBName < TheFullTargetFilePath.SQL
-p will prompt for the password on the command line
I imagine there’s probably a -h if you need to specify a different host too.
May 3, 2007 at 4:06 am #57388In reply to: Adding a link to forum in my wordpress site
chrishajer
ParticipantThere are a couple of tricks you could use (I have no idea how it’s done officially.)
In your site, all you would need to do is insert this into the template that contains the page navigation you have now (Home, About and Contact all appear to be pages):
<li class="page_item"><a href="<?php bloginfo('url'); ?>/forum/" title="Visit the forum">Forum</a></li>
HTH
Chris
May 3, 2007 at 1:16 am #57381In reply to: phpbb -> bbPress success…almost (SQL HELP!)
migpilot
MemberHey fel64, I might get lynched if I drop off posts… quite a bit of great stuff there.
My import is up to around 30,000KiB, so that’s not the issue….
My SQL mojo man is AWOL, hence me coming here to look for some of the good SQL loving
May 3, 2007 at 12:56 am #57380In reply to: phpbb -> bbPress success…almost (SQL HELP!)
fel64
MemberI vaguely remember from setting up bb in localhost and trying to copy my server DB into my local MySQL that PHPMyAdmin wouldn’t take more than 16 Mb when importing. That might well be a setting that can be set somewhere, I don’t know; I can’t find it in its config file, in any case.
Edit: my localhost version of phpMyAdmin says “Max: 16,384KiB” by the import dialog.
To get around this if it is the problem, can you live without 1/3rd of the posts? Then you could delete them in the original database via some query and export the remaining 2/3rds. It might be better to hold out for someone with more database-mojo to come along and see if there’s a non-destructive way.
May 2, 2007 at 7:01 pm #57372In reply to: Code_trick made pluggable
Trent Adams
MemberMay 2, 2007 at 3:52 pm #56694In reply to: Plugin: Avatar Upload
LMD
ParticipantVersion 0.3 is now available for download from the plugin browser.
Version 0.3 is not compatible with previous versions, so you will have to go through your templates and make some changes to the template functions (check the Readme file).
New Features
* added an ‘Avatar’ tab to the profile menu
* added a ‘default avatar image’ option (if you don’t want to use fel64’s identicons — see previous posts in this thread).
* can access just the avatar’s URI for use in other plugins.
fel – how would you like me to link to the identicon’s plugin? Currently, I’m just linking to your post in this thread.
Oh and I have hacked together an Über-Avatar plugin which pulls together the various avatar plugins into one ‘api’. It iterates through some logic based on a specified order of preference (set by the admin), checking to see if the user has specified an avatar using each plugin.
For example:
Order to check: avatar-upload, bb-avatar. bb-myavatars, identicon
Has user uploaded an avatar?
— Yes: Invoke the ‘avatar-upload’ plugin template function and break.
— No… continue
Has the user specified an external URL?
— Yes, invoke ‘bb-myavatar’ template function and break.
— No… continue
Has the user got a Gravatar?
— Yes, invoke ‘bb-myavatars’ template functions and break.
— No… continue
Has the user got an identicon?
— Yes, invoke the same code as ‘avatar-upload’ and break.
— No. create an identicon and then invoke the ‘avatar-upload’ code.
It’s not perfect yet though, so no release.
May 2, 2007 at 2:13 pm #57352In reply to: Plugin: Move It
gh3
Membermeanwhile I wait for the svn account, i can say you that now we are on 0.11 version, i have just finished to add the upgrade topic info for both destination and original thread.
sooner the download link… i hope
May 2, 2007 at 12:27 pm #57341In reply to: MathML and BBpress working together
dprice
MemberAh – so ridiculously easy! I’m liking BBpress more and more
.
I just requested code_trick to become pluggable too – hopefully that’ll happen, and soon, so I can just use a plugin and not hack at core files.
May 2, 2007 at 12:20 pm #1815Topic: Code_trick made pluggable
in forum Requests & Feedbackdprice
MemberRequest: functions-fomatting.php code-trick() to be made pluggable.
Reason: So parsers such as ASCIIMath can do their replacements on things in backticks. Then I can make a plugin for MathML support
May 1, 2007 at 10:40 pm #57350In reply to: adding wordpress admin link
fel64
MemberDoes that work? It should have been:
<?php if( bb_current_user_can('administrate) ) {
$wp_admin = 'wordpress/wp-admin/';
echo '<a href="'.$wpadmin.'">Wordpress Admin</a>'; } ?>Sorry!
May 1, 2007 at 9:10 pm #57349In reply to: adding wordpress admin link
midnightsun
Memberhey,
it doesn’t seem to be working! i’ve edited it a little
<?php if( bb_current_user_can('administrate') {
$wpadmin = 'wordpress/wp-admin/';
echo '<a href="'.$wpadmin.'">Wordpress Admin</a>'; } ?>) -
AuthorSearch Results