Hi,
In place of current_user_can(‘moderate’) please use bb_current_user_can(‘moderate’)
Thanks
I replaced current_user_can(‘moderate’) to bb_current_user_can(‘moderate’), but nothing works and gives error on my forum page
Hi,
Please go with current_user_can. I found that in a link on bbpress I think but that function is no more there.
Hi,
I used “current_user_can” function, but Forum form is not displaying for moderators.
Hi,
Please use this code:
add_action('bbp_template_after_user_details', 'ps_show_forum_form');
function ps_show_forum_form(){
if(bbp_is_user_home() && current_user_can('moderate')){
echo do_shortcode('[bbp-forum-form]');
}
}
It will echo a form on the profile itself.
Thanks
Hi,
I used the above code as you said. But the same, nothing is showing up
Ok, got it now.
The above code will show the forum form on bbpress user profile, not BuddyPress.
Please try this code:
add_action('bbp_template_after_user_topics_created', 'ps_show_forum_form');
function ps_show_forum_form(){
if(bbp_is_user_home() && current_user_can('moderate')){
echo do_shortcode('[bbp-forum-form]');
}
}
Thanks
Thanks Parshant, finally something is worked. Above code works and shows under Topics Started tab.
Is there any way to show Forum Form as tab like Topic started and other tabs?
Hi,
Please replace the previous code with this code if you want a tab and not the previous one:
function ps_profile_forum_creation() {
if(current_user_can('moderate')){
global $bp;
bp_core_new_subnav_item( array(
'name' => 'Create Forum',
'slug' => 'create-forum',
'screen_function' => 'ps_create_forum_screen',
'position' => 200,
'parent_url' => bp_loggedin_user_domain() . '/forums/',
'parent_slug' => 'forums',
'default_subnav_slug' => 'create-forum'
) );
}
}
add_action( 'bp_setup_nav', 'ps_profile_forum_creation' );
function ps_create_forum_screen() {
add_action( 'bp_template_content', 'ps_create_forum_screen_content' );
bp_core_load_template( 'buddypress/members/single/plugins' );
}
function ps_create_forum_screen_content() {
echo do_shortcode('[bbp-forum-form]');
}
Hopefully, it will help you.
Thanks
Glad to know that it helped you 🙂
@prashantvatsh thank you for this. My case is a little different. I want to a tab in the buddypress profile menu that shows all the site-wide forums where members can click and add topics or replies. They wont be able to create forum. Basically, I just need what I see in “homepage/forums” to be replicated in homepage/members/username/forums.
Thanks in advance
Thank you so much for your useful helping code.
Wow sounds good!! What file do i have to place?
Greetz Edwin from Holland