in wordpress 4.0 with buddypress how do I add a profile field that can only be changed by administrators

I am running a club-based wordpress application.
In it has buddypress installed into it.

What I want to do, is add a profile field whose value can only be set by the administrator of the site. I know how to add a custom field, but the default behavior is to allow the user to set it. I don’t want that.

Read More

Can this be done, and if so, how?
Thank you.

Related posts

Leave a Reply

2 comments

  1. Create a template overload of this file:
    buddypressbp-templatesbp-legacybuddypressmemberssingleprofileedit.php

    Untested, but try changing this:

    $field_type = bp_xprofile_create_field_type( bp_get_the_profile_field_type() );
    $field_type->edit_field_html();
    

    To this:

    $name = bp_get_the_profile_field_name();
    
    if( $name == 'name of your field' ) {
    
       if( is_super_admin() ) {
          $field_type = bp_xprofile_create_field_type( bp_get_the_profile_field_type() );
          $field_type->edit_field_html();
       }
       else 
        echo $name . '<br/>' . bp_get_the_profile_field_value();
    
    }
    else {
        $field_type = bp_xprofile_create_field_type( bp_get_the_profile_field_type() );
        $field_type->edit_field_html();
    }