After an anonymous user viewed more than two or three articles, I want to redirect such user to the login/register page.
Any suggestions about how to make this work somehow?
After an anonymous user viewed more than two or three articles, I want to redirect such user to the login/register page.
Any suggestions about how to make this work somehow?
Not sure if it is the only way to get this to work, and not sure if it is the most elegant way, but it should be doable as detailed below. It does not require any "custom" code, only some (often used) contributed modules.
The Flag module can by used to flag (eg) articles, which itself can be done automatically (behind the scenes) via the Rules module (= 1st rule). To make the Flag module work for anonymous users also, you'll need to get the Session API involved. For more details on that, refer to:
With that, you have "a" counter (= number of articles flagged by a user) that you can use as a Rules Condition in a 2nd rule, whereas this 2nd rule can be triggered by a Rules Event like "after an article gets flagged". In that Rules Condition you just check if the counter exceeds your limit (= 2 in your case), then you perform the Rules Action (in the 2nd rule) which is to redirect to your login/register page.
You can take a look at the Node Limit module. Some more details about it (from its project page):
The Node Limit module allows administrators to restrict the number of nodes of a specific type that roles or users may create. For example, if a site has an "Advertiser" role that can create "advertisement" nodes, then the node limit administrator can restrict all users in that role to a specific number of nodes. He may also restrict users on a per-user basis.
Works well, but I don't have tested it with anonymous users.