Last active
October 1, 2020 09:32
-
-
Save digamber89/b824b14fe593273e580a3c4edd2544f3 to your computer and use it in GitHub Desktop.
Author Meetings Only
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
function show_only_authors_own_meetings( $query ) { | |
global $pagenow; | |
if ( 'edit.php' != $pagenow || ! $query->is_admin ) { | |
return false; | |
} | |
if ( $query->is_main_query() && $query->get( 'post_type' ) == 'zoom-meetings' ) { | |
$user = wp_get_current_user(); | |
$privileged_roles = [ 'administrator' ] | |
if ( ! empty( array_intersect( $user->roles, $privileged_roles ) ) ) { | |
return false; | |
} | |
add_filter( 'views_edit-zoom-meetings', [ $this, 'zoom_meeting_views' ], 11 ); | |
$query->set( 'author', $user->ID ); | |
} | |
} | |
add_action( 'pre_get_posts', 'show_only_authors_own_meetings' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment