Forums

Prevent anonymous users from reading recent posts (3 posts)

  1. saury316
    Member
    Posted 2 years 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. Edward Caissie
    Member
    Posted 2 years 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 ...

  3. Zambrano Sergio
    Member
    Posted 1 year ago #

    will that work with registered logged-out users? (detected by cookie?)

Topic Closed

This topic has been closed to new replies.

About this Topic