Search Results for 'code'
-
AuthorSearch Results
-
July 6, 2009 at 11:34 pm #75559
In reply to: conditionals with is_forum()
_ck_
ParticipantTo learn how bbPress works, I would suggest browsing the source of the top level files in the bbPress root.
is_forumsimply checks the url and does not know which forum it is inbut 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_idis 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_idmight very well be the last sub-forum displayed (if the bug has not been fixed yet).You also cannot fetch
$forum_idbefore repermalink happens which is afterbb_initis triggered. Shouldn’t be a problem unless you are trying to execute code while a plugin is loading vs. after initps.
is_forumis deprecated in 1.0, usebb_is_forumJuly 6, 2009 at 11:27 pm #74322In reply to: Convert WP Super Cache plug-in for bbPress ?
_ck_
ParticipantMemcache 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.
July 6, 2009 at 11:13 pm #75362In reply to: bbPress 1.0 released
_ck_
ParticipantSpeaking of
.htaccessI want to express how I simply cannot disagree more with the suggestion during bbPress 1.0 install to make it writeable by bbPress.Opening
.htaccessto 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.
July 6, 2009 at 7:30 pm #75514In reply to: Navigation error
taboo
MemberI 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 bbPressJuly 6, 2009 at 6:39 pm #75535In reply to: "Reply" code it's not editable
July 6, 2009 at 6:39 pm #75534In reply to: "Reply" code it's not editable
Jason Giedymin
MemberSubmit a trac enhancement, would be nice if if what you say is true.
July 6, 2009 at 5:33 pm #75552In reply to: Show comments in the bbpress profile
Ashish Kumar (Ashfame)
ParticipantAs 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..
July 6, 2009 at 3:04 pm #75544In reply to: Style Keymaster's posts
Ashish Kumar (Ashfame)
ParticipantYeah! I think I got it. Thanks _ck_ !
I will try it and get back if I need more help.
July 6, 2009 at 1:45 pm #75457In reply to: Support for 0.9 – how long?
Ipstenu (Mika Epstein)
ModeratorEnding 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
July 6, 2009 at 11:41 am #75437In reply to: Adding an image to a topic?
thekmen
MemberPerfect _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
July 6, 2009 at 11:22 am #75543In reply to: Style Keymaster's posts
_ck_
ParticipantThis 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.
July 6, 2009 at 11:16 am #75436In reply to: Adding an image to a topic?
_ck_
ParticipantMDA 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.
July 6, 2009 at 10:01 am #15181oakad
MemberSingle 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.
July 6, 2009 at 9:52 am #64729In reply to: Paragraph tag after TinyMCE
Satish
ParticipantThis 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
July 6, 2009 at 9:49 am #70015In reply to: bbPress Admin
Caesar
MemberI see you have finally converted to the new admin style… congratulations!
It looks really good (except the green buttons in some places). Thanks.
July 6, 2009 at 9:02 am #75357In reply to: bbPress 1.0 released
ovizii
Participanthi 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?July 6, 2009 at 8:00 am #75392In reply to: Wierd problems installing bbPress
oakad
MemberIt 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.
July 6, 2009 at 7:37 am #75488In reply to: Getting Plugin URL
Gautam
MemberThanks 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__)),' /\').'/';July 6, 2009 at 6:58 am #75487In reply to: Getting Plugin URL
_ck_
ParticipantBB_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-pluginsand makemy-pluginsbecause the powers that be refuse to ship bbpress with a pre-mademy-pluginsdirectory.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.
July 6, 2009 at 5:19 am #15179Topic: "Reply" code it's not editable
in forum ThemesMarcomail
MemberWhy 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
July 6, 2009 at 5:15 am #15178Topic: rss favorite link
in forum TroubleshootingMarcomail
MemberWhat’s the code to show the rss favorite link ? Thanks
July 6, 2009 at 2:03 am #75530In reply to: bbPress Codex
johnhiler
MemberSam 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.
July 6, 2009 at 1:58 am #75529In reply to: bbPress Codex
_ck_
ParticipantSimply 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.
July 5, 2009 at 11:46 pm #15157Topic: Adding an image to a topic?
in forum Troubleshootingthekmen
MemberHi all, using bbPress 1.0, how do I add an image to a topic?
Using <img src=”path_to_image” /> just displays that code on the topic.
July 5, 2009 at 11:38 pm #75486In reply to: Getting Plugin URL
r-a-y
ParticipantI think gautam2011 means outputting the path to bbPress’ plugin URL directory.
Is there a constant variable like WP_PLUGIN_URL?
I’m looking for this too! I’m porting a WP plugin over.
[EDIT]
Found it! It’s in bb-settings.php
The variable is BB_PLUGIN_URL.
Simple as that!
-
AuthorSearch Results