• Dear all,

    I’m very new to WordPress (2 days…) but I am in urgent need to make some modifications in the admin part of my wordpress installation. I wish to hide certain things in the admin section for users with the contributer role. For now I wish to hide posts for certain contributers. Later I need to hide more parts.

    For example, suppose contributer A visits edit-post section in the admin section. In this case contributer A should not be able to see any posts from other contributers. (The standard behavior is that contributor A can see other contributers posts but not edit them.)

    I have not been able to find any action or filter appropriate for this modification. I have tried out the mange_posts_column but what I really would need is a manage_posts_row to disable certain rows in the list of posts.

    I have solved the problem by making the necessary changes in the wp-admin code. I have also done some work using mange_posts_column, manage_posts_custom_column, and javascripts on the client side to hide appropriate posts. However each of those methods has it drawbacks and I am looking for a better solution.

    I am grateful for any tips that can get me going in the right direction, and i apologize in advance if this question turns out to be trivial or if I have overseen something trivial. Remember, I am a newbie:-)

Viewing 4 replies - 1 through 4 (of 4 total)
  • I too need exactly this! I dont want my authors to view each others posts in the ‘edit posts’ page, I want them only to view what they have drafted and published.
    Someone please help!!

    There are a number of alternatives to do this through CSS, but only to some extent. You can just edit admin.css or you could use the adMinimize plugin (like I do) which allows the option of setting various classes and ids throughout the admin panels the “display: none” CSS property.

    However, a user who wants to bypass this will be able to access the hidden options by using any “web developer” tool and viewing the admin page with CSS disabled. Some modern browsers don’t even need an add-on for that.

    Also, there is another annoying issue with setting the .author-other class to display:none. It will only make those articles not show in the list, but it will still count them and the number of posts will still be visible.

    You’re probably thinking: “Big deal. So what’t the problem? It’s way better than seeing them!”

    Well…, not necessarily. Because WP still shows only 20 articles per page visible or not visible. So one might find two or more blank pages after coming back from holidays if the other authors posted 40-50 articles while they were gone. Now blank pages in the edit posts pane is annoying and certainly has a hacky feeling about it.

    I think we need a better solution.

    Anyone?

    actually i found a solution for this. it adds a filter on the query only for your edit.php page in the admin area.

    here it is:
    manage your posts only

    if you have editors on your website you probably want them to see others’ posts. so you will need to edit the function in manage_your_posts_only.php to look like this:

    function mypo_parse_query_useronly( $wp_query ) {
        if ( esc_url( $_SERVER[ 'REQUEST_URI' ], '/wp-admin/edit.php' ) !== false ) {
    		global $current_user;
    		get_currentuserinfo();
    		if (($current_user->user_level) < 7) {
                $wp_query->set( 'author', $current_user->id );
            }
        }
    }

    I also changed strpos () from the original plugin file to esc_url as suggested here

    Mate, Your a diamond geezer. This sorted my problem out perfectly!! Cheers!!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Admin Edit Post – Hide Posts’ is closed to new replies.