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

Require Registration to view certain categories

Quote Reply
Require Registration to view certain categories
Can this be done!!
I want to redirect the users to the Registration form from specific subcategories, then redirect them back to the same targetted subcategory after they register? so they can view the contents...
thank you in advance..
Mark
Quote Reply
Re: [Mark2] Require Registration to view certain categories In reply to
It can be done.

Method 1:
Use dynamic mode (with page.cgi) and a (POST?) hook on handle_page. Add a column called something like 'RequireLogin' and check against that for whether or not login is required, then check the $USER variable to see if the user is logged in, and redirect to login.cgi if needed.

Method 2:
During registration process (POST hook), create/modify a .htpasswd file for the category.

Just to give you an idea on where to start...

Philip
------------------
Limecat is not pleased.
Quote Reply
Re: [fuzzy logic] Require Registration to view certain categories In reply to
hummm!!! thanks philip... now time to translate to english... or perl ;)
I am running dynamic mode.. but I do not know how to put the POST hook/handle_page... sounds chinese to me..
thanks again
Quote Reply
Re: [Mark2] Require Registration to view certain categories In reply to
the 'hook's are a method used to perform a function before or after the standard code runs, using the plugin system.

Here's another method:

step 1)

create a new global:

Code:
sub {
my $url = $IN->url(absolute => 1, query_string => 1);
my $output = Links::SiteHTML::display("login", { url => $url });
return $output;
}

step 2)
Now in category.html, this MUST be the first line:

Code:
<%if RequireLogin eq "yes"%><%unless Username%><%name_of_global%><%endparse%><%endunless%><%endif%>

You still need to create a yes/no column in the Category table for this though.

Philip
------------------
Limecat is not pleased.
Quote Reply
Re: [fuzzy logic] Require Registration to view certain categories In reply to
Works for "login" very nicely.. thanks much Philip.
I also tried to require registrations instead of login, so I replaced "login" with "signup_form" in the global, and worked fine, but I got the signup_success page after i signup instead of displaying the links right away.
I was wondering if there is a way to redirect to the contents of the category (or supress the signup_success page) so the user gets to the contents right away without seing the confirmation page.
thank you and regards..
Mark