cliff
7/28/2016 - 7:02 PM

When logged in as an administrator, make the "My Events" list in Community Events show events from ​all authors

When logged in as an administrator, make the "My Events" list in Community Events show events from ​all authors

<?php

/**
 * 
 * From: https://gist.github.com/cliffordp/c6ddab749bd771370948ae05913a7690
 * By George
 * 
 * When logged in as an administrator, make the "My Events" list in Community Events show events from all authors
 * 
 */
function tribe_ce_show_all_in_my_events_list_if_admin( $args ) {

    if ( empty( $args ) || ! is_array( $args ) ) {
        return $args;
    }

    if ( current_user_can( 'administrator' ) ) {
        $args['author'] = 0;
    }

    return $args;
}

add_action( 'tribe_ce_my_events_query', 'tribe_ce_show_all_in_my_events_list_if_admin' );