Hi all please help.. have no idea what I'm doing wrong
I have standard login redirect
class ExtendedLoginForm extends MemberLoginForm {
public function dologin($data) {
if($this->performLogin($data)) {
$this->redirectByGroup($data);
Director::redirect(Director::baseURL());
} else {
if($badLoginURL = Session::get("BadLoginURL")) {
Director::redirect($badLoginURL);
} else {
Director::redirectBack();
}
}
}
public function redirectByGroup($data)
{
// gets the current member that is logging in
$member = Member::currentUser();
// gets all the groups.
$Groups = DataObject::get("Group");
//cycle through each group
foreach($Groups as $Group)
{
//if the member is in the group and that group has GoToAdmin checked
if($member && $member->inGroup($Group->ID) && $Group->GoToAdmin)
{
////redirect to the admin page
return Director::redirect(Director::baseURL() . 'admin' );
}
//otherwise if the member is in the group and that group has a page linked
else if($member && $member->inGroup($Group->ID) && $Page = $Group->LinkedPage())
{
////direct to that page
return Director::redirect(Director::baseURL() . $Page->URLSegment);
}
}
return false;
}
}
and it works great! if I log in via http://guardian.nimeso/Security/login BUT...
When I put $LoginForm (eg:in homepage.ss) anywhere in the template it doesn't seem to do ANYTHING in ExtendedLoginForm and redirects to http://guardian.nimeso/home/LoginForm and dosn't log me in?
Please someone help? I've wasted 7 hours tryin to sort.
Ta heaps
Jamie