Skip to:
Content
Pages
Categories
Search
Top
Bottom

how to use xprofile data site wide?


  • GooseNL
    Member

    @goosenl

    Hi Guys,

    I am pretty new to php so perhaps one of you can help me out?

    I’m trying to display custom profile fields site-wide.

    I have added the following code to functions.php:
    `
    function get_user_type( $user_id ) {
    global $bp;
    $user_id = $bp->loggedin_user->user_id;
    $isMember = xprofile_get_field_data( ‘Type’, $user_id );
    return $isMember;
    }
    `
    and the following to sidebar.php “eventually I want to add it to the bp-groups index.php, but the sidebar makes a nice site-wide test” :
    `
    global $bp;
    $user_id = $bp->loggedin_user->user_id;
    echo get_user_type( $user_id )
    `

    Thus far the sidebar only displays data on the profile page. Is this because I am using xprofile_get_field_data? And what should I do to use it sitewide?

    Thanks in advance! GooseNL

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘how to use xprofile data site wide?’ is closed to new replies.
Skip to toolbar