Search code examples
wordpressbuddypressbbpress

Use Buddypress custom fields in bbpress


I want to use the Buddypress (standard) custom fields under the avatar of the topic pages of the bbpress forum (loop-single-reply.php). The code below works perfect with the membersloop (members-loop.php) in Buddypress pages but does not work within the bbpress forum pages. Any idea?

<?php bp_profile_field_data( array('field' => 2, 'user_id' => bp_get_member_user_id() ) ); ?>

Solution

  • Found it myself... I needed to call bbp_get_reply_author_id() and not bp_get_member_user_id()

    <?php  $user_role = bp_profile_field_data( array('field' => 4, 'user_id' => bbp_get_reply_author_id() ) );
        echo $user_role; ?>