Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author HelgaTheViking

    (@helgatheviking)

    See the FAQ… particularly the section on creating a new “role”. Sample code for adding the role title to the checkbox options and then the other code for handling the menu item’s visibility. You will need to adapt that to your user fields.

    Thread Starter Nytspil

    (@nytspil)

    Thanks for quick response!

    Im not the best at coding at doing custom work.

    But is this what i have to do:

    function kia_new_roles( $roles ){
    $roles[xprofile_get_field_data(‘3’)->BATMAN] = ‘BATMAN’;
    return $roles;
    }
    add_filter( ‘nav_menu_roles’, ‘kia_new_roles’ );

    Plugin Author HelgaTheViking

    (@helgatheviking)

    It’s just an array key and not an object or whatever the heck your xprofile_get_field_data code is doing.

    function kia_new_roles( $roles ){
    	$roles['batman'] = 'BATMAN';
    	return $roles;
    }
    add_filter( 'nav_menu_roles', 'kia_new_roles' );
    Thread Starter Nytspil

    (@nytspil)

    The xprofile_get_field_data is what i thought, was to pull out the data inside and then use “->” as validation.

    I just want, to show the Menu link. If the user has the fied_3 (buddypress) set to Batman.

    Thread Starter Nytspil

    (@nytspil)

    Hello thank you for your support.

    Figured it out my self, by your FAQ ??
    Thanks.

    Plugin Author HelgaTheViking

    (@helgatheviking)

    The first function in the “add role” section is to add the role to the options. And the second function is to handle the visibility. I’m glad you figured it out.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘If meta data’ is closed to new replies.