• I want to give a user access to perform only a limited activity in my backend…

    That is, to update fellow users’ categories and tags.

    I don’t yet have a users taxonomy set up, but intend to.

    When I do, how could I give a user the right to go in to a user profile, and update only the categories and tags applied to that use?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    Taxonomies are applied to posts, not users, so I’m not sure what you’re really trying to do. A taxonomy associated with a post type can have any term that is defined applied to any post of that type by any user who is allowed to edit that post type. Terms can be added, changed, or deleted by anyone allowed to manage that taxonomy.

    Capabilities are typically assigned to roles, and the user has the capabilities assigned to the role of which they are assigned. You can also assign individual capabilities directly to users outside of whatever role they have.

    None of these actions require access to the user’s profile. What is required is a user has the appropriate capability to do a particular action. This can be done by code, or there are plugins available that make it easy to manage user capabilities. Of course one needs to already have the capability to edit users to assign capabilities to others, or edit roles to assign capabilities to roles.

    Thread Starter parakeet

    (@parakeet)

    @bcworkz

    If we ignore the applicability of taxonomies to users (which I think can be overcome) for now, the question becomes: can I give a user only rights to edit the taxonomy of an asset (ie post, ie user)? ie they should not be able to edit user meta data.

    Thanks

    Moderator bcworkz

    (@bcworkz)

    Well, user meta is entirely different than taxonomies. If you mean user meta in the more general sense where user related data is somehow managed through taxonomies, then the default taxonomies require manage_terms capabilities. However, with custom taxonomies, you can specify special capability names for various actions when the taxonomy is defined. Then you can selectively assign such capabilities to roles or users.

    User meta as it pertains to WP, is specifically user related data that is stored in the usermeta table. By default, there is no way to add more user meta through the admin screens. Any additional meta would need to be managed through custom code, which of course could include any sort of custom capabilities you might conceive of.

    I would suggest you abandon trying to use the built in post taxonomies for users and create a similar system using using usermeta to store the information. It doesn’t need to be as elaborate as post taxonomies, perhaps simply storing an array of assigned user tags in postmeta will suffice. Only those with some custom capability would be able to edit these.

    If you will be needing to do user queries based on these assigned tags, you should store the tags under individual keys instead of in an array. User meta queries restricted by array content are problematic to set up.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Only allow editing of user taxonomies?’ is closed to new replies.