WordPress.org

Ready to get started?Download WordPress

Forums

Buddypress Xprofile Custom Fields Type
[resolved] display profile fields in the members directory (all members) (8 posts)

  1. golfball-uhu
    Member
    Posted 1 year ago #

    hi,
    I donwloaded your plugin and like it. I can create many usefull profile fields which are shown in the public members profile, if I click on it.

    I want to build up a business-network and me and my members want to know with whom to dealing with on the first view.

    For Example "team", "coach", "member".....! I can create this profile fields but they are not shown in the members directory (all members) and in the members widget area-it´s only displayd in the public members profile (if I click into it).

    Any solution for me?

    Thanx

    http://wordpress.org/extend/plugins/buddypress-xprofile-custom-fields-type/

  2. donmik
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  3. golfball-uhu
    Member
    Posted 1 year ago #

    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!?

  4. donmik
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  5. donmik
    Member
    Plugin Author

    Posted 1 year ago #

    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' ); ?>
  6. golfball-uhu
    Member
    Posted 1 year ago #

    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!

  7. golfball-uhu
    Member
    Posted 1 year ago #

    sorry, without the "php":

    bp_member_profile_data( 'field=Member-Status' );

  8. donmik
    Member
    Plugin Author

    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.