Think you probably need to crack open the plugin, and see where GD bbPress Attachments is adding a filter, and exactly what code it is using. You might then be able to mod this in your loop to re-strip it out.
No problem. Just a quick thought, as I might be able to solve it a different way.
Are you using a page called forums and the shortcode [bbp-forum-index]
or did it just come sup in your menu when you installed it?
It’s Ok, neither is wrong, I just need to know which !
ie which in section 3 of the attached did you do
Step by step guide to setting up a bbPress forum – Part 1
It occurs to me to add that I’m nearly illiterate when it comes to code so including the code I’m looking for and what I would want to change would be helpful… Thanks…
Hello!
I’m having an issue with bbPress 2.5.3, Slider Revolution 4.0.5, and Woocommerce 2.1.2. I contacted Slider Revolution, and they said they couldn’t figure out the issue and that I should contact my theme creator since their plugin came bundled with my theme, but the theme creator says it isn’t a theme issue, so I’m reaching out to bbPress since the Woocommerce help desk is down for the weekend in hopes I can at least get a leg up – even though it’s a pretty weird triple-plugin conflict.
1. When all plugins are activated, layer styles in Revolution Slider’s slide editor show a tiny white font in all the previews, but only generate default dark text.
2. When all plugins are activated, I cannot add a slider to a page where bbPress forums are active – it just doesn’t appear, even when I have disabled the theme’s default header, or tried to insert it via shortcodes or php. (Any other page and the slider loads fine)
3. When I deactivate bbPress and its associated plugins, the slider loads correctly because there is no forum on the page.
4. When bbPress and Woocommerce are both deactivated, everything works as it is supposed to in the editor as well.
Existing sliders on the website still load correctly – it’s just an issue of making new ones with a forum on the same page, and getting the editor to work. bbPress prevents a slider created in the Slider Revolution plugin from being published on a page with a forum, and Woocommerce messes up the editor.
Any help or ideas are appreciated. I’ve tried the troubleshooting options in the plugins and nothing seems to fix the issue. Thanks!
What is the best way to get the content of a reply? Right now I’m using bbp_get_reply_content() and it was working fine until I added the GD bbPress Attachments plugin. Somehow that plugin is adding text to the end of the reply content, which doesn’t show up in the forums itself but does show up in a custom forum loop I have on my homepage. E.g replies look like this: “Lorem ipsum etc. Attachments: [delete | detach] [delete | detach] [delete | detach].” FYI, I’m using wp_trim_words to only get the first 30 or so words of the reply, so this garbage text from the plugin only appears on very short replies.
Is there a different way to get the reply text? Anybody else have this issue with the attachment plugin?
Thanks.
@netweb Stephen, Thanks for this, and having now looked at the trac ticket and bbp_parse_args function I see how this works.
@nicmare
Wherever you see bbp_parse_args, there’s a filter for the function to do this.
bbp_parse_args has the format
function bbp_parse_args( $args, $defaults = array(), $filter_key = '' )
The resultant filter name is made up of bbp_before_’ . $filter_key . ‘_parse_args’
(there is an bbp_after one as well!)
The filter key is the third argument in the bbp_parse_args
$r = bbp_parse_args( $args, array(
'before' => '<ul class="bbp-forums-list">',
'after' => '</ul>',
'link_before' => '',
'link_after' => '',
'count_before' => '<span>',
'count_after' => '</span>',
'count_sep' => '</span><span>',
'separator' => '',
'forum_id' => '',
'show_topic_count' => true,
'show_reply_count' => true,
), 'list_forums' );
so ‘list_fourms’ in the last line is the third argument.
This should help you for the other two functions, as filters will then be obvious !
@nicmare To remove the separator:
add_filter('bbp_before_list_forums_parse_args', 'nicmare_bbpress_list_forums' );
function nicmare_bbpress_list_forums() {
$args['separator'] = '';
return $args;
}
A good explanation for bbp_get_topic_admin_links and bbp_get_reply_admin_links is here:
Could a plugin developer protect his functions?
This is what you want for the above:
function hide_forum_counts() {
$args['show_topic_count'] = false;
$args['show_reply_count'] = false;
$args['separator'] = ' ';
return $args;
}
add_filter('bbp_before_list_forums_parse_args', 'hide_forum_counts' );
A full example of all the bbp_list_forums arguments to use either in a custom function or a plugin https://gist.github.com/ntwb/3797945
Robin W! Thanks so much! Your answers led me to the solution:
in functions.php , i have added(with add_filter) a modified “bbp_get_user_profile_url” function,which generates profile urls (original is in bbpress\includes\users\template.php):
here is my code:
remove_filter( 'bbp_get_user_profile_url', 'bbp_get_user_profile_url');
add_filter('bbp_get_user_profile_url','my_replaced' , 10 ,4);
function my_replaced ($url, $user_id, $user_nicename = '' ){
global $wp_rewrite;
if ( empty( $user_id ) ) {return false;}
$early_profile_url = apply_filters( 'bbp_pre_get_user_profile_url', (int) $user_id );
if ( is_string( $early_profile_url ) ) { return $early_profile_url; }
if ( $wp_rewrite->using_permalinks() ) { // if pretty permalinks
$url = $wp_rewrite->root . bbp_get_user_slug() . '/%' . bbp_get_user_rewrite_id() . '%';
if ( empty( $user_nicename ) ) { $user_nicename = bbp_get_user_nicename( $user_id );}
$url = str_replace( '%' . bbp_get_user_rewrite_id() . '%', $user_id, $url );
$url = home_url( user_trailingslashit( $url ) );
}
else { // Unpretty permalinks
$url = add_query_arg( array( bbp_get_user_rewrite_id() => $user_id ), home_url( '/' ) );
}
//return apply_filters( 'Replaced_bbp_get_user_profile_url', $url, $user_id, $user_nicename );
return $url;
}
Ok, I’ve had a think, and another look.
There is no easy way to do less than you’ve done.
The problem is that by the time the “apply filters” has been applied, the $output variable has already been created using the input variables, so changing $r is too late.
What this function needs is an earlier apply filters called say ‘bbp_list_forums_args’ for the $r variable, the you could add a simple filter along the lines of
function hide_forum_counts ($r) {
$r['show_topic_count'] = false ;
$r['show_reply_count'] = false ;
$r['separator'] = ' ';
return $r ;
}
add_filter('bbp_list_forums_args','hide_forum_counts') ;
I’ve have suggested this is a trac ticket
Thanks Stephen – I have added this list to the Codex step by step instructions, so I won’t forget it again !
Have you used the plugin bbP signature?
It is really up to the developers what they spend time on developing. They do this software in their spare time and for free.
If plugins are readily available, they’re seems little point in integrating them. A variety of plugins also gives user choice, and freedom for others to improve the code.
And you would be very unhappy be the sounds of it if they integrated some of the current plugins into core code.
So I repeat, if you don’t like the current plugins, then come back with a detailed critique of what they don’t do, and what they do wrong. That way the developers can see what could be better, and maybe then they would be fired up to add it into core.
So come back with which plugins and detailed issues and feature requests.
Sorry, totally misread this – thought you had posts mirroring and wasted to get rid of them.
I suspect that it would be very hard to get them to just replicate in the database, hits at core code.
But you could re-do your forum templates to show them twice.
Beyond my immediate knowledge, but start by looking at you forum page loop, and then the templates viz
wp-content/plugins/bbpress/templats/default/bbpress
@robin-w Thank you for helping me out with this. I can go right to the http://mysite.com/wp-login.php page without any hangup. I also tried creating a new page and used the [bbpress-login] shortcode with the login widget disabled. Still no luck. I removed any custom jquery from the theme, same result. I removed the widgetized area from the functions.php to be sure the sidebar wasn’t registering anything. Still going to a blank page.
The last thing I tried is disabling all of the plugins except bbPress switching to Twenty Fourteen Theme. going to the http://mysite.com/my-new-page-name and still getting the same result.
These are the plugins that are installed…
Akismet: Version 2.5.9
Contact Form 7: Version 3.7.1
The Events Calendar: Version 3.4.1
WP User Avatar: Version 1.7.2
Most bbp functions have simple variables. Yes, there must be a shorter way, but this is an array not a simple variable, and it builds an unordered list using the array and a loop.
It has an “apply filters” as part of the function, so they are expecting it to be able to be filtered, but hopefully not by having to do it all again !
I am writing some codex guide for filtering in bbPress, and by co0incidence was just using this oen as an example, and have been trying to crack it.
I can do it by amending the template –
https://codex.bbpress.org/layout-and-functionality-examples-you-can-use/ section 2, and save template into
wp-content/themes/yourthemename/bbpress
bbPress then uses that one.
I have posted a fresh query to Stephen Edgar or JJJ to pick up, but it’s gone into moderation as I posted a whole lot of code. Hopefully one of the two will pick it up and answer.
In the meantime yours is so far the best answer !
ok, so I know how to filter variables (and am documenting for the codex), but I cannto figure the syntax for an array.
As an example (and apologies for long code – but in this case hope you’ll let me off!)
function bbp_list_forums( $args = '' ) {
// Define used variables
$output = $sub_forums = $topic_count = $reply_count = $counts = '';
$i = 0;
$count = array();
// Parse arguments against default values
$r = bbp_parse_args( $args, array(
'before' => '<ul class="bbp-forums-list">',
'after' => '</ul>',
'link_before' => '<li class="bbp-forum">',
'link_after' => '</li>',
'count_before' => ' (',
'count_after' => ')',
'count_sep' => ', ',
'separator' => ', ',
'forum_id' => '',
'show_topic_count' => true,
'show_reply_count' => true,
), 'list_forums' );
// Loop through forums and create a list
$sub_forums = bbp_forum_get_subforums( $r['forum_id'] );
if ( !empty( $sub_forums ) ) {
// Total count (for separator)
$total_subs = count( $sub_forums );
foreach ( $sub_forums as $sub_forum ) {
$i++; // Separator count
// Get forum details
$count = array();
$show_sep = $total_subs > $i ? $r['separator'] : '';
$permalink = bbp_get_forum_permalink( $sub_forum->ID );
$title = bbp_get_forum_title( $sub_forum->ID );
// Show topic count
if ( !empty( $r['show_topic_count'] ) && !bbp_is_forum_category( $sub_forum->ID ) ) {
$count['topic'] = bbp_get_forum_topic_count( $sub_forum->ID );
}
// Show reply count
if ( !empty( $r['show_reply_count'] ) && !bbp_is_forum_category( $sub_forum->ID ) ) {
$count['reply'] = bbp_get_forum_reply_count( $sub_forum->ID );
}
// Counts to show
if ( !empty( $count ) ) {
$counts = $r['count_before'] . implode( $r['count_sep'], $count ) . $r['count_after'];
}
// Build this sub forums link
$output .= $r['link_before'] . '<a href="' . esc_url( $permalink ) . '" class="bbp-forum-link">' . $title . $counts . '</a>' . $show_sep . $r['link_after'];
}
// Output the list
echo apply_filters( 'bbp_list_forums', $r['before'] . $output . $r['after'], $r );
}
}
If I wanted to turn off the topic and reply counts, I could use a filter which would look something like
function hide_forum_counts () {
$r['show_topic_count'] = false ;
$r['show_reply_count'] = false ;
$r['separator'] = ' ';
return $r ;
}
add_filter('bbp_list_forums','hide_forum_counts') ;
Stephen, JJJ or other bbp genius – can you post the answer, I have tried everything to prevent needing to copy all the original function, but have failed
Yes. So this is my code which works:
add_filter('bbp_list_forums','custom_bbp_list_forums',10);
function custom_bbp_list_forums( $args = '' ) {
// Define used variables
$output = $sub_forums = $topic_count = $reply_count = $counts = '';
$i = 0;
$count = array();
// Parse arguments against default values
$r = bbp_parse_args( $args, array(
'before' => '<ul class="bbp-forums-list">',
'after' => '</ul>',
'link_before' => '',
'link_after' => '',
'count_before' => '<span>',
'count_after' => '</span>',
'count_sep' => '</span><span>',
'separator' => '',
'forum_id' => '',
'show_topic_count' => true,
'show_reply_count' => true,
), 'list_forums' );
// Loop through forums and create a list
$sub_forums = bbp_forum_get_subforums( $r['forum_id'] );
if ( !empty( $sub_forums ) ) {
// Total count (for separator)
$total_subs = count( $sub_forums );
foreach ( $sub_forums as $sub_forum ) {
$i++; // Separator count
// Get forum details
$count = array();
$show_sep = $total_subs > $i ? $r['separator'] : '';
$permalink = bbp_get_forum_permalink( $sub_forum->ID );
$title = bbp_get_forum_title( $sub_forum->ID );
// Show topic count
if ( !empty( $r['show_topic_count'] ) && !bbp_is_forum_category( $sub_forum->ID ) ) {
$count['topic'] = bbp_get_forum_topic_count( $sub_forum->ID );
}
// Show reply count
if ( !empty( $r['show_reply_count'] ) && !bbp_is_forum_category( $sub_forum->ID ) ) {
$count['reply'] = bbp_get_forum_reply_count( $sub_forum->ID );
}
// Counts to show
if ( !empty( $count ) ) {
$counts = $r['count_before'] . implode( $r['count_sep'], $count ) . $r['count_after'];
}
}
// Output the list
echo apply_filters( 'bbp_list_forumss', $r['before'] . $output . $r['after'], $r );
}
}
but maybe there is an easier way to modify arguments array?!
bbPress actually goes looking for various templates to ‘wrap’ our templates in:
In this order:
– plugin-bbpress.php
– bbpress.php
– forums.php
– forum.php
– generic.php
– page.php
– single.php
– index.php
bbPress will go through each of these from top to bottom and use the first one it finds to wrap the templates in from your current active theme.
We’ve started tracking some plugins we like here https://codex.bbpress.org/feature-plugins-tracking/
We have no specific plans to include any of these in bbPress at this stage but things can change 😉
thank you for reply, i was tested as you suggested and found problem in theme it is working fine in other theme but not in x2 theme also contacted to theme support but they told me this is plugin issue please suggest other way like how we break the loop of forum or group page by hard code.
you don’t actually need to change the permalinks eg is Kazza were user 15
http://www.mysite.com/forums/users/15/edit/
works just as well as
http://www.mysite.com/fourms/users/kazza/edit
so you’d need to change how the profile page is called so that it displays the no. in the url.
Given that profile is called from
any topic or reply display (click the avatar or author name)
several widgets (click the avatar or author name)
possibly other areas
you’d need to re-code these areas.
the function bbp_reply_author_link is used for topic and reply display, not sure if widgets use that as well.
Ok, not quite sure why that stopped working – it used to !
But have just tested this :
function display_counts ()
{
$user_id=bbp_get_reply_author_id( $reply_id ) ;
$topics = bbp_get_user_topic_count_raw( $user_id);
$replies = bbp_get_user_reply_count_raw( $user_id);
$post_count = (int) $topics + $replies;
echo "<br>Total posts : " ;
echo $post_count ;
echo "</br>" ;
}
add_action ('bbp_theme_after_reply_author_details', 'display_counts') ;
and that works.
As before you can then add some if statements to display a status or icon
yes just tried it, and it does say 0 – will come back to you – I just cribbed some code within a larger file that it worked several months ago – will take a closer look !
Yes, but depends on how code savvy you are.
Basically adding this to your functions file will get a count showing
function display_counts ()
{
$post_count = bbp_get_user_post_count( bbp_get_reply_author_id( $reply_id )) ;
echo "<br>Total posts : " ;
echo $post_count ;
echo "</br>" ;
//add some if statements here eg if $post_count>100 echo 'hero' or a link to a picture
}
add_action ('bbp_theme_after_reply_author_details', 'display_counts') ;
and where I’ve indicated adding some if statements link to icons or words will do the second
hmm..
with bbPress you should have a login widget that takes them to the bbPress profile,
I add the following code to it to make editing obvious
<p><a href="<?php bbp_user_profile_url( bbp_get_current_user_id() ); ?>edit" >Amend Profile/Change password</a></p>
You should be able to use that in your widget, or use it to substitute