Forums

Prevent anonymous users from reading recent posts (2 posts)

  1. saury316
    Member
    Posted 1 month ago #

    Hi,

    I am working on a wordpress site for a company, who is planning to use it as a CMS application. They will be posting products pictures as posts, and categorize them by the type of product it is or the material it is made from.

    What they want to do though is to prevent people from copying their latest designs. As such, they want to implement a user registration system that will allow only logged in users to be able to see any new product posted in the last 2 months.

    Anything older than that is visible to both logged in and anonymous users.

    I am having trouble figuring how to best to implement this. I found a couple plugins (Social Access Control, Role Manager), but those all block based on categories.

    Option 1 is to have a Category called New Products, and then have some way such that posts in the last 2 months are automatically added and removed from this category.

    Option 2 is to have some way such that posts in the last 2 months are automatically set/unset to be Private, and then try to filter based on that?

    Any suggestions on how to best implement this?

  2. cais
    Member
    Posted 1 month ago #

    Have a look at this page: http://codex.wordpress.org/Function_Reference/get_currentuserinfo

    Set a conditional test to something along these lines:

    if ($user_ID != 0) {
      // display new posts
    } else {
      // display suggestion to register?
    }

    $user_ID = 0 for a user not logged in (ie: not registered)
    Just a thought ...

Reply

You must log in to post.

About this Topic