Skip to:
Content
Pages
Categories
Search
Top
Bottom

BP – xprofile_get_field_data()


  • sdls
    Member

    @simon_said

    Hello! Working on some new theming strategies for BP 1.5 and I was wondering what the correct way of referencing specific meta_data for use in a custom template:

    xprofile_get_field_data();

    seems to be the right way to go, but I can’t seem to get it to work.

    `
    $user_id = bp_loggedin_user_id(); //current logged in user
    $field = ’19’; // the ID of the field referenced in table wp_bp_xprofile_fields
    $major = xprofile_get_field_data( $field, $user_id );
    `
    This doesn’t quite seem to be working any suggestions would be greatly appreciated!

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

  • sdls
    Member

    @simon_said

    answer me this one oh BP gurus and I promise never to but you about xprofile_get_field_data() again! ;-)

    It should work assuming that 1) There is indeed a field with id=19 and 2) That $user_id is a valid user and 3) That $user_id has set a value for field_id=19 in their profile data (i.e. they’ve completed the field).


    Boone Gorges
    Keymaster

    @boonebgorges

    So what happens when you do
    `var_dump( $major );`
    after all of this? Does it show up as `false`, or undefined? If false, the problem is that the user has not filled in the data (or the field doesn’t exist). If undefined, then there is a more significant problem.

    You might check your database table wp_bp_profile_data to make sure that there is indeed a row corresponding to the logged in user id and field 19.


    sdls
    Member

    @simon_said

    Must have been a database caching problem…. damn internet gremlins!
    That first snippet worked as is with no changes…. just took 30 minutes to refresh
    Thanks for your feedback both.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘BP – xprofile_get_field_data()’ is closed to new replies.
Skip to toolbar