Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Buddypress – Restrict xprofile field to read-only


  • agtd
    Participant

    @agtd

    Hi,

    I have searched the forums but have not foudn what I am looking for. How can I change one of the xtended profile field to be read-only for the user but write for admin?

    Thanks

    Tom

Viewing 3 replies - 1 through 3 (of 3 total)
  • You’ll need to do something like identify the field in question i.e a check to see if that field is being displayed in the edit loop and then wrap it in a user capability check for admin only, but you’ll need a little php knowledge to do this.


    agtd
    Participant

    @agtd

    Hi Hugo,

    Thanks for the reply. Understand what I need to do, but my PHP skills are still a work in progress. Do you have links to any samples and I will try to put somethign together.

    Thanks
    Tom


    agtd
    Participant

    @agtd

    Finally sorted something out.

    ==========================================================================
    Add the following to your edit.php file:
    `

    <?php if(bp_get_current_profile_group_id()==2):?> //change this to the group id you want to restrict

    These field have been locked by the Administrator. //or whatever you want to say
    `
    ==========================================================================
    Fix this line to include the “<?php" before the if like so:
    `<?php if ( bp_has_profile( 'profile_group_id=' . bp_get_current_profile_group_id() ) ) :`

    ==========================================================================
    insert this to the second last line:

    ==========================================================================

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Buddypress – Restrict xprofile field to read-only’ is closed to new replies.
Skip to toolbar