<?xml version="1.0"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Page comments</title>
		<link>http://www.ssbits.com/home/</link>
		<atom:link href="http://www.ssbits.com/home/" rel="self" type="application/rss+xml" />
		<description></description>

		
		<item>
			<title></title>
			<link>http://www.ssbits.com/tutorials/2009/custom-login-form-with-group-based-redirection/#PageComment_1251</link>
			<description>Hello all,
i also had the &quot;already redirected&quot; error. i modified the redirectByGroup function a little bit. that works for me - just made sure the function really returns true/false and used $Page-&gt;URLSegment in the end. maybe it will help someone as well:

public function redirectByGroup($data) {   
        // gets the current member that is logging in
        $retValue = false;
        $member = Member::currentUser();
         
        // gets all the groups.
        $Groups = DataObject::get(&quot;Group&quot;);
         
        //cycle through each group  
        foreach($Groups as $Group)
        {
            //if the member is in the group and that group has GoToAdmin checked
            if($member &amp;&amp; $member-&gt;inGroup($Group-&gt;ID) &amp;&amp; $Group-&gt;GoToAdmin) 
            {   
                //redirect to the admin page
                //print_r(Director::baseURL() . 'admin' );
                //exit();
                Director::redirect(Director::baseURL() . 'admin' );
                $retValue = true;
            }
            //otherwise if the member is in the group and that group has a page linked
            elseif($member &amp;&amp; $member-&gt;inGroup($Group-&gt;ID)  &amp;&amp; $Page = $Group-&gt;LinkedPage()) 
            {   
                //direct to that page
                //print_r(Director::baseURL() . $Page-&gt;Link());
                //exit();
                Director::redirect(Director::baseURL() . $Page-&gt;URLSegment);     
                $retValue = true;         
            }
        }
        return $retValue;
    }


cheers, florian</description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/tutorials/2009/custom-login-form-with-group-based-redirection/#PageComment_1251</guid>
		</item>
		
		<item>
			<title></title>
			<link>http://www.ssbits.com/tutorials/2009/custom-login-form-with-group-based-redirection/#PageComment_1243</link>
			<description>I had the same problem with the double redirects &amp; redirects not working, so i've modifed the code. i've only tested it on mamp but it works for admin login, custom page login and incorrect logins. I haven't tested it if the custom page login is more than one level deep. E.g. mysite.com.au/members/membershome/

&lt;code&gt;
class CustomLoginForm extends MemberLoginForm {
	public function dologin($data) {
		if($this-&gt;performLogin($data)) {

			$url = $this-&gt;redirectByGroup($data);
			if ($url) {
				Director::redirect($url);
			} else {
				if($badLoginURL = Session::get(&quot;BadLoginURL&quot;)) {
					Director::redirect($badLoginURL);
				} else {
					Director::redirectBack();
				}
			}
		} else {
			Director::redirectBack();
		}
	}

	public function redirectByGroup($data) {
		$member = Member::currentUser();
		$Groups = DataObject::get(&quot;Group&quot;);

		foreach($Groups as $Group) {
			if($member &amp;&amp; $member-&gt;inGroup($Group-&gt;ID) &amp;&amp; $Group-&gt;GoToAdmin) {
				return Director::baseURL() . 'admin' ;

			} elseif($member &amp;&amp; $member-&gt;inGroup($Group-&gt;ID)  &amp;&amp; $Page = $Group-&gt;LinkedPage()) {
				return $Page-&gt;Link();

			}
		}

		return false;
	}
}
&lt;/code&gt;</description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/tutorials/2009/custom-login-form-with-group-based-redirection/#PageComment_1243</guid>
		</item>
		
		<item>
			<title></title>
			<link>http://www.ssbits.com/tutorials/2009/custom-login-form-with-group-based-redirection/#PageComment_662</link>
			<description>Hi Aram...

I have the same problem with ryeze, I tried to set up a user when he logs in directly accessing the about-us. I want to: localhost / domains / about-us but the result is: localhost / domain / / domain / about-us

