• Hi, i have been using wordpress for a few years now, and maintain a few different sites based upon WP.

    I am a HS science teacher and am looking to create an online journal for my students, but i am a bit concerned about the students’ privacy.

    In my mind an ideal situation would the following:

    (1) no post visible without being logged in
    (2) the only posts visible to a student (probably author level) are ones that they have posted
    (3) every post will be available for viewing/commenting by the teacher (admin)

    The password protected post dont really seem a good way to make this happen. I am hoping that a more elegant solution will be possible. I have seen how extensible WP can be and am in every way impressed with it, and so would like to stay with it for this journal system i am trying to put in place.

    if anyone has any thoughts or ideas, or experience in this area, please let me know.

    thanks so much!!!!!

Viewing 3 replies - 1 through 3 (of 3 total)
  • You can set up your header.php theme so that the first thing it does is asks “Is the user logged in?”

    If the answer is yes, they’ll be directed to your blog as usual. If not, they’ll be forced directly to the login screen.

    Add the following code to your site’s header.php theme at the very beginning, and make sure not to leave ANY SPACES after the code and before the first line of your header.php’s existing code (probably something like <!DOCTYPE html PUBLIC… )

    <?php global $user_ID; if (!$user_ID): ?>
    <?php
    $filename = "https://yourwebsite.com/wp-login.php" ;
    header("location: ".$filename);
    ?>
    <?php endif; ?>

    Just remember to change the https://yourwebsite.com/wp-login.php bit to the actual URL of your wp-login.php file.

    Thread Starter laxstar2

    (@laxstar2)

    Thanks for the fast response! This works well to force the login. Thank you.

    I still would like to limit the visibility and access of each post to the author of the post and the teacher/admin.

    any ideas?

    thanks again

    Here’s a plugin that will make it so:
    1) users that are not logged in will see no posts
    2) non-administrators can only see their own posts
    3) administrators can see all posts

    Download it here:
    https://lewisvance.com/wordpress-plugins/wordpress-diary

    The only problem I noticed is the “recent posts” box on the dashboard still shows posts from all users. It looks like that can’t be modified with a plugin unfortunately. If it’s an issue you can always edit wp-admin/index.php .

    I hope this is what you were looking for.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hide post from everyone except author and admin’ is closed to new replies.