Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Access xProfile field data in a custom page


  • dzturtleshell
    Participant

    @dzturtleshell

    I’m creating a custom page that shows all members of a specific group.
    I need to make a box for each member that includes their avatar, name, and the data from one of the custom xProfile fields I’ve created for the community.

    I used the group_members loop and I have the avatar and name working.

    ‘<?php if ( bp_group_has_members(‘group_id=1’) ) : ?>
    <ul id=”member-list” class=”item-list”>
    <?php while ( bp_group_members() ) : bp_group_the_member(); ?>

  • <?php bp_group_member_avatar_mini($width = 50, $height = 50) ?>
    <?php bp_group_member_link() ?>
  • <?php endwhile; ?>

    <?php else: ?>
    <div id=”message” class=”info”>
    <p>Something went wrong!</p>
    </div>
    <?php endif;?>’

    I don’t know how to access the xProfile field I want so I can add it to the loop. I know the profile group_id=1 and the profile field_id=9, but I can’t find anywhere how the profile field_id is linked to a members user_id, so I can’t figure out how to add it to the group_members loop. I think it should look something like this:

    ‘<?php
    function bp_group_member_location() {
    echo bp_get_group_member_location();
    }

    function bp_get_group_member_location() {
    global $members_template;
    // Write code here to return the value of profile group_id=1&field_id=9 for member
    }
    ?>’

    But I don’t know if I should even be looking for the custom profile fields data in the $member_template (which I can’t actually find to see what it does contain)

    Any advice or suggestions would be greatly appreciated, even if it’s just to let me know I’m completely off… I am a beginner and this is my first post here. Please comment if you need more info to be able to answer my question. (I am using BP 2.7.2 and WP 4.6.something)

    Thanks in advance!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Access xProfile field data in a custom page’ is closed to new replies.
Skip to toolbar