Well, for this, I think you need to edit the templates of your theme. For example in your theme, search /members/members-loop.php file. This file is responsible of showing the members directory.
Here you can edit this file and show other fields if you want with this code:
<?php bp_member_profile_data(array('field' => 'Email')); ?>
bp_member_profile_data is a buddypress function who allow you to access to the profile data of your users. You must send it an array with ‘field’ and the name of the field you want. In this example, I request the field I call “Email”.
In your case if you need to show the field you call “team”:
<?php bp_member_profile_data(array('field' => 'team')); ?>
Or if you want “coach”:
<?php bp_member_profile_data(array('field' => 'coach')); ?>
This code will work only if you are in a loop like this:
<?php while ( bp_members() ) : bp_the_member(); ?>
If you want to show a field for a particular user, you need to send also the user_id :
<?php bp_member_profile_data(array('field' => 'coach', 'user_id' => 'xxx')); ?>
xxx is the user_id.
I´m sorry,
your code didn´t work. This one worked:
bp_member_profile_data( ‘field=Member-Status’ );
But I´m not able to show more than one fields!? I tried:
bp_member_profile_data( ‘field=Member-Status’ );
bp_member_profile_data( ‘field=Pro-Status’ );
and the shown output was
“ProAnwalt” in the same line instead of
“Pro”
“Anwalt”
Pro=Professional
Anwalt=Attorney
And it´s still not displayed in the widget sidebar!?
This code bp_member_profile_data( ‘field=Member-Status’ ); returns the value of the field. If you want to show
“Pro”
“Anwalt”
You need to write:
<?php bp_member_profile_data( ‘field=Member-Status’ ); ?>
<?php bp_member_profile_data( ‘field=Pro-Status’ ); ?>
Or
<p>
<?php bp_member_profile_data( ‘field=Member-Status’ ); ?>
</p>
<p>
<?php bp_member_profile_data( ‘field=Pro-Status’ ); ?>
</p>
The code I give you will only work in members-loop, the file which shows the members directory. If you want to put this in other files, you need to find the file in the theme, for example for the widget.
Remember that this code will only work if you are in a loop like this:
<?php while ( bp_members() ) : bp_the_member(); ?>. If not, you need to send the user_id as an argument.
Sorry I was saying with a br between.:
<?php bp_member_profile_data( 'field=Member-Status' ); ?>
<br/>
<?php bp_member_profile_data( 'field=Pro-Status' ); ?>
I used your code in the members-loop.php. It didn´t work!
/*
* If you want to show specific profile fields here you can,
* but it’ll add an extra query for each member in the loop
* (only one regardless of the number of fields you show):
*
* bp_member_profile_data( ‘field=the field name’ );
*/
It works only like that:
php bp_member_profile_data( ‘field=Member-Status’ );
without the <?php in the beginning and the ………?> at the end
The “
” I´ll tried before! Not working!
sorry, without the “php”:
bp_member_profile_data( ‘field=Member-Status’ );
If you are already in tags <?php ?> you don’t need to write them again. If you are in middle of html code you need <?php and ?>.
This function is php, you need php tags to make it work.