Skip to:
Content
Pages
Categories
Search
Top
Bottom

bp_the_member() in admin-ajax


  • Darren Cooney
    Participant

    @dcooney

    When loading a list of users via admin-ajax.php I am not able to access bp_the_member() because it is no longer in the the member loop.

    Is there anyway to pass the current user ID to bp_the_member() or is there an alternative function I can use to set up member data outside of the loop?

    thanks,

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

  • shanebp
    Moderator

    @shanebp

    Why is it no longer in the loop?

    How are you gathering your list of users?
    Have you tried, in your ajax function, using BP_User_Query ? You can then use a loop and bp_the_member() will work.

    Otherwise, you can use this is get each separate piece of a user’s profile data:
    xprofile_get_field_data( $field, $user_id = 0, $multi_format = 'array' )

    To get all the profile data at once, if you have the email address you could use bp_xprofile_personal_data_exporter( $email_address )

    Or if you only have the user_id, you could use: BP_XProfile_ProfileData::get_all_for_user( $user_id )


    Darren Cooney
    Participant

    @dcooney

    Thanks for the reply.
    They are not in the loop because I’m using a plugin, Ajax Load More to render users and it creates it’s own loop using the WP_User_Query not buddypress methods.

    Appreciate the direction to the BP_XProfile_ProfileData method. I’ll check this out.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar