Allow non-admin roles access
-
Does anyone know of a way to allow non-Admin users access to this plugin? I’ve tried adding in Role manager plugins but it doesn’t seem to allow access.
-
Hi @edival,
All of the capabilities for this plugin are tied to the
manage_optionscapability (an admin-only capability). In almost all places, this capability can be changed with a filter.For example, if you want to editors to be able to access parts of this plugin, use this code snippet. (The
manage_linkscapability is only for Editors and Admins).add_filter( 'yikes-mailchimp-user-role-access', 'yikes_mailchimp_change_user_role', 10, 1 ); function yikes_mailchimp_change_user_role( $cap ) { return 'manage_links'; }For more information about capabilities for different roles, check out this article: https://codex.ww.wp.xz.cn/Roles_and_Capabilities.
Let me know if you need any help applying this custom code.
Thank you,
Kevin.Hi Kevin,
That sounds super simple.
I tried applying that code to my functions.php but it didn’t seem to make a difference aside from hiding Easy Forms from the admin π
I appreciate the quick feedback.
Haha well that’s how it’s supposed to work. I just tried it out and
manage_linksis a wrong capability.Which roles are you looking to enable it for?
return 'publish_posts';Should work for Authors, Editors, and Admins.return 'read';Should work for all user roles.return 'unfiltered_html';Should work for Editors and Admins.Note that some of these won’t work in multisite configurations.
Ahh, okay.
I’d like Editors to have access to view, create, edit and duplicate the forms:
/wp-admin/admin.php?page=yikes-inc-easy-mailchimpAnd view the mailing lists: /wp-admin/admin.php?page=yikes-inc-easy-mailchimp-lists
And that should do it π
Hi @edival,
Were you able to work that out? Do you have the capabilities working as you’d like them?
Let us know.
Thank you,
Kevin.Hi Kevin,
No, I haven’t had the chance yet. Do you have a simple solution? π
Thanks so much.
Hello,
Unfortunately a filter function is the only way to do it. For editors & admins, that would look like this:
add_filter( 'yikes-mailchimp-user-role-access', 'yikes_mailchimp_change_user_role', 10, 1 ); function yikes_mailchimp_change_user_role( $cap ) { return 'unfiltered_html'; }Hi Kevin,
Thanks,
I’ll play with this π
Hi Kevin,
That’s the one, that’s all the features, but it works perfectly! I’ll have to remember that bit of code.
Thanks so much.
Hi @edival,
Yeah – sorry – we don’t have our permissions broken up as you wanted; it’s all or nothing.
I’m glad that’ll work for you though.
Cheers,
Kevin.
The topic ‘Allow non-admin roles access’ is closed to new replies.