-
-
Save jo-snips/2149250 to your computer and use it in GitHub Desktop.
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); | |
} |
I came to this site from this WP Support Topic: http://wordpress.org/support/topic/plugin-the-events-calendar-private-events-1
Is this not a patch for The Events Calendar? It appears it is for the Community Events plugin.
Ooops, you're right good catch, I had put the path to the community events class. It's corrected now.
Thanks! The patch works great!
You're welcome! Glad to hear it :)
No, this patch is for the base The Events Calendar plugin. You need to modify the core /wp-content/plugins/the-events-calendar/lib/the-events-calendar.class.php file on (currently) lines 2478 - 2489.
No, this patch is for the base The Events Calendar plugin and you need to modify the core /wp-content/plugins/the-events-calendar/lib/the-events-calendar.class.php file on (currently) lines 2478 - 2489.
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!
You'll need to modify tribe-community-events.class.php and remember the next time you update the plugin, this hack will be wiped! So, you'll need to add it again.