Skip to:
Content
Pages
Categories
Search
Top
Bottom

Redirect to member pages – wpadminbar

  • @sherry22

    Participant

    Hi, I have added new menu items to the wpadminbar
    -friends for example
    As you can see below ‘http://homeworkinterconnected.com/friends’, is the url for this new menu item but I am not taken to members/friends even when logged in.
    How can I redirect my pages so that when logged in I am directed to my member pages?
    —-

    // Add new menu item

    $args = array(
    ‘id’ => ‘Friends’,
    ‘title’ => ‘Friends’,
    ‘href’ => ‘http://homeworkinterconnected.com/friends’,

    ‘meta’ => array(
    ‘class’ => ‘wpbeginner-guides’,
    ‘title’ => ‘Friends’
    )
    );
    $wp_admin_bar->add_node($args);

Viewing 1 replies (of 1 total)
  • @danbp

    Participant

    You have to build a correct url !

    Give this snippet a try: (add to child theme’s functions.php or bp-custom.php)

    /* add a menu item to WP Toolbar */
    
    function olala() {
    	
    global $wp_admin_bar;
       /* check if user is logged in and if friend component is activated */
    	if ( is_user_logged_in() || bp_is_active( 'friends' ) ) :
      
       /* building the slug */
    		$href = bp_loggedin_user_domain() . '/' . bp_get_friends_slug() . '/';
    	endif;
    
       /* building the menu	*/
    	$wp_admin_bar->add_node( array(
    	'id' => 'myfriends',
    	'title' =>  'Friends',
    	'href' => $href
    	));	
    	
    }
    add_action( 'admin_bar_menu', 'olala', 100 );
Viewing 1 replies (of 1 total)
  • The topic ‘Redirect to member pages – wpadminbar’ is closed to new replies.
Skip to toolbar