Skip to:
Content
Pages
Categories
Search
Top
Bottom

All members link on Member Profile


  • logichub
    Participant

    @logichub

    Is it possible to place a link at the end of the menu on User Profile page? Currently these are present as menu items:

    Activity, Profile, Notifications, Forums, Settings

    I want to place a link to (All Members page) after the Setting menu item.

    I used following code snippet in my functions.php file:

    function lh_custom_setup_nav() {
    	global $bp;
    	bp_core_new_nav_item ( array (
    		'name'				=> __( 'All Members', 'buddypress' ),
    		'slug'				=> 'members',
    		'position'			=> 150,
    		'screen_function'	=> 'bp_members_screen_index',
    	) );
    }
    add_action( 'bp_setup_nav', 'lh_custom_setup_nav' );
    

    It generates this link /members/USERNAME/members/, whereas I need a link to /members/ page.

Viewing 1 replies (of 1 total)

  • danbp
    Participant

    @danbp

    You can’t use that function for this contextual menu.

    Use the action hook coming after bp_user_displayed_nav function: bp_member_option_nav to simply add html and your link.

    Try this (add to bp-custom.php or child theme functions.php)

    function lh_custom_setup_nav() {
      if ( bp_is_active( 'xprofile' ) )
    ?>
    <li><a href="<?php bp_members_directory_permalink(); ?>"><?php printf( __( 'All Members', 'buddypress' ) ); ?></a></li>
    <?php  
    }
    add_action( 'bp_member_options_nav', 'lh_custom_setup_nav' );

    Apply CSS to li and a tags accordingly to your theme if necessary.

    Reference file: bp-templates/bp-legacy/buddypress/members/single/home.php

Viewing 1 replies (of 1 total)
  • The topic ‘All members link on Member Profile’ is closed to new replies.
Skip to toolbar