I am looking to do the following:
- All contributors select a school in a custom user profile meta field
- All contributors also select a club in a custom user profile meta field
- Editors also select a school and a club (same profile fields as above)
Goal: The editor (user role) that has School A and Club B stored as custom user values can view/edit/publish posts made ONLY by contributors (user role) who also have School A and Club B stored as custom user values.
All contributors should only be able to read/view their articles and media. (I currently am able to do that with this)
Based on this, I believe I'll need to be working with the following:
user_has_cap get currentuserinfo get_user_meta
By going through the following:
- Check current logged in user ID, user role, custom meta - SCHOOL, and custom meta - CLUB. Store values.
- If logged in user is an EDITOR, allow EDITOR to see all other users' posts ONLY if the other users have identical custom meta - SCHOOL and custom meta - CLUB values (to the EDITOR).
- If logged in user is a CONTRIBUTOR, allow user to only see its own posts.
Does anyone have any ideas about how to best tackle this? Any guidance is much appreciated!