Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Global Request for If Paid link then

Quote Reply
Global Request for If Paid link then
Hi All!

I'm looking for a global that will let users who have a paid link view pages non-paid linkowners can't.

Just for a simple tag placement, not really any integration deeper than that.

<% if linkowner paid see this text%>
Text here
<%else>
all the rest of the stuff here
<%endif%>

Thanks in advance for your help!
Quote Reply
Re: [SSmeredith] Global Request for If Paid link then In reply to
Just thinking in text, but...

sub {
my $tag = shift;
my ($table, $sth);
$table = $DB->table ('Links');
$sth = $table->select ( { LinkOwner => $tag->{Username}, isValidated => 'Yes' }, ['ExpiryDate', 'ExpiryCounted', 'ExpiryNotify'] );

.......... something like that depending on your setup
}

Maybe you could find a way to open the links db, search for the links submitted by the user, and check if the link has been paid (although if the link is free or if is paid for life, it will not expire). It really depends on the exact setup you have.

Another option is to add a field in the user database call isPaid. Write a global that updates the field to yes when a user actually pays.

Just ideas,

(My dentist says think with trident, so I do... or do I?... What?)

- Jonathan
Quote Reply
Re: [SSmeredith] Global Request for If Paid link then In reply to
Do you ever figure this out? I amtrying to do the same thing
Quote Reply
Re: [netnow777] Global Request for If Paid link then In reply to
Hi,

Depending on how you want to invoke it, you could do something like:

Code:
sub {
if ($USER->{Username}) {

my $count = $DB->table('Links')->count( GT::SQL::Condition->new('isValidated','=','Yes','ExpiryDate','>','2147483647') ) || 0;
if ($count) {
return { can_view => 1 }
}
}
}

Then, if you are trying to show a page called test.html (i.e a template called that), you would need this at the top:

Code:
<%global_name%>

<%if can_view%>
...show page here
<%endif%>

..and then when calling via page.cgi?p=test ... it would look for the username (based on their login), and see if any links are paid for (and active).

TOTALLY untested, but should hopefully do the trick :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!