Search Results for 'code'
-
Search Results
-
I am trying to locate the file to add code above my pagetitle on my forums in bbpress. I am not sure where the file is located. I am simply wanting to add a banner of adsense there.
Topic: Inefficient / heavy query
Hello,
We’ve got a really big bbPress forum running at http://realmadridcf.nl.
At some point though, the site crashed because of heavy query. After some inspection of the SQL slow query log, we found out that it was this query:
# Query_time: 2.798700 Lock_time: 0.000138 Rows_sent: 5 Rows_examined:
366600
SET timestamp=1321347478;
SELECT SQL_CALC_FOUND_ROWS wpecs_posts.* FROM wpecs_posts INNER JOIN
wpecs_postmeta ON (wpecs_posts.ID = wpecs_postmeta.post_id) WHERE 1=1
AND wpecs_posts.post_type IN ('topic', 'reply') AND
(wpecs_posts.post_status = 'publish' OR wpecs_posts.post_status =
'closed') AND ( (wpecs_postmeta.meta_key = '_bbp_forum_id' AND
CAST(wpecs_postmeta.meta_value AS CHAR) NOT IN
('8365804','8558913','8558914','8561009','8561010','187','8365804')) )
GROUP BY wpecs_posts.ID ORDER BY wpecs_posts.post_date DESC LIMIT 0, 5;
You can see that this query is obviously way too heavy: Rows_sent: 5 Rows_examined:
366600…
After some examination we found out that the query was made through bbp_forum_functions.php – line 923 – function bbp_pre_get_posts_exclude_forums.
Has this problem ever occurred before? Is there someone with a solution?
Regards,
Tommy
I just spent hours figuring this out so I thought I’d try and save others the bother by sharing it here.
The basic aim was to hide the contents of topics in a bbPress 2.0 forum from any users not logged in. This makes for a nice private forum.
I found suggestions about making forums hidden, private and so on but none of them really worked as they hid them for logged in users too.
My final solution was to make bbPress ‘dumb’ when it comes to logged out users. I.e., it could either be clever and say “there are topics, but you’re not allowed to see them until you login” or it could just say “there are no topics”.
The following code does the latter, dumb version by hooking into the forums, topics and replies loops.
Code:function pj_hla_logged_in_topics($have_posts){
if (!is_user_logged_in()){
$have_posts = null;
}
return $have_posts;
}
add_filter(‘bbp_has_topics’, ‘pj_hla_logged_in_topics’);
add_filter(‘bbp_has_forums’, ‘pj_hla_logged_in_topics’);
add_filter(‘bbp_has_replies’, ‘pj_hla_logged_in_topics’);I simply placed this within my theme’s functions.php but you could just as easily wrap this in a function.
Hope that helps someone!
I am using bbpress2.0 (bbress 2.0.1 plugin) on WordPress 3.2.1 and want to allow “pre” tag and “class” attribute for non-admin users.
I modified /includes/kses.php in the WordPress.
I placed fllowing code in the definition of $allowedtags.
'pre' => array(
'class' => array ()),Nevertheless, “class” attribute was removed.
So,
<pre class="value">my code</pre>was replaced with<pre>my code</pre>.Any thoughts?
Thank you.


the BBPress plugin did not have the bb-config.php, so I used the bb-config that is within the buddypress. Hence, I couldnt get the bb-press 2.0 to work. But again when I did it with what is built into buddypress itself, all the files and folders showed up like they were missing.