Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pebblo/6378e6d5cfa6682046521312c1bfc219 to your computer and use it in GitHub Desktop.
Save Pebblo/6378e6d5cfa6682046521312c1bfc219 to your computer and use it in GitHub Desktop.
Example of how to include Private events on the calendar if the current user has the ee_read_private_events cap
<?php //Please do not include the opening PHP tag if you already have one
add_filter( 'AFEE__EED_Espresso_Calendar__get_calendar_events__public_event_stati', 'tw_ee_add_private_events_to_cal_with_cap_check', 10, 1);
function tw_ee_add_private_events_to_cal_with_cap_check($public_event_stati) {
// Add private events if the current user can view them.
if (EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
$public_event_stati[] = EEM_Event::post_status_private;
}
return $public_event_stati;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment