Quantcast
Channel: bbPress.org » All Posts
Viewing all articles
Browse latest Browse all 3638

Reply To: Opening Subscriber’s profile editor from toolbar

$
0
0

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,
			) );

}

Viewing all articles
Browse latest Browse all 3638

Trending Articles