Search Results for 'code'
-
Search Results
-
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.
Hey All,
I have installed the bbPress plugin on a few wordpress instances and tend to favour a vanilla install coupled with CSS overrides to provide the look & feel I need.
On a recent install I have spotted an issue with user profiles. When I try and navigate to the user’s profile (typically yoursite.com/users/<username>) I am receiving a 404 page from WordPress.
I can browse to another users profile and it resolves fine. The only difference I can see is that the profile which is not working has a username which has spaces e.g. FirstName LastName as opposed to FirstNameLastName.
Has anyone else had this issue and know if its a genuine bug or a “feature”?

Cheers, Matt
Topic: Contents of bbp-topic-index
I currently use the shortcode bbp-topic-index quite heavily to display the top list of topics currently being discussed. What I want to do is be able to manipulate how the information is displayed inside of that shortcode.
Specifically, I want to change the links in the topic title to have the same function as “freshness” (so that when you click on the topic subject it takes you to the most recent post). It’s a feature my users have been asking for…
Unfortunately I’m having some trouble discerning exactly WHICH file to edit. I’m sure I can take it from there.
Thanks!
Topic: I want to browse for apps
I want to browse for apps
Many “community” forums available on the internet have attempted to create a list of apps that are available for android tablets for sale but they all have on thing in common, poor execution. The list is unintuitive and uninteresting. A very bland list of apps with no description or screenshots-that’s not how I want to browse for apps. starzmart
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.
yours might be the halcyon we’ve all been hoping for! that’s the beauty of all this stuff! 