I just installed bbPress 1.0 to my dev server today and something strange is happening.
Instead of “Reply” or “New Topic in this Forum” for the h2 class “post-form”, I am now getting the string “Array”.
Any idea why?
Funny thing is this isn’t happening on my localbox where I installed bbPress 1.0 from 1.0 alpha 6 exactly the same way.
—
I just went into functions.bb-template.php to do a var_dump of the $h2 variable in the post_form() function and this is what I get:
array(1) { ["h2"]=> array(1) { ["h2"]=> array(1) { ["h2"]=> *RECURSION* } } }
Any idea why the $h2 variable is an array when it should be outputting one of the strings “Reply”, “New Topic in this forum” or “Add New Topic”?
I just installed bbPress 1.0 to my dev server today and something strange is happening.
Instead of “Reply” or “New Topic in this Forum” for the h2 class “post-form”, I am now getting the string “Array”.
Any idea why?
Funny thing is this isn’t happening on my localbox where I installed bbPress 1.0 from 1.0 alpha 6 exactly the same way.
[EDIT]
I’m going to open a new thread because my post is diverting from the original intent of this post.
To learn how bbPress works, I would suggest browsing the source of the top level files in the bbPress root.
is_forum
simply checks the url and does not know which forum it is in
but it can be used before repermalink happens (similar to wordpress)
to get the current forum, in theory you should be able to
global $forum_id;
And then the $forum_id
is the current forum number. You can then use the api to get the forum name, etc. if desired.
This may not work in all cases as bbPress has some nasty code in some places that even in 1.0 still does not reset the counter after loops. For example a forum page that has some sub-forums, the $forum_id
might very well be the last sub-forum displayed (if the bug has not been fixed yet).
You also cannot fetch $forum_id
before repermalink happens which is after bb_init
is triggered. Shouldn’t be a problem unless you are trying to execute code while a plugin is loading vs. after init
ps. is_forum
is deprecated in 1.0, use bb_is_forum
Memcache is going to be an absolutely useless suggestion for 95%+ of bbPress users.
Most won’t have the knowledge or resources to set it up and the performance boost will be trivial, almost non-existent for a single server setup (on a shared host it won’t even be a possibility). A proper mysql cache, opcode cache, and local disk cache will come within the same single digit performance gains of memcache.
Memcache is only beneficial for multi-server systems, it’s why it was invented in the first place.
The way to cache forums properly is to cache parts of the pages and build the page based on each user on demand. This allows much more dynamic content.
Large forums usually have an additional problem with several bots crawling them at once at any given time which is why caching every single page in a page cache (like wp super cache) can be a problem. The bots will fill the cache with many one-time hits which have to be purged very soon after they are created.
Speaking of .htaccess
I want to express how I simply cannot disagree more with the suggestion during bbPress 1.0 install to make it writeable by bbPress.
Opening .htaccess
to writes by PHP is an INCREDIBLY bad idea security-wise.
Never, ever, make any part of your bbPress (or WordPress) install write-able or you are just begging to be hacked sooner or later. Always use FTP and replace it yourself.
If you are on a shared server, the vulnerability is magnified many more times.
Directories used for caching and uploading that simply must be writable should always be “above” the web-root so that an attacker cannot easily execute files they just uploaded or modified.
One day bbPress will have a template editor like WordPress and I will have to recommend deleting it and never chmod’ing the template directory as well.
I don’t use Hidden Forums plugin. I also tried disabling all the plugins – still the same navagation issue.
Then I disovered that if I use “none” permalink structure (/forums.php?id=1) everything works fine. If I use either “numeric” or “name based” (my preference) the problem is back.
Really noone faces such an issue?
my .htaccess looks like that now:
# BEGIN bbPress
Options -MultiViews
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^page/([0-9]+)/?$ /index.php?page=$1 [L,QSA]
RewriteRule ^forum/([^/]+)/page/([0-9]+)/?$ /forum.php?id=$1&page=$2 [L,QSA]
RewriteRule ^forum/([^/]+)/?$ /forum.php?id=$1 [L,QSA]
RewriteRule ^forum/?$ / [R=302,L,QSA]
RewriteRule ^topic/([^/]+)/page/([0-9]+)/?$ /topic.php?id=$1&page=$2 [L,QSA]
RewriteRule ^topic/([^/]+)/?$ /topic.php?id=$1 [L,QSA]
RewriteRule ^topic/?$ / [R=302,L,QSA]
RewriteRule ^tags/([^/]+)/page/([0-9]+)/?$ /tags.php?tag=$1&page=$2 [L,QSA]
RewriteRule ^tags/([^/]+)/?$ /tags.php?tag=$1 [L,QSA]
RewriteRule ^tags/?$ /tags.php [L,QSA]
RewriteRule ^profile/([^/]+)/page/([0-9]+)/?$ /profile.php?id=$1&page=$2 [L,QSA]
RewriteRule ^profile/([^/]+)/([^/]+)/?$ /profile.php?id=$1&tab=$2 [L,QSA]
RewriteRule ^profile/([^/]+)/([^/]+)/page/([0-9]+)/?$ /profile.php?id=$1&tab=$2&page=$3 [L,QSA]
RewriteRule ^profile/([^/]+)/?$ /profile.php?id=$1 [L,QSA]
RewriteRule ^profile/?$ /profile.php [L,QSA]
RewriteRule ^view/([^/]+)/page/([0-9]+)/?$ /view.php?view=$1&page=$2 [L,QSA]
RewriteRule ^view/([^/]+)/?$ /view.php?view=$1 [L,QSA]
RewriteRule ^rss/?$ /rss.php [L,QSA]
RewriteRule ^rss/topics/?$ /rss.php?topics=1 [L,QSA]
RewriteRule ^rss/forum/([^/]+)/?$ /rss.php?forum=$1 [L,QSA]
RewriteRule ^rss/forum/([^/]+)/topics/?$ /rss.php?forum=$1&topics=1 [L,QSA]
RewriteRule ^rss/topic/([^/]+)/?$ /rss.php?topic=$1 [L,QSA]
RewriteRule ^rss/tags/([^/]+)/?$ /rss.php?tag=$1 [L,QSA]
RewriteRule ^rss/tags/([^/]+)/topics/?$ /rss.php?tag=$1&topics=1 [L,QSA]
RewriteRule ^rss/profile/([^/]+)/?$ /rss.php?profile=$1 [L,QSA]
RewriteRule ^rss/view/([^/]+)/?$ /rss.php?view=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /index.php [L]
</IfModule>
# END bbPress
Submit a trac enhancement, would be nice if if what you say is true.
As per me, its not easy as it sounds. You will need place in db to hold those comments like in WP. How about picking the code from WP itself? Post id can be replaced with user id and like..
Yeah! I think I got it. Thanks _ck_ !
I will try it and get back if I need more help.
Ending things at a year end is much more tidy than the middle when many more people are away.
Except I feel that more people are off on Winter vacation in December
But I’m not all that hung up on summer v. winter showdowns. I suspect the same volume of people will be away in December as July, so why not pull a GeoCities and shut down Oct 26th 
The only real reason I can see for stopping 0.9 support is that it’s time consuming in a direction that’s no longer being followed (see _ck_’s explanation). And that’s fair, y’know 
0.9 IS stable. It’s more tested than 1.0. But I agree with johnhiler, in that this doesn’t need to be a WarGames, zero-sum thing. There are always reasons to stay a couple revs back. Anyone who runs a server knows that. You want to upgrade to get new things, but you also end up holding off because it works as it, and you don’t want to mess with what works. But. There’s a point where holding off will cause you more pain when you have to upgrade.
Thankfully, we’re not there yet!
Sez Sam:
As long as bbPress 0.9 is maintained some time will have to be spent maintaining the 0.9 branch, mostly with regards to security fixes. I don’t see this as particularly burdensome, but I don’t want to be doing it forever.
12 to 18 months is long enough, IMO, for that. Pick one, carry on. A set in stone date is good so people can’t say they weren’t warned
Perfect _ck_, thank you, that’s all I needed.
For anyone else interested I added class to the array so I can style the images, so the function now reads:
add_filter( 'bb_allowed_tags', 'allow_images_allowed_tags' );
function allow_images_allowed_tags( $tags ) {$tags['img'] = array('src' => array(), 'title' => array(), 'alt' => array(), 'class' => array()); return $tags; }
then added:
.featureimage {
padding: 4px;
background: #eee;
border: 1px solid #ccc;
max-width:560px;
}
.thumbnail {
float: left;
width: 100px;
height: 100px;
margin: 0 20px 10px 0;
padding: 4px;
background: #eee;
border: 1px solid #ccc;
}
to my style.css
This would be fairly straightforward to do via a plugin.
Sam recently modified a filter for a post class based on my suggestion in 1.0
https://trac.bbpress.org/ticket/1091
https://trac.bbpress.org/changeset/2093
All you would have to do is hook the filter and examine the user for the post, then add a class based on role.
So the framework you need is something like this:
add_filter( 'post_del_class', 'post_class_by_role',10,2);
function post_class_by_role($classes, $post_id ) {
$post=bb_get_post($post_id);
// do stuff here, add class to $classes if necessary
return $classes;
}
This won’t work in 0.9 however, you would need a template modification instead.
MDA tried to put in code that prevented malformed image tags. Since bbPress uses raw html and not bbcode by default, it’s always something to consider. However you can run a minimal plugin to allow any and all images quite easily:
add_filter( 'bb_allowed_tags', 'allow_images_allowed_tags' );
function allow_images_allowed_tags( $tags ) {$tags['img'] = array('src' => array(), 'title' => array(), 'alt' => array()); return $tags; }
That’s all that’s needed to permit the image tag.
Single Sign-on is a very convenient feature to have in an organization, and for web services (on apache, at least) it’s very conveniently provided by mod_auth_kerb.
However, there is a problem preventing its use with bbPress, namely user name handling.
Kerberos user names are of the form user@DOMAIN.TLD. bbPress username sanitization rules are too strict and strip the ‘@’ character outright. And anyway, domain concept is not supported throughout the code and in underlying database.
Moreover, the whole HTTP auth support (purportedly, a basic thing in any web app) relies on external and somewhat broken plugin (it uses bb_user_exists deprecated function, which is not working properly in 1.0, or at least it seems so to me).
In my most extant dreams (phpbb style
, SPNEGO auth plugin should be also able to query an LDAP database (which is most often present in such set-ups) for extra user info.
This doesn’t solve the other problems like.. Underlining, Stricking the text, font size increasing etc. And in the links that we add using TinyMCE editor gives an extra quote in the resulting form content link!
I am using bbpress 1.0 and there is a file by name functions.bb-forums.php inside bb-includes folder. I opened it and saw these codes
function bb_allowed_tags() {
$tags = array(
'a' => array(
'href' => array(),
'title' => array(),
'rel' => array()),
'blockquote' => array('cite' => array()),
'br' => array(),
'code' => array(),
'pre' => array(),
'em' => array(),
'strong' => array(),
'ul' => array(),
'ol' => array(),
'li' => array()
);
I added 'p' => array(),
to solve the <p>
tag problem.
But all other problems regarding underline, stricking the text, adding image also doesn’t work(I have installed allow-image plugin), font size increasing also doesn’t work.
Please help.. and if possible get back to me at satish at technotip DOT org [ Its .ORG and not .COM ].
Thanks
I see you have finally converted to the new admin style… congratulations!
It looks really good (except the green buttons in some places). Thanks.
hi there.
I successfully integrated wpmu 2.7.1 with bbpress 1.0. all works as its supposed to, except for some small questions/problems:
– the forums are located here: http://zice.ro/forum/ so basically bbpress is isntalled in a folder called forum
– the links to the forums looks weird, notice the link contains forum twice? i.e. http://zice.ro/forum/forum/pluginuri
– I checked my .htaccess inside the forum folder: http://pastebin.com/f3b96dbc9 notice the rewrite base says: RewriteBase /forum/ I tried changing it to / but that doesn’t help. What is it supposed to look like?
– besides why do almost all rewrites inside that file have an additional forum inside? i.e. RewriteRule ^page/([0-9]+)/?$ /forum/index.php?page=$1 [L,QSA] is that automatically taken from the isntallation folder?
– how could I get rid of that additional forum? Looks stupid 
– bbpress sees all my registered users, but claims they have no role. I’d realy hate to have to manually edit all users and give them memebr privileges. shouldn’t there be a way to automatically promote all existing wpmu users to bbpress members?
– I tried the DEEP INTEGRAATION, but still, even if using <?php wp_head(); ?>
inside mh header.php doesn’t trigger all wordpress plugins that should be triggered when calling the wp_head – is there a way to autoamte this?
It appears, that the “admin” issue is also SSL related.
In admin.php:8 bb_auth is called with implied, default scheme “auth”.
However, later on in functions.bb-pluggable.php:145, the following code is encountered:
if ( is_ssl() ) {
$scheme = ‘secure_auth’;
} else {
$scheme = ‘auth’;
}
Which, given that is_ssl() returns true, will make the validation fail and user bounced out of admin page.
For now, I replaced ‘secure_auth’ with ‘auth’ in ssl branch as well, which appears to be a reasonable hack for me.
Thanks ck…
But, you forgot to escape .
So, the correct code is:
$url = bb_get_option('uri').trim(str_replace(array(trim(BBPATH,"/\"),"\"),array("","/"),dirname(__FILE__)),' /\').'/';
BB_PLUGIN_URL is useless as there are several places a user can put a plugin. Most users also don’t know they aren’t supposed to use bb-plugins
and make my-plugins
because the powers that be refuse to ship bbpress with a pre-made my-plugins
directory.
After much trial and error and problems reported by windows users, I figured this out:
$url=bb_get_option('uri').trim(str_replace(array(trim(BBPATH,"/\"),"\"),array("","/"),dirname(__FILE__)),' /\').'/';
$path=rtrim(dirname(__FILE__),' /\').'/';
Where $url is the full uri to the local plugin’s directory (ie. if you have an image in there, that’s the url to it)
The $path is the local storage path that will work in both windows and linux.
It may look like these functions can be simplified but if you do that, I guarantee you’ll break it under one environment or another.
Why the part of code of “Reply” “New Topic in this Forum” is it not editable in the template ? I must modify a core file to edit this
What’s the code to show the rss favorite link ? Thanks
Sam mentioned that he’d be making an official bbPress Codex the week after 1.0 came out… so maybe we’ll get an official one soon.
Simply installing wiki software does not a codex make.
It’s been tried a few times before and no one has taken any time to do documentation, especially on a slow 3rd party server that can disappear at any time.
It took WordPress a few years and only after 2.0 did volunteers finally get some documentation done, I expect it will be the same for bbPress.