0

Each user can have one or many locations. I need each user to be able to edit their own locations, or at least some of the values within their locations. The location pod is related to users (extended). I can think of several ways to do this painstakingly through PHP but I’m thinking there’s got to be a way to do this nicely with pods and maybe another plugin that plays nicely. Anybody know of one?

UPDATE: Here's an example to make it a little more clear:

User johndoe can only update locations:

  • Detroit
  • Chicago
  • Cleveland

User janedoe can only update locations:

  • San Francisco
  • Los Angelas
  • San Diego

So I don't just need to make it possible for users to update locations. I need them to be able to update SPECIFIC locations only.

closed as off-topic by Nathan Johnson, Krzysiek Dróżdż, Jacob Peattie, bosco, Fayaz May 21 '18 at 4:02

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

1

You can use map_meta_cap() to set more specific capabilities for your CPT. So instead of using the built-in edit_posts and edit_others_posts capabilities you would create edit_locations and edit_others_locations - thus allowing a new custom role to edit their own locations, but not edit_others_locations. You may find this related question helpful: Using Custom Meta Capabilities on Custom Post Type

  • I'm not building these post types from scratch. I'm using Pods to create them. Is there a way to make this work with Pods? – dovidev Apr 19 '18 at 20:46
  • I'm not familiar with Pods. Are they part of some type of framework or plugin? – WebElaine Apr 19 '18 at 21:35
  • Yes. wordpress.org/plugins/pods It's a plugin to quickly and easily create custom post types. – dovidev Apr 19 '18 at 21:41
  • Okay. I think I've figured out how to tie in the capabilities but not how to set them using an attribute value yet. – dovidev Apr 19 '18 at 21:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.