Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a list of CPT's called resources. I want each resource to be assignable to any number of users. The assignment would preferably occur by an admin, logging in, nav'ing to that users email, and seeing a checkbox list of all available resources, they could then check a box next to resource A, and then the user has access to resource A. There will be like 150 resources so its not a short list.

Any ideas?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

This is something you can achieve with the Advanced Custom Fields plugin. The trick is to use the ACF_LITE mode, which would let you define a dynamic list of user profile fields from functions.php. You could iterate over each post type and display a checkbox for it. Then use the edit_user_profile_update hook to call $user->add_cap('edit_[resource]') or $user->remove_cap('edit_[resource]'), etc.

share|improve this answer
    
I was unable to find the ACF_LITE reference on the ACF site. Any more clarity you can provide? –  TJ Sherrill Jun 9 at 16:14
    
Ah, yes, I've linked ACF_LITE up above to add some context. –  Dan Phiffer Jun 9 at 17:28
    
thanks. This was very helpful –  TJ Sherrill Jun 10 at 18:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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