-
Notifications
You must be signed in to change notification settings - Fork 0
/
view_my_posts_alone.php
29 lines (29 loc) · 1.21 KB
/
view_my_posts_alone.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
/*
Plugin Name: View My Posts Alone
Version: 1.0
Plugin URI: https://github.com/Nareshkumar979/View-My-Posts-Alone
Description: This plugin is for the Contributors/Writers alone who make contributions to our site in the form of posts or any writings etc., Hence they can view only the contributions what they make unable to see what others have contributed. It can be used for the posts as well as the Custom Post Type also.
Author: Naresh Kumar .P
Author URI: http://coolguynaresh.blogspot.in/
*/
function vmpsa_hideotherspost( $wp_query ) {
if (strpos( $_SERVER[ 'REQUEST_URI' ], '/wp-admin/edit.php' ) !== false) {
if ( !current_user_can( 'activate_plugins' ) ) {
add_action( 'views_edit-post', 'vmpsa_letmehideyou' );
global $current_user;
$wp_query->set( 'author', $current_user->id );
}
}
}
add_filter('parse_query', 'vmpsa_hideotherspost' );
//Calling the Function to remove all the Status after the Post is Published by the Admin in the Contributor Dashboard not in other Dashboard
function vmpsa_letmehideyou( $views ) {
unset($views['all']);
unset($views['publish']);
unset($views['trash']);
unset($views['draft']);
unset($views['pending']);
return $views;
}
?>