Tagged: user role plugin
July 6, 2017 at 8:54 pm #14665
Thank you for your wonderfull template!
I am looking for a plugin to create a user role that can only access and change the lambert gallery. Any advice is welcome!
KatjaJuly 7, 2017 at 7:28 am #14674
You can find more details here: https://wpdean.com/wordpress-plugins-to-extend-user-roles-capabilities/
Or do google searchJuly 7, 2017 at 5:03 pm #14690
Thanks, I was looking in to user role editor but the custom post types such as the gallery don’t have any roles to grant?July 8, 2017 at 8:59 am #14698
What’s the plugin? and I need wp-admin account to check.July 9, 2017 at 3:14 am #14706This reply has been marked as private.July 10, 2017 at 5:03 pm #14716
The gallery post type have no custom capabilities, so you can edit lambert_add_ons plugin to enable it: http://prntscr.com/ftt1hq
//'capability_type' => 'post' 'capabilities' => array( 'edit_post' => 'edit_cthgallery', 'edit_posts' => 'edit_cthgalleries', 'edit_others_posts' => 'edit_other_cthgalleries', 'publish_posts' => 'publish_cthgalleries', 'read_post' => 'read_cthgallery', 'read_private_posts' => 'read_private_cthgalleries', 'delete_post' => 'delete_cthgallery' ), // as pointed out by iEmanuele, adding map_meta_cap will map the meta correctly 'map_meta_cap' => true
Also set public option to false to hide galleries from public.July 10, 2017 at 6:43 pm #14718
Thank you! By adding that code, the capabilities are now visible.
What do you mean by: Also set public option to false to hide galleries from public? Visitors need to see the gallery on the website or does this mean something else?July 10, 2017 at 7:17 pm #14719
By appending the capabilities for the gallery to a new user, when logging in with that user, I can see everything from Lambert (that has post capabilities) but not the Lambert gallery. Any suggestions?July 10, 2017 at 8:17 pm #14720
Forget about my last remark. I forgot to set the correct role to the new user. Now I see the lambert gallery but I cannot edit it.
July 10, 2017 at 9:23 pm #14722
- This reply was modified 1 year, 2 months ago by kclaes.
You can also set edit gallery capability to the user.July 10, 2017 at 10:20 pm #14727
In the photo “code” you can see the code I added. Edit gallery is set this way, no?
The user roles I can see with this code are in “user role capabilities”. What I find strange is that the delete option is not available.
Logged in I can view the gallery, I can add a new one, but I can not edit an existing gallery nor a newly added one.July 10, 2017 at 11:45 pm #14733
I changed the code to this:
`’capabilities’ => array(
‘edit_post’ => ‘edit_cthgallery’,
‘edit_posts’ => ‘edit_cthgalleries’,
‘edit_others_posts’ => ‘edit_others_cthgalleries’,
‘edit_private_posts’ => ‘edit_private_cthgalleries’,
‘edit_published_posts’ => ‘edit_published_cthgalleries’,
‘publish_posts’ => ‘publish_cthgalleries’,
‘read_post’ => ‘read_cthgallery’,
‘read_private_posts’ => ‘read_private_cthgalleries’,
‘delete_post’ => ‘delete_cthgallery’,
‘delete_posts’ => ‘delete_cthgalleries’,
‘delete_others_posts’ => ‘delete_others_cthgalleries’,
‘delete_private_posts’ => ‘delete_private_cthgalleries’,
‘delete_published_posts’ => ‘delete_published_cthgalleries’
Now I can edit and delete any gallery.
The only thing I can not change is the category, even not when I give the capability “manage categories”. Do I need to add something to the code?
KatjaJuly 11, 2017 at 12:59 am #14734
I’ve managed to make the categories editable by adding this function to the them’s function.php:
$wp_taxonomies[‘cthgallery_cat’]->cap->assign_terms = ‘edit_cthgallery’;
Is it possible to incorporate this into a child theme?July 11, 2017 at 3:25 am #14735
Yes, you can add it to child theme’s functions.php file.
Or add capabilities definition in cthgallery_cat taxonomy registration code. Read more at:
https://wordpress.stackexchange.com/questions/155629/custom-taxonomies-capabilitiesJuly 12, 2017 at 4:49 pm #14766
I changed the code in cthgallery.php as shown in the picture. Is that correct?July 14, 2017 at 5:51 am #14782
Yes, but you miss a comma character ( , ) after capabilities statement.
You must be logged in to reply to this topic.