Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Restrict Certain Profile Fields to user AND certain role types.


  • paton400
    Participant

    @paton400

    Hey guys,

    I would like to create a field group where the field information is only visible to that particular user, administrator and a custom role (managers).

    As this will contain personal financial information, I don’t want any other site members seeing it. But it’s important that my selected user roles and individual user see it.

    Any ideas?

    Regards

Viewing 1 replies (of 1 total)

  • Henry Wright
    Moderator

    @henrywright

    Check out Roles and Capabilities. If your admin and custom roles share a common capability then you can distinguish these roles from the rest of the roles that don’t have that capability.

    See
    current_user_can() and user_can()

    You would use them like this:

    if ( current_user_can( 'manage_options' ) ) {
        // The current user can manage options so do something special.
    }
    if ( user_can( $user_id, 'manage_options' ) ) {
        // The specified user can manage options so do something special.
    }
Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Restrict Certain Profile Fields to user AND certain role types.’ is closed to new replies.
Skip to toolbar