Skip to:
Content
Pages
Categories
Search
Top
Bottom

Locking some profiles fields


  • Oazar
    Participant

    @oazar

    Hello,

    I am using BP + x-profiles plugins for an intranet.

    I need to lock some fields of members profiles (but not all), so that the members won’t be able to edit them (only the admin can).

    I did not find a plugin for this, may you help ?

    Thanks

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

  • shanebp
    Moderator

    @shanebp

    This will hide fields on the profile edit page and on the register page.
    You need to add the field IDs.
    Put the function in bp-custom.php.

    function oazar_hide_profile_fields( $retval ) {
    	
    	if( is_super_admin () )
    		return $retval;
    
    	if(  bp_is_profile_edit() || bp_is_register_page() )
    		$retval['exclude_fields'] = '3';	//field ID's separated by comma
    
    	return $retval;
    
    }
    add_filter( 'bp_after_has_profile_parse_args', 'oazar_hide_profile_fields' );

    Oazar
    Participant

    @oazar

    Hello and thanks so much for your help !

    I have a question :

    where is the bp-custom.php file ? Am I supposed to create it ?

    I am not a developper, and not used to bp structure, so can you tell me more precisely where the file is ?

    thanks..


    shanebp
    Moderator

    @shanebp

    Did you follow the link in my answer?


    Oazar
    Participant

    @oazar

    oops ! Soory, i had not realized this was a link..

    thanks for your help Shane,

    I am testing it right now…


    Oazar
    Participant

    @oazar

    hello again Shane,

    well it doesn’t work…

    i created the file, placed it in at the root of the plugin folder, and then aked to exclude one field to begin with, but this won’t work.

    maybe this has to do with “groups” ? i am using the x-profile plugon, and I have 3 groups of fields, so maybe I should also mention the group ID as well as the field ID ?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Locking some profiles fields’ is closed to new replies.
Skip to toolbar