I'm creating a plugin for community. I use one PRE hook "web_user_home" so that I can have community.cgi?do=whatever...
Obviously this will check if the user is logged-in, and it works fine, but it will not automatically redirect to the page it was trying to get to before, after the login...
return Community::Web::User::user_login();
}
So I figured this borrowed code would work instead...
if (! $user) {
my $url = $CFG->{path_cgi_url} . '?' . $IN->query_string;
my $redirect_url = comm_login_url( return_to => $url );
GT::Plugins->action (STOP);
print $IN->redirect($redirect_url);
return;
}
But no, it just gives an internal server error. It is as if it loops for a second before dying. Any ideas?
I know it doesn't seem like a bid deal, but it has been driving me crazy to figure out what the problem is.
Note: (I have already imported all of my global variables etc.)
Thanks,
- Jonathan
Obviously this will check if the user is logged-in, and it works fine, but it will not automatically redirect to the page it was trying to get to before, after the login...
Code:
unless ($user and $IN->cookie($CFG->{session_cookie_name_session})) { return Community::Web::User::user_login();
}
So I figured this borrowed code would work instead...
Code:
if (! $user) {
my $url = $CFG->{path_cgi_url} . '?' . $IN->query_string;
my $redirect_url = comm_login_url( return_to => $url );
GT::Plugins->action (STOP);
print $IN->redirect($redirect_url);
return;
}
But no, it just gives an internal server error. It is as if it loops for a second before dying. Any ideas?
I know it doesn't seem like a bid deal, but it has been driving me crazy to figure out what the problem is.
Note: (I have already imported all of my global variables etc.)
Thanks,
- Jonathan