BuddyDev

Search

Replies

  • Participant
    Level: Initiated
    Posts: 3
    sheryanne on #11395

    I’m ok, nevermind. I found a snippet on the buddypress forums that will hide the profile field from the user’s edit screen but it still appears on their profile page. I added it to bp-custom.php and it’s working. I am only using the first part that says “remove field from edit tab”. Here’s the code – maybe you can include it on a future update?

    function bpfr_hide_profile_edit( $retval ) {
    // remove field from edit tab
    if( bp_is_profile_edit() ) {
    $retval[‘exclude_fields’] = ‘2’; // field ID’s separated by comma
    }
    // allow field on register page
    if ( bp_is_register_page() ) {
    $retval[‘include_fields’] = ‘2’; // field ID’s separated by comma
    }

    // hide the field on profile view tab
    if ( $data = bp_get_profile_field_data( ‘field=2’ ) ) :
    $retval[‘exclude_fields’] = ‘2’; // field ID’s separated by comma
    endif;

    return $retval;
    }
    add_filter( ‘bp_after_has_profile_parse_args’, ‘bpfr_hide_profile_edit’ );

  • Participant
    Level: Initiated
    Posts: 3
    sheryanne on #11333

    Hi there! Thank you for responding. I had hopes for the plugin you suggested, but it hides the field from front-end view. I would like the field to be visible, just not editable by the user.

    (If it helps to know how we are using this… this is for a homeowner’s association. One Profile Field is radio button selection to show the Membership Type, we want to show what kind of member the person is. But this should not be chosen by the user, only the Admin can make the selection. The selections are… Non-Voting Member, Voting Member, Board Member, President, Vice President, etc.. and these positions change all the time. When someone registers, we want “Non-Voting Member” to be the default choice that displays on the front-end until it’s time to promote the person.)

    Right now the default is chosen, but the user is allowed to change it one time. And the field will not appear on the profile until the user “saves” first. Is it possible to have the field appear in the profile immediately when the user logs in for the first time and then cannot be changed by the user, only the Admin? Would it help to give you access?

    Thanks again 🙂

  • Participant
    Level: Initiated
    Posts: 3
    sheryanne on #5185

    Thank you Brajesh! I changed the line and it worked perfectly. You are awesome!