Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

Limiting number of posts Guests can view

Quote Reply
Limiting number of posts Guests can view
Heya all,

My forums are set that you have to register to post. I'd like to limit the number of posts guests can view in the forums. Has anyone thought of this or have some ideas on how to do this?

I'd basically like to be able to use the latest say 5 posts as a teaser and then invite people to register to see them all and participate.

Alternatively I'd like to set a number of posts they can view, say 20 and when count that down as they click on posts and threads. When it reaches 0 they are prompted to register to see more. This can reset with every session...

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] Limiting number of posts Guests can view In reply to
That could be hard to enforce. How would you ensure that the user does not view more then 5 posts? By IP adress (if so, you may block other users from the same IP)? By cookies?

You probably couldn't do it in a secure way, but you could stop 95% of the people who aren't technical enough to get around it.

Would have to be done as a plugin that would hook into view posts routine and return an error if the user is over their limit.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Limiting number of posts Guests can view In reply to
Alex,

I agree that the second approach doesn't sound simple... the first should not be that hard though.

- Check if a person is registerd
- If not, run the thread loop only 5 times
- If yes, run it through

Is that harder than I'm making it sound? Unsure

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] Limiting number of posts Guests can view In reply to
That way might be easier, and could probably be done all in templates. Inside the loop you have:

<%row_num%>

So you could do:

<%ifnot current_user_id%>
<%if row_num > 5%>
Display something saying they need to log in to see all posts.
<%last%>
<%endif%>
<%endif%>

You could do that on the message thread page, as well as the message post page.

Hope that helps,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Limiting number of posts Guests can view In reply to
Thanks Alex. I'll give this one a go and see how it works. It looks like the kind of solution I was looking for though - it's simple to implement and simple to roll-back. Smile

Safe swoops
Sangiro