MakeUseOf

Thursday, November 8, 2012

10 Useful Wordpress User Interface / Dashboard Hacks!

10 Useful Wordpress User Interface / Dashboard Hacks!: "Further wordpress shows total counts of all posts (pending, published, all, drafts) present in the entire blog. This is totally unacceptable and it may present a security risk. You dont want to reveal entire list of blog posts to your users. The solution is to show posts, submitted by the user who is currently logged in and remove all post counts etc.. This is the key to design a best user interface.
Note: I have designated the default user role as “contributor” when they register. You may want to change this, depending on what user role you set, for example author.
This code will only show posts submitted by author/user, who is currently logged in:
?
CODE
01
02
03
04
05
06
07
08
09
10
11
//user specific posts in admin area
function posts_for_current_author($query) {

if(current_user_can('contributor') && is_admin()) {

global $user_ID;
$query->set('author',  $user_ID);
}
return $query;
}
add_filter('pre_get_posts', 'posts_for_current_author');
This post will hide the number counts in brackets:"

'via Blog this'

No comments:

Post a Comment