TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 629
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 466
  • Total: 466

[Block] Guest Page View Limit

Started by Thurnok, November 17, 2006, 04:51:03 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Thurnok

@ianus
Yes, TP will allow you to show a block only to guests.  It is a nice feature built right in.  You can basically make that block look any way you please, including HTML code, Javascript code, and php code as necessary.

@haxen
No, unfortunately it will take more code than simply sticking in an IP mask within the array.  Right now a simple in_array() function is used and that simply compares a string to each string in the array.  So it will not match a full IP to an IP with asterisks or dashes and such in it.

Crip

Great block-snippet Thur..
been looking for something like this..I like. :)
I have become comfortably numb!

Cripzone | Crip's Free 2.0.2 Themes



Zetan

I'm just about to try out this script.
Is there a way I can show a center block on the registration page once the page view limit hase been reached, and not before.
I'd like to give an explanation of why a guest has suddenly been redirected to a registration page.


Thurnok

#53
Ok... here's the solution.

- Use the new code in the first post of this thread to replace your existing block code.
- Create an additional Center phpblock (name it something like Registration Welcome)
- Set it to only display for Guests
- Set the "Show for this action (custom action name)" to Register in the pull down menu
- Put the following code into the Registration Welcome phpblock and modify the message info to your liking (note: BBC supported!):


// a regular "Welcome to registration" message for those electing to register on their own
$gpvl_regular_msg = parse_bbc("[b]Welcome to the Registration Page.[/b]\nPlease read the Registration Agreement carefully before signing!");

// the "You have exceeded" registration message for those viewing more pages than allowed as a guest
$gpvl_exceeded_msg = parse_bbc("[b]Welcome to the Registration Page[/b]\nYou have reached this page because you have viewed more pages on this site than is allowed as a guest.  Please register on the site to continue your viewing pleasure.  Make sure you read the Registration Agreement below carefully before signing!");

// did they get here normally (selecting to register) or where they directed by GPVL?
$gpvl_exceed = empty($_GET['gpvl']) ? '' : $_GET['gpvl'];
if (empty($gpvl_exceed)){
echo $gpvl_regular_msg;
} else {
echo $gpvl_exceeded_msg;
}

Zetan

Thanks Thurnok, do you know of a way to edit the Registration Agreement?
I get this message displayed when I view the agreement:

Warning - agreement.txt is not writable, any changes you make will NOT be saved.

Either that, or I'm missing a simple way to edit it, I guess it can be edited from the file on the server.

[Edit]... okay, I didn't realise you were making an edit. Apologies.

RoarinRow

Very cool, thanks for this!  Hopefully we'll have more members than lurkers   ::)

SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

RoarinRow

Quote from: Zetan on March 11, 2007, 12:06:53 AM
Thanks Thurnok, do you know of a way to edit the Registration Agreement?
I get this message displayed when I view the agreement:

Warning - agreement.txt is not writable, any changes you make will NOT be saved.

Either that, or I'm missing a simple way to edit it, I guess it can be edited from the file on the server.

[Edit]... okay, I didn't realise you were making an edit. Apologies.

You have to chom'd that file to 777.  Just right click that file via FTP at the root of your forum, right click and set the permissions to 777.

SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

Zetan

Quote from: RoarinRow on March 11, 2007, 05:12:58 AM
You have to chom'd that file to 777.  Just right click that file via FTP at the root of your forum, right click and set the permissions to 777.

I thought so...


Thank you Thurnok. This is a great snippit.
Either more people will register.. or won't return :P
Not sure which yet. Has anybody found more people register on their site using Thurnocks snippit?

RoarinRow

Thurnok, can I take the excluded IPs further for Yahoo, Google, and MSNbots a step further if I had something like this in the excludeIPs section -

// Set the IPs you want excluded from the limit - like google/spiders etc. in an array - same format as "special" guest array
$gpvl_ExcludeIPs = array('127.0.0.1', '74.*.*.*', '72.*.*.*', '65.*.*.*', '66.*.*.*');

SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

brianjw

Quote from: Zetan on March 11, 2007, 10:52:15 AM
Either more people will register.. or won't return :P
Not sure which yet. Has anybody found more people register on their site using Thurnocks snippit?
Actually, not to bring affense to Thurnok for making this or any people using this but... as a guest browsing some websites. it gets so annoying I just never return. :P

Brianjw

This website is proudly hosted on Crocweb Cloud Website Hosting.