Jump to:

17452 Posts in 4473 Topics by 1971 members


SilverStripe Forums » Archive » So how does a new user register?

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

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

Page: 1 2 3
Go to End
Author Topic: 53652 Views
  • Cy
    Community Member
    11 Posts

    Re: So how does a new user register? Link to this post

    Is a "Register New User" module in the works or possibly a write-up on pulling from the Forum module? I figured out a form to add new users to groups but I am clueless how to include an encrypted password. Is it possible to force a "Forgot Password" for new signups? (solving my "verify email address" problem) Thanks!

  • Sean
    Forum Moderator
    921 Posts

    Re: So how does a new user register? Link to this post

    Member::create_new_password() will generate a password.

    So, you could do something like this, which takes the form data and puts it into a new member instance. This is the submit handler for the doForm action for where you setup your form, which would look something like:

    class RegistrationForm extends Form {

       function __construct($controller, $name) {

          $fields = new FieldSet(
             new TextField('FirstName', 'First name'),
             new EmailField('Email', 'Email address')

          $actions = new FieldSet(
             new FormAction('doForm', 'Submit')

          $validator = new RequiredFields(

          parent::__construct($controller, $name, $fields, $actions, $validator);

       function doForm($data, $form) {

          // Create a new member instance, loading all the form data in
          $member = new Member();

          // Set the member password and write with all the form data collected to DB
          $member->Password = Member::create_new_password();

          $form->sessionMessage('Thanks, you have been signed up!', 'good');


    Hope that helps.

    Generally a module would be great, although it would need to be fairly abstract to allow for all combination of fields that a user can sign up with.


Page: 1 2 3
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.