As described this would be very complicated, requiring both single sign on, and data links between two wordpress sites.
I suspect it is doable, but would take many hours work and probably custom code to achieve.
Using a single site, you could have bbpress and use this additional plugin to create private forums for groups whilst having other forums visible by all groups.
This will not fix the sub groups having events and blog posts
I made the following because of an error, does it look ok?
function filter_bbp_get_view_query_args( $args, $view ) {
// Check if the view exists
if ( function_exists( 'bbp_get_view' ) ) {
if ( ! bbp_get_view( $view ) ) {
return new WP_Error( 'invalid_view', __( 'Invalid view specified.', 'bbpress' ), $view );
}
}
if ( 'popular' === $view ) {
$args['date_query'] = array(
array(
'after' => '1 week ago',
),
);
}
return $args;
}
add_filter( 'bbp_get_view_query_args', 'filter_bbp_get_view_query_args', 10, 2 );
Questions about customization. I am using a translation tool, so my English may be unnatural.
In [bbp-single-view id='no-replies'], closed topics are also displayed, so I would like to limit it to open topics, does the following code seem ok? Please advise.
add_action( 'bbp_register_views', 'custom_bbp_no_replies' );
function custom_bbp_no_replies() {
bbp_register_view(
'no-replies',
__( 'Topics with no replies', 'bbpress' ),
apply_filters(
'bbp_topic_no_replies_query',
array(
'post_parent' => 'any',
'post_status' => bbp_get_public_status_id(), // Changed to show only open topics
'meta_key' => '_bbp_reply_count',
'meta_value' => 1,
'meta_compare' => '<',
'meta_type' => 'NUMERIC'
)
),
false
);
}
Excuse me for asking a question about customization.
I am using a translation tool, so my English may be unnatural.
I would like to limit the posts displayed in [bbp-single-view id='popular'] to 7 days.
function filter_bbp_get_view_query_args( $args, $view ) {
// Check if the view exists
if ( ! bbp_get_view( $view ) ) {
return new WP_Error( 'invalid_view', __( 'Invalid view specified.', 'bbpress' ), $view );
}
if ( 'popular' === $view ) {
$args['date_query'] = array(
array(
'after' => '1 week ago',
),
);
}
return $args;
}
add_filter( 'bbp_get_view_query_args', 'filter_bbp_get_view_query_args', 10, 2 );
ok, can you remove that code, and install this plugin :
bbp style pack
once activated go to
dashboard>settings>bbp style pack>bug fixes and you’ll see a tick box
Fix ‘A variable Mismatch has been detected’ click and save
dashboard>forums>add new or
/wp-admin/post-new.php?post_type=forum
No need to assign $topic->ID to $topic_id
You can do just simple:
foreach ($topics as $topic)
chiudi_topic_dopo_24_ore($topic->ID);
bbpress has not had a release since November 2021, so what do you mean by ‘has lately’ – if after that, then suspect something else is now making that not work.
You suggested cause (‘I suspect the code doing this is non-standard’) may be correct and something else is now causing this to show or it may not be bbpress causing this. Maybe look at what else has changed – wordpress, php versions, other plugins etc.
Without knowing your set up or indeed your technical ability (although from you post this seems to be good!) I’d also initially suggest the standard fault finding :
it could be a theme or plugin issue
Themes
As a test switch to a default theme such as twentytwenty, and see if this fixes.
Plugins
If that doesn’t work, also deactivate all plugins apart from bbpress and see if this fixes. if it does, re-enable one at a time to see which is causing the error.
If you cannot do this to your site (say because it is live) then use the ‘troubleshooting’ features of this plugin to let you test without affecting other users
Health Check & Troubleshooting
Then come back
add_filter( 'bbp_get_reply_post_date', 'rew_show_time_since' , 10 , 6) ;
add_filter( 'bbp_get_topic_post_date', 'rew_show_time_since' , 10 , 6) ;
function rew_show_time_since ($result, $reply_id, $humanize, $gmt, $date, $time ){
$gmt_s = ! empty( $gmt ) ? 'G' : 'U';
$date = get_post_time( $gmt_s, $gmt, $reply_id );
$result = bbp_get_time_since( $date );
return $result ;
}
Put this in your child theme’s function file –
ie wp-content/themes/%your-theme-name%/functions.php
where %your-theme-name% is the name of your theme
or use
Code Snippets
Oh the description box and the tags. This is what I did with regard to the description box thus far:
function change_single_topic_description_class( $output, $r, $args ) {
$new_before = str_replace( 'bbp-template-notice info', 'alert alert-info', $r['before'] );
$output = str_replace( $r['before'], $new_before, $output );
return $output;
}
add_filter( 'bbp_get_single_topic_description', 'change_single_topic_description_class', 10, 3 );
Yes, Robin. The codes run without any error. Appreciated your effort in helping me to solve the issue.
I am finishing a Bootstrap 5 theme and I have some questions about the child theme structure.
From what I can asses using BBpress theme as a child theme is by doing the following:
Copy all the template/default/bbpress files into my /childtheme/bbpress folder. This works smoothly and I am happily converting and theming.
But, the class “bbp-breadcrumb” is located in the /includes/common/template.php file.
And the class “bbp-template-notice info” is located in the /includes/forumss/template.php file.
How would I go about to move this behavior to my childtheme? Copy those files there or add code to the functions.php file or something similar?
Any pointers are appreciated!
We have ~30 WP sites on a server.
We store plugins in a central directory and slink to them from each website that uses that plugin.
(Reason: saves a lot of memory in OPCache & saves compiling the code more than once.)
This relies on plugins being well-behaved. bbpress used to work but has lately broken.
We are seeing this error:
Loading failed for the <script> with source https://www.otu.asn.au/home/lamp/wordpress/plugins/bbpress/templates/default/js/editor.min.js?ver=2.6.9
What it should be trying to load:
https://www.otu.asn.au/wp-content/plugins/bbpress/templates/default/js/editor.min.js?ver=2.6.9
Obviously the plugin is using the filepath to construct the loading URL, I suspect the code doing this is non-standard, causing the problem.
Temporary solution is to load the plugin into the wp-content directory of the site, rather than using the slink. This has been implemented but means that the plugin won’t update. (We do updates outside of WP using python/SVN, and apache doesn’t have write access to any directories that contain PHP files – more secure). Fortunately we don’t use the plugin on any other sites.
if ($user_role == 'bbp_prime_moderator') unset ($links['edit']) ;
for custom roles, you just name the role itself.,
There it is:
$bbp_roles['bbp_prime_moderator'] = array(
I’ve tried the two options below but both return errors:
if ($user_role == bbp_get_bbp_prime_moderator_role()) unset ($links['edit']) ;
if ($user_role == bbp_get_prime_moderator_role()) unset ($links['edit']) ;
ok, so what is the role on this line
$bbp_roles['bbp_tutor'] = array(
and what is the code you have added in the code above?
Yes. It works beautifully! 🙂
I just found out something when I thought the issue is solved. The code works well with native bbpress role, but not work with new role created. I have a new role “prime_moderator” created using your plugin, but the code return error when I apply this new role to the codes. Any suggestions?
Regards.
sorry, try this
add_filter ('bbp_reply_admin_links', 'rew_remove_edit') ;
add_filter ('bbp_topic_admin_links', 'rew_remove_edit') ;
function rew_remove_edit ($links) {
$user_id = bbp_get_current_user_id() ;
$user_role = bbp_get_user_role( $user_id );
if ($user_role == bbp_get_keymaster_role()) unset ($links['edit']) ;
if ($user_role == bbp_get_moderator_role()) unset ($links['edit']) ;
if ($user_role == bbp_get_participant_role()) unset ($links['edit']) ;
if ($user_role == bbp_get_spectator_role()) unset ($links['edit']) ;
if ($user_role == bbp_get_blocked_role()) unset ($links['edit']) ;
return $links ;
}
Hi Robin, thanks for your prompt reply.
The code does not work. Perhaps something missing?
I only take this
if ($user_role == bbp_get_moderator_role()) unset ($links['edit']) ;
When moderator log in, he still can see the “edit” link.
Regards.
add_filter ('bbp_reply_admin_links', 'rew_remove_edit') ;
add_filter ('bbp_topic_admin_links', 'rew_remove_edit') ;
function rew_remove_edit ($links) {
$user_role = bbp_get_user_role( $user_id );
if ($user_role == bbp_get_keymaster_role()) unset ($links['edit']) ;
if ($user_role == bbp_get_moderator_role()) unset ($links['edit']) ;
if ($user_role == bbp_get_participant_role()) unset ($links['edit']) ;
if ($user_role == bbp_get_spectator_role()) unset ($links['edit']) ;
if ($user_role == bbp_get_blocked_role()) unset ($links['edit']) ;
return $links ;
}
and amend as needed
spectator and blocked not really needed as neither can post, but included for completeness !!
Hi, I’m using the codes below to remove “Edit” link in reply header without any issue:
add_filter ('bbp_reply_admin_links', 'rew_remove_edit') ;
add_filter ('bbp_topic_admin_links', 'rew_remove_edit') ;
function rew_remove_edit ($links) {
unset ($links['edit']) ;
return $links ;
}
My question: If I want the codes to work only for Role A & Role B, but NOT for other roles, how would I amend the code above?
Regards.
I just had a quick look at the yoast code, and this is deliberate.
a comment in the yoast code says :
If breadcrumbs are active (which they supposedly are if the users has enabled this settings),
* there's no reason to have bbPress breadcrumbs as well.
WordPress v. 6.2.2
BBPress v. 2.6.9
Site (under construction): https://www.batsandblacklace.com
I am able to use the forum index shortcode while I’m editing my forums page and everything looks perfect (first screenshot). On the front end however, it looks completely different and is completely unusable (second screenshot). I have driven myself insane trying to figure this out and I’m coming up completely empty. Does anyone know what’s going on here?
Thanks!
Screenshot 1
Screenshot 2
function bbptoolkit_show_search_form(){
if ( bbp_allow_search()) {
?>
<div class="bbp-search-form">
<?php bbp_get_template_part( 'form', 'search' ); ?>
</div>
<?php
}
}
add_action( 'bbp_template_before_single_forum', 'bbptoolkit_show_search_form' );
add_action( 'bbp_template_before_single_topic', 'bbptoolkit_show_search_form' );
Put this in your child theme’s function file –
ie wp-content/themes/%your-theme-name%/functions.php
where %your-theme-name% is the name of your theme
or use
Code Snippets