Home › Forums › Calendar Products › Events Calendar PRO › Event Permissions
- This topic has 4 replies, 2 voices, and was last updated 10 years, 6 months ago by
George.
-
AuthorPosts
-
October 6, 2015 at 7:40 am #1011909
Lee Reeves
ParticipantIs it possible for specific roles to be granted access to only view event Submissions? If so, can you provide the steps or links to any supporting documentation?
Thank you!
October 6, 2015 at 9:24 am #1011959George
ParticipantHey @Lee,
There unfortunately isn’t an easy way to configure things so that a role can only see event Submissions. The closest you can get to that sort of functionality is to set users to a WordPress user role like “Contributor” or “Editor”, which allows some admin access to view content like this but does not let the user do other admin activities like change or see site settings, activate/deactivate plugins or anything like that, and so on.
If you truly need a custom role that can only view submissions, then unfortunately that would take some hefty custom coding. We don’t support custom coding or general WordPress questions, so there isn’t a whole lot of insight I have here, but in terms of documentation on how WordPress user roles can be created and specified there are indeed some pieces of documentation I’d recommend checking out to get started.
First is this Codex overview of the add_role() function → https://codex.wordpress.org/Function_Reference/add_role
Next is add_cap() → https://codex.wordpress.org/Function_Reference/add_cap
The opposites of these functions, respectively, are remove_role() and remove_cap(), which may also be helpful for you here. Articles about these removal functions are linked to from the “add” functions if you’re curious.
I hope this documentation helps!
— George
October 7, 2015 at 8:21 am #1012350Lee Reeves
ParticipantThanks George! Following through with your example of the “Contributor” role, is it possible to add permissions to that role so the “Contributor” can also view all event submissions? If yes, can you provide the steps or access to any supporting documentation?
Many thanks!
October 7, 2015 at 2:16 pm #1012501Lee Reeves
ParticipantThanks!
October 9, 2015 at 8:07 am #1013160George
Participantis it possible to add permissions to that role so the “Contributor” can also view all event submissions?
This is indeed possible, but it requires custom coding and is not something possible out-of-the-box with The Events Calendar 🙁
If yes, can you provide the steps or access to any supporting documentation?
Since it’s custom code, there are unfortunately not many specific examples we can share for this – however, the add_cap() function I shared above is how you’d do this. So I’d recommend reading the articles I linked to up there; there are some good examples! For a quick example, taken right from that article, you’d use the following code in e.g. your theme’s functions.php file to allow “Contributor”-level users to edit other user’s posts, which is by default a cap only reserved for editors and Administrators:
function add_theme_caps() {
// gets the author role
$role = get_role( 'contributor' );// This only works, because it accesses the class instance.
// would allow the contributor to edit others' posts for current theme only
$role->add_cap( 'edit_others_posts' );
}
add_action( 'admin_init', 'add_theme_caps');
Now, you already marked this thread “Resolved”, so with that in mind and with the custom code examples shared here, I will go ahead and close this thread. If other questions, comments, or concerns ever arise, however, open a new thread any time!
Cheers,
George -
AuthorPosts
- The topic ‘Event Permissions’ is closed to new replies.
