Forum Replies Created
-
In reply to: Get xprofile field value in functions.php
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’);
}
}In reply to: Get xprofile field value in functions.phpno sorry, it returns the right number
In reply to: Get xprofile field value in functions.phpbp_loggedin_user_id() returns 0
In reply to: Get xprofile field value in functions.phpIt’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'); } }In reply to: Get xprofile field value in functions.phpHi,
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