Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)

  • vince_
    Participant

    @vince_

    I’ve got it … It wasn’t in the right order … I feel stupid

    add_action( ‘init’, ‘my_em_setup_nav’ );

    function my_em_setup_nav(){
    global $bp;
    $args = array(
    ‘field’ => ‘Role’,
    ‘user_id’ => bp_loggedin_user_id()
    );
    $role = bp_get_profile_field_data($args);
    if( $role == “Role1” ){
    bp_core_remove_subnav_item(‘events’,’my-events’);
    bp_core_remove_subnav_item(‘events’,’my-locations’);
    bp_core_remove_subnav_item(‘events’,’my-bookings’);
    }
    }


    vince_
    Participant

    @vince_

    no sorry, it returns the right number


    vince_
    Participant

    @vince_

    bp_loggedin_user_id() returns 0


    vince_
    Participant

    @vince_

    It’s not working, here is my entire code (without the “if” condition it’s working) :

    $args = array(
    		'field'   => 'Role',
    		'user_id' => bp_loggedin_user_id()
    	);
    	
    	$role = bp_get_profile_field_data($args);
    	add_action( 'init', 'my_em_setup_nav' );
    	
    	function my_em_setup_nav(){
    		global $bp;	
    		if( $role == "Role1" ){
    			bp_core_remove_subnav_item('events','my-events');
    			bp_core_remove_subnav_item('events','my-locations');
    			bp_core_remove_subnav_item('events','my-bookings');
    		}	
    	}

    vince_
    Participant

    @vince_

    Hi,

    No, it’s not working. My 2 other techniques work in other pages but not in functions.php.
    Does this file have something special ?

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
Skip to toolbar