Created
May 27, 2020 19:04
-
-
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
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 //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