Skip to:
Content
Pages
Categories
Search
Top
Bottom

Profile fields to appear in directory


  • sostenibles
    Participant

    @sostenibles

    Hi all!

    I’m building my new site (www.sostenibl.es) using WordPress v.4.8.2 and Buddypress v.2.9.1

    Currently, the members directory displays members’ names and last activity. But I want some profile fields to appear in the BP directory page instead.

    I’ve found a proposed solution in the forum, but it’s not working, and I do not know what I am doing wrong –needless to say that I have no coding experience whatsoever!

    Following other entries in this forum, I was trying to modify the members-loop.php located at bp-templates/bp-legacy. I found the section “if you want to show specific profile fields….”, and added the line: bp_member_profile_data( ‘field=la-empresa’ ).
    However is not working.

    I tried making changes to members-loop.php located at bp-themes/bp-default, just in case 🙂 ; but did not work either.

    I also tried this: <?php bp_member_profile_data(array(‘field’ => ‘la-empresa’)); ?>
    No results 🙁

    I tried also to use the field id instead of the field name. But it’s not working either.
    I am confused with the field name thing, and I am at a point where I don’t know where to find the field name unless it’s the name that I gave to the field (field name I gave has spaces e.g “la empresa”)

    I am really lost and do not how to get this to work. Please help!!

    Thanks in advance!

Viewing 2 replies - 1 through 2 (of 2 total)

  • shanebp
    Moderator

    @shanebp

    Please use the code button when sharing code.

    This is the relevant file:
    \buddypress\bp-templates\bp-legacy\buddypress\members\members-loop.php

    Some themes bundle their own version of BP files.

    To find out if you’re in the correct file, try:

    echo 'testing...<br>';
    $test = bp_get_member_profile_data( 'field=la-empresa' );
    var_dump( $test );

    If you don’t see ‘testing…’, you’re in the wrong file.
    If you do, but don’t see the profile data, then there is an issue with that field or perhaps the value does not exist.


    sostenibles
    Participant

    @sostenibles

    @shanebp Thank you very much for your reply.
    I got the correct file and issue is solved.
    Problem was because fields indicated in the code have to be exact to the field name, and that includes both spaces and accents.
    I am displaying more than one field now, and code looks like this (see the accents and spaces!):

    <?php bp_member_profile_data( ‘field=Área de negocio’ ); ?>
    <br>
    <?php bp_member_profile_data( ‘field=Comunidad Autónoma’); ?>
    <br>
    <?php bp_member_profile_data( ‘field=La empresa’); ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar