• Hello there.
    I would like to know if it is possible to find a solution to the following problem.
    Because I have several authors into my blog, I would like to know if there is any possibility of showing only the posts of the specific logged in author, instead of everyone posts. (From the wp-admin/edit.php )

    Thank you all

Viewing 15 replies - 1 through 15 (of 31 total)
  • Does the role-manager plugin do it for you?

    https://www.im-web-gefunden.de/wordpress-plugins/role-manager/

    It can at least prevent other from editing those posts… Maybe even prevent them from seeing them.

    Thread Starter Nikolas

    (@kordellas)

    Hey, thank you for your answer.
    But it does not prevent them from seeing them. I used role manager and made a mess into my database..

    To my knowledge an author sees all posts but can only edit/change his/her own posts. Furthermore there is a filter at the top of the page, but that does not do author name filtering. But, if in that screen you click your authorname (blue in the second column) then a list with only your posts is displayed (did not know that before myself).

    Thread Starter Nikolas

    (@kordellas)

    Yes, this is correct, but i am trying to find if there is a possibility of showing only his posts by default..

    Thread Starter Nikolas

    (@kordellas)

    As i see the url if you clock an author is /wp-admin/edit.php?author=1

    So if there is a variable that shows the number of the author, i will put it as a link into the administrator menu.

    Thread Starter Nikolas

    (@kordellas)

    so anyone?

    Thread Starter Nikolas

    (@kordellas)

    hello ?

    Sure i’ll give it a go…

    What about this..

    function posts_for_current_author($query) {
    
    	if($query->is_admin) {
    
    		global $user_ID;
    		$query->set('author',  $user_ID);
    	}
    	return $query;
    }
    add_filter('pre_get_posts', 'posts_for_current_author');

    Of course that will apply to all users.. if you want to exclude say admins let me know and i’ll make a change to the above..

    Hi @t310s (Telos!) – this looks great. Because I’m not a coding expert – could you tell where abouts this code needs to be inserted.

    Many thanks.
    Mark

    functions.php of your theme will be fine..

    Like i said, it will apply to “All” users, so if you want to target users in particular then you’ll need something additional to the above..

    Telos – you’re a star. Thank you.

    Where would the world be without opensource and forums like this?

    Having read closely what you’ve written – (and I’m going to be trying it this morning) does this apply to all users within a role or all users across the system including admin?

    the former would be perfect if you are able to comment on that – apply to all users in the ‘subscriber’ role say… (that role has been modified to allow page writing’). I’d still like a ‘supervisor’ role to be able to see everything – whether it be editor or admin etc.

    Yes, as i said before, it will apply to ALL users..

    If you want to only work for particular roles i’ll need a clear defintion of what roles can see all and what can’t, then i’ll test some changes to the above…

    Remember this only changes the posts viewable, so it won’t have any effect on whether they can actually view or edit them (if they could before, they will still be able to).. they just won’t see anything other then their own..

    Hi Telos,

    I’m using the Capability manager plugin and have defined a ‘Subscriber’ as someone I’d like to login and view (and therefore edit) only their pages. (and I mean pages).

    You code above works perfectly for achieving that.

    If you are able to tweak the code (as you indicated above) so that that situation doesn’t change… however IN ADDITION, an editor role can see all subscriber pages – or any pages on the system by default – that would be amazing.

    Thank you in advance.

    Mark

    That’s outside the scope of what the above can do..

    The above code simply sets the author parameter in query_posts to that of the current user… (pre query)..

    I can make the code apply to only a select level, but it’s not going to be possible (not easily at least) to have a select level user see X levels worth of posts..

    I believe this is something you’d need to handle with plugins and modifications to said plugins. I wouldn’t know where to start because i don’t personally use any of the role management plugins.

    The issue i see is that in order to know which posts fit the criteria you’d need to do an additional lookup query to find which posts full under said criteria then move along that information to the pre query posts function above, which could be quite a large query if you have alot of users or posts…

    It’s not to say i’m totally correct, i’m sure with a little imagination and patience such a task could be handled efficiently, right now i’m not sure i can give you a clear direction being that it’s not something i’ve had to tackle before…

    What i tend to do when i’m looking to do X in WP (x being anything), is look for a plugin that gets as close as possible, then take out or strip what i need/don’t need, from it..

    Oh OK – I misunderstood…

    if you want to exclude say admins let me know and i’ll make a change to the above..

    What were you suggesting above? When you say exclude admins – I thought you meant exclude admins from the ‘seeing only the user’s posts’ rule.

    By the way – really appreciate your input here.

Viewing 15 replies - 1 through 15 (of 31 total)
  • The topic ‘Show only author’s posts in admin panel instead of all posts’ is closed to new replies.