Put this in your child theme’s function file – or use
Code Snippets
Hi, I have the same issue… where do I add this code? Please help, I’m not a web expert 🙂
Hi,
Is there a shortcode to display just sticky topics?
I tried the code below, but it shows both sticky and non sticky topics.
[bsp-display-topic-index show = '5' show_stickies = 'true']
Thank you, Sam
Hello,
Easiest way would be to override the bbpress’s content-single-topic.php file and move bbp_get_template_part( 'form', 'reply' ); to above bbp_get_template_part( 'loop', 'replies' ); within that file.
For another option, I’ve tried the below on a few different themes without any issues. You’d add the below code to your theme’s functions.php file. Best if you add to child theme so that you don’t have to re-add if you update your theme, same would apply for the first option above.
if ( !function_exists( 'oscowordpress1_move_bbpress_reply_form_filter' ) ) {
function oscowordpress1_move_bbpress_reply_form_filter( $template , $slug , $name ) {
if ( is_array( $template ) && in_array( 'form-reply.php', $template ) ) {
remove_filter( 'bbp_get_template_part', 'oscowordpress1_move_bbpress_reply_form_filter', 10 );
return array();
}
return $template;
}
}
if ( !function_exists('oscowordpress1_move_bbpress_reply_form')){
function oscowordpress1_move_bbpress_reply_form( $slug, $name ){
if ( isset( $name ) && $name == 'replies' ) {
bbp_get_template_part( 'form', 'reply' );
add_filter( 'bbp_get_template_part', 'oscowordpress1_move_bbpress_reply_form_filter', 10, 3 );
}
}
add_action( 'get_template_part_loop', 'oscowordpress1_move_bbpress_reply_form', 10 ,2 );
}
Best of luck, and hope one of those work out for you. 🙂
I have zero knowledge of GamiPress…but let’s park that part of the question for a moment 🙂
Like WordPress itself, bbPress supplies a plethora of hooks that will let you write code that listens for various events—such a new topics being created or replies being added—at which point your code can scan for keywords and interact in various ways. I’m not sure exactly what you’re picturing, but having the bot add replies of its own or perhaps even trigger currency transfers in the context of GamiPress are all possibilities.
How easy this would be I guess really depends on what sort of tasks you want your bot to perform and what conditions you wish to be met before it performs them, but certainly bbPress/WordPress by themselves provide a nice foundation to build on top of.
The topics & replies within forums you can change in your WordPress admin area at Settings > Forums below “Topics and Replies Per Page”.
If you want to change the displayed forum amount(shortcode you mentioned), try adding the below code to your functions.php file of your WordPress theme.
if(!function_exists('poco06_bbpress_change_forum_count_display')){
function poco06_bbpress_change_forum_count_display( $args ){
if( is_array( $args ) && array_key_exists( 'post_type', $args ) && $args['post_type'] == 'forum'){
$args['posts_per_page'] = 100; //Change to number of displayed you want
}
return $args;
}
add_filter( 'bbp_after_has_forums_parse_args', 'poco06_bbpress_change_forum_count_display' ,10 );
}
That should increase it to 100, change as needed. There might be a plugin for that as well that others may be able to point you to.
🙂
You could add the below CSS to get your forums off your header and make the forums fill the page width.
You’d want to add the code to style.css file, preferably in a child theme so that when you update you don’t have to re-add the code. Or if that theme has a options panel with a area to add custom CSS.
body.bbpress .content-wrapper .content-area {
max-width: none;
padding: 0 7px;
}
body.bbpress .content-wrapper,
body.bbpress.no-sidebar.page .content-wrapper {
margin: 0;
padding: 0;
}
body.bbpress .site-content {
padding: 30px 0;
}
Just thought I’d throw that out there as a option 🙂
hello
i am using bb-press plugin in my theme
i have to add short code in my page with word-press function like this in .php page
“<?php echo do_shortcode(‘[bbp-forum-index]‘); ?>”
it’s not working on .php page
—————————————
but when i create page in wordpress admin section and add shortcode on page it’s working
but on .php page it’s not working
can you please help me what i am doing wrong
Thanks 🙂
Hello,
I’m using bbpress with the DIVI theme and got an issue : the [bbp-forum-index] shortcode returns only 50 forums end no more !
I have also tried with the Twenty Twenty theme and got the same issue.
Any idea how I could display more than 50 forums with this shortcode?
Wordpress 5.3.2 and bbpress 2.6.4
Regards
Pat
ok, I’d suggest you take the breadcrumb out as well – that’s the
Home › Forums › Community
So put this in your theme’s custom css area
div.bbp-breadcrumb {
display: none !important;
}
your theme has a css rule
.content-wrapper.with-featured-image {
margin: -4.7em 0 0 120px;
padding: 1.3em 55px 0 1.9em;
}
Basically the ‘margin: -4.7em’ bit is causing the forum to show at a minus height, thus crashing into the header.
the forums page (https://badasscrafters.com/forums/) has the rule without-featured-image so is fine.
Do you have a ‘forums’ page – ie you have a page in your site which has the shortcode
[bbp-forum-index]
I am succesfully using bbpress, with the Avada theme. I notice that my bbpress pages have strange title (in the browser tab). FOr example:
https://telium.io/search/code/
How can I fix this?
I’ve just been testing this on my sites and I can’t get it to fail. Are there any more details in the server error log, do you have any custom code or bbpress plugins installed?
Also does debugging show any additional info?
Would you mind showing your code and an example? Sounds great!
There si a hook that you could use eg for replies there is
/** Additional Actions (Before Save) **************************************/
do_action( 'bbp_new_reply_pre_extras', $topic_id, $forum_id );
// Bail if errors
if ( bbp_has_errors() ) {
return;
}
in includes/replies/functions.php line 354 or thereabouts depending on version
so you could have a hook to add action that checks if bbp_has_errors and if so mail the user before the function bails.
This refers to bbPress 2.6.4.
If a new user topic or reply fails bbPress moderation (either links or bad words), the end user gets no message at all. What they see is simply nothing – just the edit box again, with no indication that their post was marked as pending, and awaits moderation.
So what happens? The user reposts the same message, over and over and over. I have examples of users reposting 10 times. They eventually may ask what is going on, or go away angry.
This seems to be new behavior since 2.6, and depending on the forum admins, this behavior may seem to be mysterious. I’ve run a highly technical forum for years, and did not know about this changed behavior in 2.6 because users typically did not post with more than 2 links.
Even now knowing that, the users are still left mystified. This is very poor user interface design, and the only reasonable solution now is to essentially eliminate any moderation at all.
add_filter( 'bbp_bypass_check_for_moderation', '__return_true' );
Much much better would be to let the user know what happened. I’ve read all the code for moderation, and can’t see any filters to override to add a message for the user.
It would be wonderful to fix this issue, and issue a “Your topic/reply is awaiting moderation.”
The moderators need to get a message as well.
ok, put this in your child theme’s function file – or use
Code Snippets
add_filter( 'bbp_register_topic_post_type', 'rew') ;
function rew ($rew) {
$rew = array(
'labels' => bbp_get_topic_post_type_labels(),
'rewrite' => bbp_get_topic_post_type_rewrite(),
'supports' => bbp_get_topic_post_type_supports(),
'description' => esc_html__( 'bbPress Topics', 'bbpress' ),
'capabilities' => bbp_get_topic_caps(),
'capability_type' => array( 'topic', 'topics' ),
'menu_position' => 555555,
'has_archive' => ( 'forums' === bbp_show_on_root() ) ? bbp_get_topic_archive_slug() : false,
'exclude_from_search' => true,
'show_in_nav_menus' => true,
'public' => true,
'show_ui' => current_user_can( 'bbp_topics_admin' ),
'can_export' => true,
'hierarchical' => false,
'query_var' => true,
'menu_icon' => '',
'source' => 'bbpress',
) ;
return $rew ;
}
add_filter( 'bbp_register_reply_post_type', 'rew2') ;
function rew2 ($rew) {
$rew2 = array(
'labels' => bbp_get_reply_post_type_labels(),
'rewrite' => bbp_get_reply_post_type_rewrite(),
'supports' => bbp_get_reply_post_type_supports(),
'description' => esc_html__( 'bbPress Replies', 'bbpress' ),
'capabilities' => bbp_get_reply_caps(),
'capability_type' => array( 'reply', 'replies' ),
'menu_position' => 555555,
'exclude_from_search' => true,
'has_archive' => false,
'show_in_nav_menus' => true,
'public' => true,
'show_ui' => current_user_can( 'bbp_replies_admin' ),
'can_export' => true,
'hierarchical' => false,
'query_var' => true,
'menu_icon' => '',
'source' => 'bbpress',
) ;
return $rew2 ;
}
Thanks, so something like this:
// Actually build all of this HTML
function build_html() {
$this->sort_users();
$data = $this->stats_builder();
$HTMLOutput = "";
if (is_user_logged_in()) {
if ( is_bbpress() && current_user_can( 'spectate' ) ) {
foreach( $data as $key => $html ) {
$HTMLOutput .= "<div class='bbpas-" . $key . "' id='bbpas-" . $key . "'>" . $html . "</div>";
}
}
}
return $HTMLOutput;
}
Yes?
add an additional if statement
if ( is_bbpress() && ! current_user_can( 'spectate' ) )
if they can’t spectate then they are blocked
since the plugin is not being maintained, suggest you just edit that file to take out the comment out !!
so change
//if (is_user_logged_in()) {
foreach( $data as $key => $html ) {
$HTMLOutput .= "<div class='bbpas-" . $key . "' id='bbpas-" . $key . "'>" . $html . "</div>";
}
//}
to
if (is_user_logged_in()) {
foreach( $data as $key => $html ) {
$HTMLOutput .= "<div class='bbpas-" . $key . "' id='bbpas-" . $key . "'>" . $html . "</div>";
}
}
Notice this code is actually commented out?
//if (is_user_logged_in()) {
That must have been done for a reason.
Look at the function build_html():
// Actually build all of this HTML
function build_html() {
$this->sort_users();
$data = $this->stats_builder();
$HTMLOutput = "";
//if (is_user_logged_in()) {
foreach( $data as $key => $html ) {
$HTMLOutput .= "<div class='bbpas-" . $key . "' id='bbpas-" . $key . "'>" . $html . "</div>";
}
//}
return $HTMLOutput;
}
It calls sort_users(); That in turn does a select query to get a list of active users:
private function sort_users() {
// Set the active users
$this->_activeUsers = $this->get_ActiveUsers();
// Work out the longest time possible for a user to be classed as active
$active_timeframe = strtotime( $this->_sqlTime ) - ( $this->parent->option['user_inactivity_time'] * 60 );
At no point can I see anywhere that it checks to see if the active user is logged in and not blogged in the forum. It should be doing these tests because it should not be exposing user names.
You can see it with my site if you use private mode.
This has to be fixable and I don’t understand why it was never implemented in the first place really. I just don’t know how to do it.
This works:
https://www.publictalksoftware.co.uk/?bbpnns-login=1&redirect_to=https://www.publictalksoftware.co.uk/support-forums/topic/xxx/#post-4784
Hi
I added a reply to a topic with some instructions.
Then, in my main topic I wanted to add a link to the reply so that the user could jump to see it.
For example:
https://www.publictalksoftware.co.uk/support-forums/topic/xxx/#4784
When I click the link it does not jump to that reply. Why?
Yes. I wish I had enough confidence to delve in with this issue myself. It seems it is going to be a simple fix:
display stats = no
is user logged in?
is user forum role not blocked?
display stats = yes
if display stats = yes
show stats
That would be the simplest solution.