Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Authentication / User Management in Silverstripe

Go to End

6 Posts   4686 Views


Community Member, 17 Posts

5 March 2007 at 5:19pm

Hi guys,

Silverstripe has definitely come at the right time for my project -- very exciting how quick it is to develop stuff. The tutorials (1-4) have been of high quality and extremely useful to bootstrap quickly.

However I'm a bit lost when it comes to authentication. My site will require authenticated access and I'm not really sure where first base is on this -- does Silverstripe support authenticated access? I'm assuming so because of the security bits but over that... any clues? Pointers to source at this stage is fine. Things I'm wanting to do:

- add a 'sign up' button taking them to a registration form with email verification
- add a 'login' button which shows a form for a user to log in
- add that login page as an interstitial if someone tries to access premium content -- i.e. they can click on the link but are redirected temporarily to the login page, after successful sign in of which it sends them to the page they wanted to go to.


Newly signed up Silverstripe advocate.


Administrator, 690 Posts

5 March 2007 at 6:26pm

There are tools to help with this, but not something that works out of the box.

I'll get the team to put together a mini-tutorial about this.


Community Member, 33 Posts

6 March 2007 at 12:39am

That would be great Sam!


12 Posts

12 July 2007 at 5:54pm

Hi all,

I stumbled upon SilverStripe today and I think its a great CMS system. However, I'm really hoping to be able to have the ability for User Management - such as described above.

Any progress/tutorials on how to set up SilverStripe to handle "premium" content that is only viewable to registered (and logged in) viewers? With that in mind, I noted something about $LoginForm to create a login form. I wasn't clear whether this leads to the CMS or simply to functions/content that registered users have permission to access.

Any direction would be appreciated! Thanks!


Forum Moderator, 628 Posts

12 July 2007 at 9:12pm

Edited: 13/07/2007 9:20am

Cheers, I hope you're having a good experience so far. You're fortunate that one of our Google Summer of Code projects is adding an intuitive user interface for this, requiring no PHP coding whatsoever, however while this code was recently (as in about two days ago) submitted to us, it won't be ready until the end of the Google Summer of Code project, which is a little over a month away.

One easy way to see you through for the moment would be;

1. create a new page type, such as SecuredPages, in which the init() contains your authentication, which only allows private access to all pages of this type

2. you then add pages on your site as "SecuredPages", and setup a group, and add members to it.

3. Have lots of fun and await the Google Summer of Code real thing :)

Psuedocode for /code/SecuredPages.php

 * Defines the SecuredPage page type
class SecuredPage extends Page {
   static $db = array(
   static $has_one = array(
   static $allowed_children = array(
class SecuredPage_Controller extends Page_Controller {
    function init() {
        if (**loggedInWithTheGroup('intranetUsers')** == false) {
            **Security:permissionfailure();**// look up actual function name

The **** bits are not real, you need to code those :P The "if loggedInWithTheGroup" will actually probably be a few lines, let us know if you can't figure it ... you need to get current member, check isingroup, etc


12 Posts

13 July 2007 at 3:44am

Thanks, Sigurd! I'll give that a whirl and see what I come up with.