Skip to:
Content
Pages
Categories
Search
Top
Bottom

Edit fields in members directory


  • andreasnordengen
    Participant

    @andreasnordengen

    Hello,

    Just wondering how I can change the content (age, gender, city) in members vCard on members loop?
    And also translate it into Norwegian.
    Is there an easy way please?

    Thank you!

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

  • Venutius
    Moderator

    @venutius

    To my knowledge the default bp plugin does not include these fields in the members loop, are these being added by a plugin or did you customise the members loop?


    andreasnordengen
    Participant

    @andreasnordengen

    Well, I asked the developer behind the theme I´m using and got this code:

    function sq7_extra_fields_members_directory() {
     
        $location = bp_get_member_profile_data('field=Location');
        $specialization = bp_get_member_profile_data('field=Specialization');
     
        if ($specialization || $location) {
            echo '<div class="mdetcenter">'. 'Location : ' . $location . '</div>';
            echo '<div class="mdetcenter">'. 'Specialization : ' . $specialization . '</div>';
        }
     
    }
    add_action('bp_directory_members_item', 'sq7_extra_fields_members_directory');

    But, when I add the code and update, I get this message from WordPress:
    Could not communicate back with the site to check for faulty errors, so the PHP change was reset. You must upload your change to the PHP file in another way, for example, with SFTP.

    Could be related to my PHP version…

    It would be better if you added your custom code to bp-custom.php rather than to a theme. (When the theme is updated, you’ll lose your changes.)

    About bp-custom.php: https://codex.buddypress.org/themes/bp-custom-php/

    To insert those fields, you’ll just have to change you code, replacing 'field=Location' with the name of your profile field. Here’s some more info: https://codex.buddypress.org/themes/guides/displaying-extended-profile-fields-on-member-profiles/

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