Last active
March 10, 2016 21:15
-
-
Save cliffordp/5708d5b5c1a8f36635a5 to your computer and use it in GitHub Desktop.
Allow Subscribers (technically anyone who can access the CE form) to Add New Venue for The Events Calendar Community Events add-on
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* From https://gist.github.com/cliffordp/5708d5b5c1a8f36635a5 | |
* From Barry | |
* | |
* Allow Subscribers (technically anyone who can access the CE form) to Add New Venue for The Events Calendar Community Events add-on | |
* | |
* Here's a view of what Contributor users have permission to do: http://cl.ly/1M0c1u2x462a | |
* If you want Subscribers to be able to Add New Venue, you could enable them to have `edit_tribe_venues` permission, which could be accomplished by using a plugin like https://wordpress.org/plugins/user-role-editor/ (third party, not guaranteed) or via this custom code snippet (resolves CE capabilities issue) | |
* | |
* @link: https://developer.wordpress.org/plugins/users/roles-and-capabilities/ | |
*/ | |
add_action( 'init', 'barry_all_can_add_new_venue' ); | |
function barry_all_can_add_new_venue() { | |
$anon_users = Tribe__Events__Community__Main::instance()->anonymous_users; | |
add_action( 'tribe_events_community_form', array( $anon_users, 'add_venue_org_caps' ) ); | |
add_action( 'tribe_ce_before_event_submission_page', array( $anon_users, 'add_venue_org_caps' ) ); | |
add_filter( 'user_has_cap', array( $anon_users, 'filter_venue_org_caps' ), 10, 3 ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment