Created
March 21, 2012 16:24
-
-
Save jo-snips/2149250 to your computer and use it in GitHub Desktop.
The Events Calendar: Patch for Private Events
This file contains hidden or 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
| public function getEvents( $args = '' ) { | |
| $tribe_ecp = TribeEvents::instance(); | |
| // Determine if user can read private events. If so, pass private events by default, otherwise hide them. | |
| global $current_user; | |
| if (user_can( $current_user->ID, 'read_private_tribe_events' )) { | |
| $defaults = array( | |
| 'posts_per_page' => tribe_get_option( 'postsPerPage', 10 ), | |
| 'post_type' => TribeEvents::POSTTYPE, | |
| 'orderby' => 'event_date', | |
| 'order' => 'ASC', | |
| 'post_status' => array( 'publish', 'private' ) | |
| ); | |
| } else { | |
| $defaults = array( | |
| 'posts_per_page' => tribe_get_option( 'postsPerPage', 10 ), | |
| 'post_type' => TribeEvents::POSTTYPE, | |
| 'orderby' => 'event_date', | |
| 'order' => 'ASC' | |
| ); | |
| } | |
| $args = wp_parse_args( $args, $defaults); | |
| return TribeEventsQuery::getEvents($args); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does anybody have an updated patch for the latest version? I've tried inserting the old code, but it keeps spitting out errors. I'm very desperate to get this to work!