Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to Get User Profile Data

  • Avatar of enailor
    enailor
    Participant

    @enailor

    During a recent project, I needed to get certain User Profile Data to be used. This was used outside any loops and not on the Profile page. Hopefully this will help others seeking the same information.

    To obtain the default data (such as User ID, User Login, ect) use the following:
    `global $bp;
    $the_user_id = $bp->loggedin_user->userdata->ID;
    $the_user_login = $bp->loggedin_user->userdata->user_login;`

    Userdata values include:
    ID
    user_login
    user_pass (this is encrypted MD5 Hash)
    user_nicename
    user_email
    user_url
    user_registered
    user_activation_key
    user_status
    display_name

    To get field data from extended profile fields for the current logged in user, use the following:
    `$the_first_name = bp_get_profile_field_data(‘field=First Name&user_id=’.bp_loggedin_user_id());
    /* Change field name to the one you added to the profile, or if you know the field’s #, you can use that instead. */
    `

    I do hope this helps someone else. It drove me nuts trying to track down the info, but after piecing bits of information together, I was able to get this figured out.
    Have fun!
    Ed

Viewing 1 replies (of 1 total)
  • Avatar of N3k0
    N3k0
    Participant

    @n3k0

    Excelent… thats works fine, is i was looking for :D thansk a lot… online a cuestion, how i can display correctly date fields @enailor ???

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.