WordPress.org

Ready to get started?Download WordPress

Forums

Restricting certain blog posts? (2 posts)

  1. tr3online
    Member
    Posted 2 years ago #

    I'm building my friends blog and he asked me a rather odd request. He wants the latest five blog posts to be visible to non-registered members but no others.

    I know how to do this on the blog list based on the page count, but if the pages are indexed, someone guesses the blog titles, etc there will be nothing stopping people viewing that content.

    Is there some way that I could restrict access to blog pages that aren't the latest five based on is_user_logged_in() or something to that effect?

    I really have no idea where to start, so if someone could point me in the right direction, it would be much appreciated.

    Thanks in advance!

    Tre

  2. tr3online
    Member
    Posted 2 years ago #

    I'm using s2Member for membership handling.

    My Initial attempt was just limiting the number of blog posts to 5 and hiding the pagination button based on if someone's logged in and of the right user level. This works fine, but people can manually add ?page_id=x&paged=y to view more content. Also, if they know the name of the post, they can view it as well.

    My thoughts were to add some sort of auto-categorizing, where if the posts aren't in the 5 newest, they would be auto tagged with the category "archive" which then can be protected using s2members built-in functionality. I just have no clue where to begin with auto tagging a category.

    I would appreciate any insight on where to begin with all of this? Also, if you have a better idea of how to do something similar, I'm open to suggestions.

Topic Closed

This topic has been closed to new replies.

About this Topic