Published on January 17th, 2014 by Shmoo
I’ve look at it a few times in the WordPress Codex and it probably explains GREATLY how it works and what it does but maybe I just don’t get it.
I understand the concept of taking a function that exists <—> edit it <—> return it to WP Core but how!
Lets say I just simply want to replace the text inside a HTML “… class=”bbp-topic-spam-link”> ” of the spam link.
First step I do is search for the function: bbp_topic_spam_link()
Second step found it inside plugins/bbpress/includes/topics/template.php [ line 2832 ]
Third step copy the entire function to my functions.php file or plugins functions file.
Fourth step, edit the code that you want to edit but after that, how do you add the filter to this function to make it a new or your function.
/**
* Output the spam link of the topic
* @uses bbp_get_topic_spam_link() Topic spam link
*/
function bbp_topic_spam_link( $args = '' ) {
echo bbp_get_topic_spam_link( $args );
}
/**
* Return the spam link of the topic
*/
function bbp_get_topic_spam_link( $args = '' ) {
// Parse arguments against default values
$r = bbp_parse_args( $args, array(
'id' => 0,
'link_before' => '',
'link_after' => '',
'sep' => ' | ',
'spam_text' => esc_html__( 'Spam', 'bbpress' ),
'unspam_text' => esc_html__( 'Unspam', 'bbpress' )
), 'get_topic_spam_link' );
$topic = bbp_get_topic( bbp_get_topic_id( (int) $r['id'] ) );
if ( empty( $topic ) || !current_user_can( 'moderate', $topic->ID ) )
return;
$display = bbp_is_topic_spam( $topic->ID ) ? $r['unspam_text'] : $r['spam_text'];
$uri = add_query_arg( array( 'action' => 'bbp_toggle_topic_spam', 'topic_id' => $topic->ID ) );
$uri = wp_nonce_url( $uri, 'spam-topic_' . $topic->ID );
$retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-topic-spam-link">' . $display . '</a>' . $r['link_after'];
return apply_filters( 'bbp_get_topic_spam_link', $retval, $r );
}
Thanks.
Published on January 17th, 2014 by bpark73
I’m using Headway themes and WP 3.7.1
I just installed bbpress and everything looks good. All pages are styled the way that I want them to until I click on the Topic page (the one that displays the individual topic). This page seems to be styled completely different from the other pages and also elements are severely out of position. When I inspect elements I notice that unlike other pages, class names are named “generically”. No sign of “bbp” prefix for class names on the topic page. Why is this happening for this page only? Any idea what could be happening?
Any explanation and solution would be appreciated. I’m stumped.
Published on January 17th, 2014 by tdubs
Hi bbPress,
There seems to be a conflict between WP 3.8 and bbPress. If I have bbPress enabled my blog shows a 404 page “The page you requested cannot be found”
If I disable bbPress, then my blog loads no problem.
I have disabled ALL plugins to verify that it is just bbPress.
Can anyone help me?
Published on January 17th, 2014 by cdonahue
Hello, I’ve installed bbPress (v.2.5.3) to my custom WordPress website (v.3.8) and it picked up the theme perfectly. However, I can’t get the bbPress sidebar to display. It seems that even though my Forum page (which I’m calling Community) is a WP page, it behaves like something else. Here’s what I’ve done:
— Created a new template for my forum page (community.php);
— Selected that template from the community page per the WP interface;
— Created a new sidebar by registering it in functions.php;
— Moved the bbPress widgets over into my newly created sidebar;
— Called the sidebar from community.php
My community page is defaulting to the main sidebar, or page sidebar, even though I have selected a completely different template for the page. I also tried going with the default page and using bbPress Tweaks but that did not work.
I think I’m missing something about how the forum page works. Any ideas?
Here’s how the page is displaying:
innovativeapprenticeship.org/community
Regards, Cheryl
Published on January 17th, 2014 by Tearstone
My understanding is that there is no “New Posts” functionality for BBPress. Previous support requests on WordPress.org have gone unanswered, and I do not see a plug-in that allows this. I reviewed the documentation and I’m not sure how I could construct my own view with this ability.
What I would like to know is how to craft a forum view that aggregates all the forums into one just like when you click on “Support” at the top of BBPress or Buddypress website. Whenever a new reply is posted, it puts the thread back on top. The GDBBPress tools only has the ability to sort topics when they were first created.
Recap, I would like assistance on constructing a view like the one that we normally use here on BBPress.org or Buddypress.org when clicking the “Support” button.
Thank you,
Russ Sanderlin
@Tearstone
Published on January 17th, 2014 by Swan1305
I created a test forum when setting my site up but now wish to delete or rename it, how do I do this please? (Don’t want to delete the whole thing, just this one forum)
Published on January 17th, 2014 by avgmatt
I have tried everything to get any kind of buttons to show up either visual and html. If they do show, I click on them and they disappear forever with that user account.
I am using Genesis framework and have tried multiple themes and no change.
http://averageoutdoorsman.com/forums/
user: demo
pword: demo
I have tried “bbPress Enable TinyMCE Visual Tab” plugin with no help. I have added the code to show visual in mytheme/functions file. Nothing. Really need help with this.
Published on January 17th, 2014 by mkistler
Hi all. I was wondering if there is a way to “clear notifications” from bbPress. I currently have 90 sitting there, but can only delete them individually. Is there a way to select all or delete all at once? Thanks!
Published on January 17th, 2014 by Shmoo
What’s the PHP code to get this result.
– Display a single forums topics. eg.
I would like to include it inside a page template.
Something I really HATE about bbPress is that it’s very easy to group a bunch of forums inside another forum ( Category ) and list all those forums together at a page template by just the Parent $forum_id of all those forums and you’re done.
Just like this:
<?php if ( bbp_has_forums( array( 'post_parent' => 104 ) ) ) : ?>
Easy right, but that bbp_has_form functions doesn’t have something like this:
<?php if ( bbp_has_forums( array( 'forum_id' => 75 ) ) ) : ?>
Only show forum_id 75 out of the entire loop, or this:
<?php if ( bbp_has_forums( array( 'forum_id' => 75,88,93 ) ) ) : ?>
That doesn’t look like rocket science to me and it would give us so much more customization options.
Look at this screenshot I made.
At the top the block of 4 with the big headings, Mac … + iOS … are forum categories with a bunch a forums inside them. I gave them all their own page templates with each its own ‘post_parent’ Loop.
<?php bbp_get_template_part( 'cat-forums/mac-hardware' ); ?>
At the bottom the green row of none Apple products related are just forums ( single’s ) with no parent stuff.
It’s ridicules difficult to group them together and list them in a list or row and customize them.
You have to do something like this:
<?php bbp_forum_permalink( 98 ); ?>
<?php bbp_forum_title( 98 ); ?>
<?php bbp_forum_topic_count( 98 ); ?>
<?php bbp_forum_post_count( 98 ); ?>
That’s all needed to get the same result as at the top for just a single forum_id.
Beside all that frustration it’s even more difficult to give each single forum ( the page where you show a list of topics ) it’s own template.
You can’t customize the forums differently. Let’s say I want to give al forums at the top the Apple products relegated stuff it’s own page template and all none Apple related stuff another page template it’s simply not possible.
There should be an easy way to just add a forum_id or name after the page-template.php like WordPress does.
Maybe for starters a conditional tag inside the content-single-forum.php template that says, if forum_id’s 75,98,114 go to template X and if forum_id’s 73,120,88 go to template Z else ( if none of those ID’s ) go to template B.
This has been frustrated me for 2 years now and it’s really a game-breaker in customization of bbPress.
🙁
Published on January 17th, 2014 by Will Brownsberger
My office team is complaining that they can’t save topics in draft.
I thought it must be a bug, but tracked it down to very deliberate code in topics.js.
jQuery( document ).ready( function() {
jQuery( '#misc-publishing-actions' ).find( '.misc-pub-section' ).first().remove();
jQuery( '#save-action' ).remove();
} );
I can’t find any reference to problems in the forums — is this just a policy choice or screen simplification? Or is there a reason why I should not just comment out that code?
I’ve tested the topics listings and statistics with the code commented out and saving drafts and all appears to perform correctly.
Some guidance from developers would be much appreciated.
NOTE: I posted this on January 17, 2014 but it took a publication date 18 months earlier. This is a repost on January 18, 2014.