Hey everyone... I'm pretty new but have figured out some things so far... But here is what I want to do... I want to create a HomePage (Via Tutorial) but with a twist... It will include the $loginForm but depending on what group you are affiliated I want it to redirect you to that page... I am using 2.1 for the new access tab.. Can anyone give me an code example to get me started?
Thanks!
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
- Page 11(current)
- 2
- Next 10 entries
Hey there,
I've written up the basic idea here:
http://doc.silverstripe.com/doku.php?id=overriding-loginform
I hope this helps!
Sean
Looks good.... I messed with it after
I got the reponse and had some issues not being able to log out and try another user... And it would not let me log out.... I was having some other issues so it could have been from it but could adding this do that too?
Edit- Nevermind figured it out... But Can you give me some help on what to do in Redirectbygroup ?
I added
Director::redirect($groups[0]);
But it didn't do anything... (Do I need to instatiate the custom form anywhere or does the code just replace the current login?
trying to get the first group it gets but my PHP is on the noob level at best... I'm used to Java VB or LotusScript....
Thanks!
Hi Whizzle,
I finished up the code found on this page:
http://doc.silverstripe.com/doku.php?id=overriding-loginform
It is a little limited in terms of a member being in multiple groups. However, it should work for a basic system.
Let me know how you get on. :-)
Cheers,
Sean
Hi Sean.... I feel like an idiot but I can't seem to implement this... My question is do i need to instantiate this (ie add this to a page some how $loginform etc...) if so can you point me in the right direction... If not for some reason it's not working... I am going to www.foo.com/Security/login and logging in as a test id that is only a member of that group and it logs in just fine but no redirect... I went to the mysql admin and it shows that the group id is 3 and so that is what i put in the customlogin php file... I even put echo "<script>alert('yo')</script>" in the customlogin php file to see if it fires or not (not sure this would work or not but I don't know much about php debugging) and it doesn't seem to fire...\
Thanks for all your help and I apologize for my noob-ness...
Hi there,
Have you ran ?flush=1 at the end of the URL after adding this new file? You need to do this, so that SilverStripe detects the new file and adds it to the class manifest. Also ensure you have Object::useCustomClass('LoginForm', 'CustomLoginForm'); in _config.php which will override any instantiations of LoginForm with your custom one.
Also, please double check the classname is the same as the filename. eg. CustomLoginForm.php is 'class CustomLoginForm extends LoginForm', for example.
I've tested this out and it seemed to work for me. It just might be that you simply need do ?flush=1 on your site.
You could also try adding Debug::show('here'); somewhere in the PHP for the custom login form, so you can see if it's working or not.
Cheers,
Sean
Here is my files and I'm getting nothing.... Thanks for your help
Sorry here is my files
- Page 11(current)
- 2
- Next 10 entries