Support » Fixing WordPress » Guest author user settings

  • Demir

    (@sdarthenos)


    Hi,

    I want to open a section for guest authors on my blog. For this, I created a trial user, I defined the user as “author” and I have logged in with that user.

    My questions are;
    1. How do I make this user see posts that are only his own, not all the posts in my blog?
    2. How do I get this user to see only comments from his / her own posts?

    Do my questions above have an easy answer or setting?
    Thanks in advance for your help.

    Regards

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • If you assign the user an “Author” role upon create they’ll be able to create and edit their own posts but will not have access to edit others posts.

    If you just want to allow users to submit their posts from the front-end you could try the User Submitted Posts plugin.

    If you want to hide posts in the admin panel that do not belong to the user you could try this WP Beginners tutorial. In short, it’s just a PHP hook you would need to add that limits posts by author:

    /**
     * Hide other author posts from users who cannot edit others posts
     * 
     * @param WP_Query $query
     *
     * @return void
     */
    function hide_other_author_posts( $query ) {
    
    	if( ! is_admin() || current_user_can( 'edit_others_posts' ) ) {
    		return;
    	}
    
        $query->set( 'author', get_current_user_id() );
    
    }
    add_action( 'pre_get_posts', 'hide_other_author_posts' );
Viewing 1 replies (of 1 total)
  • The topic ‘Guest author user settings’ is closed to new replies.