Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Last active December 12, 2019 22:24
Show Gist options
  • Save Pebblo/d451bf07cfa3da1b82dd to your computer and use it in GitHub Desktop.
Save Pebblo/d451bf07cfa3da1b82dd to your computer and use it in GitHub Desktop.
This plugin adds 2 custom roles you can assign to users to provide access to Event Espresso. An Event Organizer should have capabilities to read, edit and publish their own events, they can also view their own events registrations/transactions and should not have access to others events, registration, transactions. Events Managers can view, edit…
<?php
/*
Plugin Name: EE Event Roles Plugin
Description: Creates the 'Event Organiser' and 'Events Maneger' roles for use within Event Espresso.
Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from comment and trackback spam</strong>. It keeps your site protected from spam even while you sleep. To get started: 1) Click the "Activate" link to the left of this description, 2) <a href="http://akismet.com/get/">Sign up for an Akismet API key</a>, and 3) Go to your Akismet configuration page, and save your API key.
Version: 1.0.0
*/
function add_roles_on_plugin_activation() {
//Add the 'Event Organizer' role
add_role(
'event_organizer',
__( 'Event Organizer' ),
array(
//WP Core
'read' => true,
'level_0' => true,
//Assign
'ee_assign_event_category' => true,
'ee_assign_event_type' => true,
'ee_assign_venue_category' => true,
//Read
'ee_read_checkin' => true,
'ee_read_checkins' => true,
'ee_read_contact' => true,
'ee_read_contacts' => true,
'ee_read_default_ticket' => true,
'ee_read_default_tickets' => true,
'ee_read_default_price_types' => true,
'ee_read_default_prices' => true,
'ee_read_ee' => true,
'ee_read_event' => true,
'ee_read_events' => true,
'ee_read_global_messages' => true,
'ee_read_message' => true,
'ee_read_messages' => true,
'ee_read_private_events' => true,
'ee_read_private_venues' => true,
'ee_read_question_groups' => true,
'ee_read_questions' => true,
'ee_read_registration' => true,
'ee_read_registrations' => true,
'ee_read_transaction' => true,
'ee_read_transactions' => true,
'ee_read_venue' => true,
'ee_read_venues' => true,
//Edit
'ee_edit_payments' => true,
'ee_edit_private_events' => true,
'ee_edit_private_venues' => true,
'ee_edit_published_events' => true,
'ee_edit_published_venues' => true,
'ee_edit_question' => true,
'ee_edit_question_group' => true,
'ee_edit_question_groups' => true,
'ee_edit_questions' => true,
'ee_edit_registration' => true,
'ee_edit_registrations' => true,
'ee_edit_system_question_groups' => false,
'ee_edit_system_questions' => false,
'ee_edit_venue' => true,
'ee_edit_venue_category' => true,
'ee_edit_venues' => true,
'ee_edit_message' => true,
'ee_edit_messages' => true,
'ee_edit_event' => true,
'ee_edit_event_category' => true,
'ee_edit_event_type' => true,
'ee_edit_events' => true,
'ee_edit_checkin' => true,
'ee_edit_checkins' => true,
'ee_edit_contact' => true,
'ee_edit_contacts' => true,
'ee_edit_default_price' => true,
//Publish
'ee_publish_events' => true,
'ee_publish_venues' => true,
//Manage
'ee_manage_venue_categories' => true,
'ee_manage_event_categories' => true,
//Send
'ee_send_message' => true
)
);
//Add 'Events Manager' role
add_role(
'events_manager',
__( 'Events Manager' ),
array(
//WP Core
'read' => true,
'level_0' => true,
//Assign
'ee_assign_event_category' => true,
'ee_assign_event_type' => true,
'ee_assign_venue_category' => true,
//Read
'ee_read_checkin' => true,
'ee_read_checkins' => true,
'ee_read_contact' => true,
'ee_read_contacts' => true,
'ee_read_default_price_types' => true,
'ee_read_default_prices' => true,
'ee_read_default_ticket' => true,
'ee_read_default_tickets' => true,
'ee_read_ee' => true,
'ee_read_event' => true,
'ee_read_events' => true,
'ee_read_global_messages' => true,
'ee_read_message' => true,
'ee_read_messages' => true,
'ee_read_others_checkins' => true,
'ee_read_others_default_tickets' => true,
'ee_read_others_events' => true,
'ee_read_others_messages' => true,
'ee_read_others_payment_methods' => true,
'ee_read_others_registrations' => true,
'ee_read_others_venues' => true,
'ee_read_payment_method' => true,
'ee_read_payment_methods' => true,
'ee_read_private_events' => true,
'ee_read_private_venues' => true,
'ee_read_question_groups' => true,
'ee_read_questions' => true,
'ee_read_registration' => true,
'ee_read_registrations' => true,
'ee_read_transaction' => true,
'ee_read_transactions' => true,
'ee_read_venue' => true,
'ee_read_venues' => true,
//Delete
'ee_delete_checkin' => true,
'ee_delete_checkins' => true,
'ee_delete_contact' => true,
'ee_delete_contacts' => true,
'ee_delete_default_price' => true,
'ee_delete_default_price_type' => true,
'ee_delete_default_price_types' => true,
'ee_delete_default_prices' => true,
'ee_delete_default_ticket' => true,
'ee_delete_default_tickets' => true,
'ee_delete_event' => true,
'ee_delete_event_category' => true,
'ee_delete_event_type' => true,
'ee_delete_events' => true,
'ee_delete_global_messages' => true,
'ee_delete_message' => true,
'ee_delete_messages' => true,
'ee_delete_others_checkins' => true,
'ee_delete_others_default_tickets' => true,
'ee_delete_others_events' => true,
'ee_delete_others_messages' => true,
'ee_delete_others_venues' => true,
'ee_delete_payment_method' => true,
'ee_delete_payment_methods' => true,
'ee_delete_payments' => true,
'ee_delete_private_events' => true,
'ee_delete_private_venues' => true,
'ee_delete_published_events' => true,
'ee_delete_published_venues' => true,
'ee_delete_question' => true,
'ee_delete_question_group' => true,
'ee_delete_question_groups' => true,
'ee_delete_questions' => true,
'ee_delete_registration' => true,
'ee_delete_registrations' => true,
'ee_delete_venue' => true,
'ee_delete_venue_category' => true,
'ee_delete_venues' => true,
//Edit
'ee_edit_checkin' => true,
'ee_edit_checkins' => true,
'ee_edit_contact' => true,
'ee_edit_contacts' => true,
'ee_edit_default_price' => true,
'ee_edit_default_price_type' => true,
'ee_edit_default_price_types' => true,
'ee_edit_default_prices' => true,
'ee_edit_default_ticket' => true,
'ee_edit_default_tickets' => true,
'ee_edit_event' => true,
'ee_edit_event_category' => true,
'ee_edit_event_type' => true,
'ee_edit_events' => true,
'ee_edit_global_messages' => true,
'ee_edit_message' => true,
'ee_edit_messages' => true,
'ee_edit_others_checkins' => true,
'ee_edit_others_default_tickets' => true,
'ee_edit_others_events' => true,
'ee_edit_others_messages' => true,
'ee_edit_others_payment_methods' => true,
'ee_edit_others_registrations' => true,
'ee_edit_others_venues' => true,
'ee_edit_payment_method' => true,
'ee_edit_payment_methods' => true,
'ee_edit_payments' => true,
'ee_edit_private_events' => true,
'ee_edit_private_venues' => true,
'ee_edit_published_events' => true,
'ee_edit_published_venues' => true,
'ee_edit_question' => true,
'ee_edit_question_group' => true,
'ee_edit_question_groups' => true,
'ee_edit_questions' => true,
'ee_edit_registration' => true,
'ee_edit_registrations' => true,
'ee_edit_system_question_groups' => true,
'ee_edit_system_questions' => true,
'ee_edit_venue' => true,
'ee_edit_venue_category' => true,
'ee_edit_venues' => true,
//Manage
'ee_manage_event_categories' => true,
'ee_manage_event_types' => true,
'ee_manage_gateways' => true,
'ee_manage_venue_categories' => true,
//Payment methods
'ee_payment_method_admin_only' => true,
'ee_payment_method_aim' => true,
'ee_payment_method_bank' => true,
'ee_payment_method_check' => true,
'ee_payment_method_invoice' => true,
'ee_payment_method_mijireh' => true,
'ee_payment_method_paypal_pro' => true,
'ee_payment_method_paypal_standard' => true,
//Publish
'ee_publish_events' => true,
'ee_publish_venues' => true,
//Send
'ee_send_message' => true
)
);
}
register_activation_hook( __FILE__, 'add_roles_on_plugin_activation' );
@pasinsjr
Copy link

I have already use it, and why Event Organizer can access others transactions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment