WordPress.org

Ready to get started?Download WordPress

Forums

Allowing Users to See Their Posts Only (1 post)

  1. barbara825
    Member
    Posted 3 years ago #

    I am developing a site for a client which will have different users posting. He does not want people to be able to see other people's posts. I have found a plugin that does this for me called "Manage Your Posts Only. It works great, except that it still shows the total number of published posts and trashed items, instead of just the ones for that specific user. Is there a way to make it so that it only shows the the numbers for the logged in user? Or optionally, is there a way to remove the published and trashed links altogether?

    If it helps, this is the code in the plugin.

    <?php
    /*
    Plugin Name: Manage Your Posts Only
    Version: 0.1
    Plugin URI: http://code.mincus.com/41/manage-your-posts-only-in-wordpress/
    Description: Makes it so normal users can see only their posts and drafts from the manage posts screen. Great for multi-user blogs where you want users to only see posts that they have created. WordPress already makes it so they cannot edit the posts, but still allows them to see the titles. This can get annoying to find your posts mixed in with thousands of others.
    Author: Allen Holman
    Author URI: http://code.mincus.com
    */

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

    add_filter('parse_query', 'mypo_parse_query_useronly' );
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic