• Hi Andrea,
    I would like to define which gender should see which information in the profile data.
    For that purpose I use the Conditional Profile Fields plugin and have added the code:add_filter( ‘bp_is_conditional_profile_field_active’, ‘__return_true’ );
    and set the Visibility Condition to one gender only in two different profile fields, man and woman.
    I then added this code with the profile Fields:

    $field_content = bp_get_member_profile_data( ‘field=man’ );
    if( $field_content != false )
    echo “man ” . $field_content;
    $field_content = bp_get_member_profile_data( ‘field=woman’ );
    if( $field_content != false )
    echo “woman ” . $field_content;

    My intention was to put up one condition for each gender, but the data are shown to both genders?

    Regards
    Carsten

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Carsten Lund

    (@carsten-lund)

    Hi Andrea, I am not sure if I address this topic the right place because I can’t figure out whether the “BP Profile Search” plugin also covers the Users> Profile Fields?

    A lot of code snippets are out there for showing Profile fields in the members profile directory. Which one would you recommend to use with BP Profile Search?

    I came across this code from BuddyDev but when adding a visual condition using the Conditional Profile Fields plugin (from BuddyDev) the field does not show in profile. Add Xprofile fields to the members directory
    https://buddydev.com/snippets/page/2/

    Here are the Functions I put in:

    add_action( ‘bp_directory_members_item’, ‘add_info_to_members_loop’ );

    add_filter (‘bp_xprofile_is_richtext_enabled_for_field’, ‘__return_false’);

    add_filter( ‘bp_is_conditional_profile_field_active’, ‘__return_true’ );
    ?>

    regards
    Carsten

    Plugin Author Andrea Tarantini

    (@dontdream)

    Hi Carsten,

    The Users -> Profile Fields is a BuddyPress function, while BP Profile Search settings are in Users -> Profile Search.

    Search results use the existing Members directory, so you can modify the Members directory to suit your needs and the search results will be displayed accordingly. If a change works for the Members directory, it should work for the search results as well.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Using Conditional Profile Fields with BP Profile Search’ is closed to new replies.