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

Re: [Michael_Bray] Members_Access plug in question

Quote Reply
Re: [Michael_Bray] Members_Access plug in question In reply to
Code:

# work out if they are allowed to access this detailed page...
sub check_restrict_detail_page {
my ($page, $id, $link, $detail_match, $detail_name);
my (@ids,@locked);
$page = $IN->param('g') || $ENV{PATH_INFO} || '';
($id) = $page =~ /(\d+)\Q$CFG->{build_extension}\E$/;
if (!$id) {
print $IN->header();
print Links::SiteHTML::display('error', { error => Links::language('PAGE_INVALIDDETAIL', $page) });
return;
}

if ($DEBUG) {
print $IN->header();
print $id;
exit;
}
# grab the category in questions details....
($ids[0],$locked[0]) = $DB->table('Links')->select( ['ID','Restricted_Page'], GT::SQL::Condition->new('ID','=',"$id%") )->fetchrow;
# the current detailed page they are on requires them to be logged in.
if ($locked[0] && !$USER->{Username}) {
print $IN->header();
print Links::SiteHTML::display('error', { error => $ErrorMessage } );
exit;
}
}
# Always end with a 1.
1;


Added a new column to the Links table called Restricted_Page. Works for me. Feedback would be great.
Cheers,
Michael Bray

Last edited by:

Michael_Bray: Mar 7, 2009, 2:52 AM
Subject Author Views Date
Thread Members_Access plug in question katabd 7312 Feb 28, 2009, 10:07 PM
Thread Re: [katabd] Members_Access plug in question
Andy 7203 Mar 1, 2009, 5:21 AM
Thread Re: [Andy] Members_Access plug in question
Michael_Bray 7184 Mar 6, 2009, 11:50 PM
Thread Re: [Michael_Bray] Members_Access plug in question
Michael_Bray 7147 Mar 7, 2009, 12:12 AM
Thread Re: [Michael_Bray] Members_Access plug in question
Michael_Bray 7135 Mar 7, 2009, 1:54 AM
Post Re: [Michael_Bray] Members_Access plug in question
Andy 7125 Mar 7, 2009, 4:15 AM
Thread Re: [Michael_Bray] Members_Access plug in question
katabd 7087 Mar 9, 2009, 9:09 AM
Thread Re: [katabd] Members_Access plug in question
Andy 7093 Mar 9, 2009, 9:16 AM
Thread Re: [Andy] Members_Access plug in question
katabd 7036 Mar 11, 2009, 7:28 PM
Thread Re: [katabd] Members_Access plug in question
Andy 7024 Mar 12, 2009, 4:40 AM
Post Re: [Andy] Members_Access plug in question
Andy 6956 Mar 16, 2009, 12:38 AM