bbp style pack
lets you add an ‘edit profile’ to the menu see
dashboard>settings>bbp style pack>login
and also has a shortcode that you can put into a text widget in the sidebar
[bsp-profile’ label=’Edit Profile’ edit=’y’]
see
dashboard>settings>bbp style pack>shortcodes
For some reason, this plugin killed my site :_(
==========
An error of type E_ERROR was caused in line 68 of the file /home/xxxx/public_html/wp-content/plugins/bbp-style-pack/bbp-style-pack.php. Error message: Uncaught Error: Call to undefined function bbp_get_version() in /home/xxxx/public_html/wp-content/plugins/bbp-style-pack/bbp-style-pack.php:68
do you have bbpress activated ?
Yes very much. In fact, the login widget is bb Press 🙁
Hmmm, something might be wrong with my bbPress. I need to investigate.
hmmm, that function only fires when all plugins are loaded, suggest you try activating it again
I installed it on another WP site and it didn’t crash so it seems my sandbox is broken. Sorry about that.
I was not able to find the way to what I am looking for, that is, to have Subscriber’s toolbar links of Edit Profile and Dashboard to the same page, /forums/users/{username} that the bbPress login widget gives. Can this plugin do it?
no, I recommend that generally you should disable toolbar for all but admins, plenty of plugins do that.
Understood. Altho visitors love their avatar shows up at the top.
Now I need to hide Edit Profile menu item to all other than Subscriber but can’t find the way. Is there a way?
This code will change the WordPress profile to bbpress profile
add_action('wp_before_admin_bar_render', 'rew_admin_bar_remove_wp_profile', 0);
function rew_admin_bar_remove_wp_profile() {
global $wp_admin_bar;
/* **edit-profile is the ID** */
$wp_admin_bar->remove_menu('edit-profile');
}
add_action('admin_bar_menu', 'rew_add_bbp_profile', 999);
function rew_add_bbp_profile($wp_admin_bar) {
$current_user = wp_get_current_user();
$user=$current_user->user_nicename ;
$user_slug = get_option( '_bbp_user_slug' ) ;
if (get_option( '_bbp_include_root' ) == true ) {
$forum_slug = get_option( '_bbp_root_slug' ) ;
$slug = $forum_slug.'/'.$user_slug.'/' ;
}
else {
$slug=$user_slug . '/' ;
}
$profilelink = '/' .$slug. $user . '/edit' ;
$wp_admin_bar->add_node( array(
'parent' => 'user-actions',
'id' => 'bbp-edit-profile',
'title' => 'Edit Profile',
'href' => $profilelink,
) );
}
Put this in your child theme’s function file – or use
Code Snippets
Thank you so so so much! This code is working great. Just one last thing. How can I make this code run only when the user role is Subscriber? -Hiro
do you really mean WordPress role subscriber or bbpress role participant ?
I always get confused about the relationship since WP and bbP are SSO 🙁
The new public registration is always WP Subscriber, who is subscribed to bbP Announcement forum by bbP Toolkit. This is the only user role that needs to go to bbP edit-profile page. The other role in use is the Contributor which should jump to wp-admin/profile.php instead of bbP edit-profile. I hope this is somewhat clearer.
untested but try
if ( current_user_can( 'subscriber' ) ) {
add_action('wp_before_admin_bar_render', 'rew_admin_bar_remove_wp_profile', 0);
add_action('admin_bar_menu', 'rew_add_bbp_profile', 999);
}
function rew_admin_bar_remove_wp_profile() {
global $wp_admin_bar;
/* **edit-profile is the ID** */
$wp_admin_bar->remove_menu('edit-profile');
}
function rew_add_bbp_profile($wp_admin_bar) {
$current_user = wp_get_current_user();
$user=$current_user->user_nicename ;
$user_slug = get_option( '_bbp_user_slug' ) ;
if (get_option( '_bbp_include_root' ) == true ) {
$forum_slug = get_option( '_bbp_root_slug' ) ;
$slug = $forum_slug.'/'.$user_slug.'/' ;
}
else {
$slug=$user_slug . '/' ;
}
$profilelink = '/' .$slug. $user . '/edit' ;
$wp_admin_bar->add_node( array(
'parent' => 'user-actions',
'id' => 'bbp-edit-profile',
'title' => 'Edit Profile',
'href' => $profilelink,
) );
}
Worked like a charm! Thank you so so so much! I am in a happy place!
great – glad to have helped.