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
Many thanks (again). I’ll use the shortcode to resolve this, as you suggest.
Another SOLVED and CLOSED issue.
ok these are instructions from 12 years ago, and are not applicable for the current version of bbpress.
If you just enable the ‘anyone can register’, then users can register from either the topic/reply forms, or you can use a register page – ie create a page – call it whatever you want and put the shortcode [bbp-register] in it. Then add this page to your menu.
Oh ok. Thanks.
Now I shifted back to [bbp-topic-index]
and limit the number of displayed topics in WordPress dashboard setting>forum. And it finally displays page number.
from memory I have not written that one with pagination as the bbpress one does that for pages where you want lots to show, but does just have 15 as the only option
[bbp-topic-index]
I wrote this code to close the topics (specific forum) after 24h. It’s right?
// Funzione per chiudere automaticamente i topic dopo 24 ore
function chiudi_topic_dopo_24_ore($topic_id) {
// Ottenere la data di creazione del topic
$topic_date = get_post_field(‘post_date’, $topic_id);
// Calcolare la data e l’ora attuali
$current_date = current_time(‘mysql’);
// Calcolare la differenza in ore tra la data di creazione del topic e l’ora attuale
$hours_diff = round((strtotime($current_date) – strtotime($topic_date)) / (60 * 60));
// Se sono passate 24 ore, chiudere il topic
if ($hours_diff >= 24) {
bbp_close_topic($topic_id);
}
}
add_action(‘bbp_new_topic’, ‘chiudi_topic_dopo_24_ore’);
// Funzione per chiudere automaticamente i topic esistenti dopo 24 ore
function chiudi_topic_esistenti_dopo_24_ore() {
// Ottenere tutti i topic del forum specifico
$args = array(
‘post_type’ => bbp_get_topic_post_type(),
‘post_parent’ => ‘YOUR_FORUM_ID’, // l’ID del forum
‘posts_per_page’ => -1,
);
$topics = get_posts($args);
// Chiudere i topic che hanno superato le 24 ore
foreach ($topics as $topic) {
$topic_id = $topic->ID;
chiudi_topic_dopo_24_ore($topic_id);
}
}
add_action(‘init’, ‘chiudi_topic_esistenti_dopo_24_ore’);
bbpress doesnt send any emails… activation emails, forgot password, subscription, etc..
the page bbp-register shortcode has register option which sends an email but since no email is sent no user can register.
The bbp-login shortcode page has a register button. That register button takes you to /wp-login instead of bbp-register
The bbp-register page has a button on the buttom to complete registration. But the button does not have enough padding on the bottom and is cut off on most browsers.
It may well be the address that bbpress is sending from.
this is typically noreply@ and if this email address does not exist then many email hosts will not permit its transit through the system.
either
bbp style pack
once activated go to
dashboard>settings>bbp style pack>Subscription Emails
where you can amend the address and change the wording as well
or
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
add_filter('bbp_get_do_not_reply_address','my_bbp_no_reply_email');
function no_reply_email(){
$email = 'noreply@yourdomain.com'; // any email you want
return $email;
}
and change the address
For anyone with the same problem, this appears to be a bug in BBPress. The script that is meant to fire when someone clicks the “subscribe” button (engagements.js) is only enqueued for the forum and topic post-types. When a forum or topic is embedded on any other post-type, the script is not enqueued, and the button doesn’t do anything.
A quick fix is to add this to your functions.php file, to enqueue the script whenever a forum or topic is embedded via a bbp-single-topic / bbp-single-forum shortcode:
add_filter( ‘do_shortcode_tag’,’subscription_button_fix’,10,3);
function subscription_button_fix($output, $tag){
$arr = array(‘bbp-single-topic’, ‘bbp-single-forum’);
if(!in_array($tag, $arr)){
return $output;
}
bbp_enqueue_script( ‘bbpress-engagements’, ‘js/engagements.js’, array( ‘jquery’ ), true );
wp_localize_script( ‘bbpress-engagements’, ‘bbpEngagementJS’, array(
‘object_id’ => get_the_ID(),
‘bbp_ajaxurl’ => bbp_get_ajax_url(),
‘generic_ajax_error’ => esc_html__( ‘Something went wrong. Refresh your browser and try again.’, ‘bbpress’ ),
) );
return $output;
}
ok, is that from a shortcode, or how are you getting to that page?
Hello Robin,
you are right, it is a theme issue. When I switch to a default theme like twentytwenty, the submit button appears.
Now I edit my style.css file and tryed to get the style for the submit button in it. But I surely make mistakes here.
.button .bbp_user_edit_submit .button .submit .user-submit .bbp_user_edit_submit {
background-color: #4CAF50; /* Green */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
}
This does not let the submit button appears 😉
What else can I do?
Thank you in advance,
Antonio
Hello. I created two forums and wants that theirs topics be presented on two different pages. I added the shortcode [bbp-topic-form forum_id=$forum_id] on both page referencing the forum_id which topics I want present on that page. At page1 I don’t have the problem, but on page2 I see the topics from both forums. The form for entering a new topic on page 2 is ok and regularly sorts topics into forum 2, but the display on the page shows posts from both forums.
Anyone can help? I think I believe that the solution is trivial, but I’ve been stuck with it for several days.
Version of bbPress is 2.6.9 . The project is still on localhost.
thank you
put this in the custom css part of the style pack plugin
#bbpress-forums .status-closed, #bbpress-forums .status-closed a {
background-color: transparent;
}
put this in the style pack custom css or your theme’s custom css
#bbpress-forums .status-closed, #bbpress-forums .status-closed a {
background-color: none !important;
}