Please Help, Thanks Before...

nofelapen</description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/tutorials/2009/custom-login-form-with-group-based-redirection/#PageComment_662</guid>
		</item>
		
		<item>
			<title></title>
			<link>http://www.ssbits.com/tutorials/2009/custom-login-form-with-group-based-redirection/#PageComment_661</link>
			<description>hi Aram

I've tried your custom login, but when trying something strange happened. I create a user group, I want to redirect them to a page about us. but what happened instead they link to http://localhost/slhdsilver//slhdsilver/about-us/, when they should link to http://localhost/slhdsilver/about-us/. please me. thanks.</description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/tutorials/2009/custom-login-form-with-group-based-redirection/#PageComment_661</guid>
		</item>
		
		<item>
			<title></title>
			<link>http://www.ssbits.com/tutorials/2009/custom-login-form-with-group-based-redirection/#PageComment_506</link>
			<description>@Thomas - 

I'm new at this, so this may not be the best way to do it, but I was having the same problem, and got it to work with this:

&lt;code&gt;
                // direct to that page
                Director::redirect(Director::baseURL().$Page-&gt;URLSegment);
&lt;/code&gt;
</description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/tutorials/2009/custom-login-form-with-group-based-redirection/#PageComment_506</guid>
		</item>
		
		<item>
			<title></title>
			<link>http://www.ssbits.com/tutorials/2009/custom-login-form-with-group-based-redirection/#PageComment_414</link>
			<description>Discovered today that putting the following in _config.php is also very handy for redirecting all users to a different website part when logging in. 

Security::set_default_login_dest('urlsegment');</description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/tutorials/2009/custom-login-form-with-group-based-redirection/#PageComment_414</guid>
		</item>
		
		<item>
			<title></title>
			<link>http://www.ssbits.com/tutorials/2009/custom-login-form-with-group-based-redirection/#PageComment_410</link>
			<description>Hi Aram,

Sorry for the late response. I did some testing on this issue on a current project.  It seems there is no effect, if the userlanguage ist set to default or not.Additional i've tried to change the site wide language by using i18n::set_locale('de_DE');. No effect! 

Unlike the project in october the admin redirection works fine. But the redirection of the usergroup ends in a servererror. Because the baseURL is missing on the retrurned URL (looks like http://service/downloads/costumer1/). 

It seems this line of Code wont work: return Director::redirect(Director::baseURL() . $Page-&gt;Link()); . Any Idea?
</description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/tutorials/2009/custom-login-form-with-group-based-redirection/#PageComment_410</guid>
		</item>
		
		<item>
			<title></title>
			<link>http://www.ssbits.com/tutorials/2009/custom-login-form-with-group-based-redirection/#PageComment_324</link>
			<description>I'm having the same problem as Jonas.  </description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/tutorials/2009/custom-login-form-with-group-based-redirection/#PageComment_324</guid>
		</item>
		
		<item>
			<title></title>
			<link>http://www.ssbits.com/tutorials/2009/custom-login-form-with-group-based-redirection/#PageComment_321</link>
			<description>Hi, 
I get an error when putting this into the _config.php
Object::add_extension('Group', 'GroupDecorator');

when doing a dev/build it says : 
Fatal error: Object::add_extension() - Can't find extension class for &quot;GroupDecorator&quot; in ......./sapphire/core/Object.php on line 526

any ideas? typos? 
</description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/tutorials/2009/custom-login-form-with-group-based-redirection/#PageComment_321</guid>
		</item>
		
		<item>
			<title></title>
			<link>http://www.ssbits.com/tutorials/2009/custom-login-form-with-group-based-redirection/#PageComment_154</link>
			<description>Hi Jamie,

try using $MemberLoginForm in your template instead

Aram</description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/tutorials/2009/custom-login-form-with-group-based-redirection/#PageComment_154</guid>
		</item>
		

	</channel>
</rss>