• Resolved golfball-uhu

    (@golfball-uhu)


    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/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Miguel López

    (@atallos)

    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.

    Thread Starter golfball-uhu

    (@golfball-uhu)

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

    Plugin Author Miguel López

    (@atallos)

    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.

    Plugin Author Miguel López

    (@atallos)

    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' ); ?>
    Thread Starter golfball-uhu

    (@golfball-uhu)

    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!

    Thread Starter golfball-uhu

    (@golfball-uhu)

    sorry, without the “php”:

    bp_member_profile_data( ‘field=Member-Status’ );

    Plugin Author Miguel López

    (@atallos)

    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.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘display profile fields in the members directory (all members)’ is closed to new replies.