code/extensions/Ext_Users_Member.php
public function Register($data)
    {
        // If we have passed a confirm password field, clean the
        // data
        if (isset($data["Password"]) && is_array($data["Password"]) && isset($data["Password"]["_Password"])) {
            $data["Password"] = $data["Password"]["_Password"];
        }
        
        $this->owner->update($data);

        // Set verification code for this user
        $this->owner->VerificationCode = sha1(mt_rand() . mt_rand());
        $this->owner->write();

        // Add member to any groups that have been specified
        if (count(Users::config()->new_user_groups)) {
            $groups = Group::get()->filter(
                array(
                "Code" => Users::config()->new_user_groups
                )
            );

            foreach ($groups as $group) {
                $group->Members()->add($this->owner);
                $group->write();
            }
        }

        // Send a verification email, if needed
        if (Users::config()->send_verification_email) {
            $this->owner->sendVerificationEmail();
        }

        // Login (if enabled)
        if (Users::config()->login_after_register) {
            $this->owner->LogIn(isset($data['Remember']));
        }

        return $this->owner;
    }
public function Register($data)
    {
        // If we have passed a confirm password field, clean the
        // data
        if (isset($data["Password"]) && is_array($data["Password"]) && isset($data["Password"]["_Password"])) {
            $data["Password"] = $data["Password"]["_Password"];
        }
        
        $this->owner->update($data);

        // Set verification code for this user
        $this->owner->VerificationCode = sha1(mt_rand() . mt_rand());
        $this->owner->write();

        // Add member to any groups that have been specified
        if (count(Users::config()->new_user_groups)) {
            $groups = Group::get()->filter(
                array(
                "Code" => Users::config()->new_user_groups
                )
            );

            foreach ($groups as $group) {
                $group->Members()->add($this->owner);
                $group->write();
            }
        }

        // Send a verification email, if needed
        if (Users::config()->send_verification_email) {
            $this->owner->sendVerificationEmail();
        }

        // Login (if enabled)
        if (Users::config()->login_after_register) {
            $this->owner->LogIn(isset($data['Remember']));
        }

        return $this->owner;
    }
public function Register ( $ data ) { // If we have passed a confirm password field, clean the // data if ( isset ( $ data [ "Password" ] ) && is_array ( $ data [ "Password" ] ) && isset ( $ data [ "Password" ] [ "_Password" ] ) ) { $ data [ "Password" ] = $ data [ "Password" ] [ "_Password" ] ; } $ this -> owner -> update ( $ data ) ; // Set verification code for this user $ this -> owner -> VerificationCode = sha1 ( mt_rand ( ) . mt_rand ( ) ) ; $ this -> owner -> write ( ) ; // Add member to any groups that have been specified if ( count ( Users :: config ( ) -> new_user_groups ) ) { $ groups = Group :: get ( ) -> filter ( array ( "Code" => Users :: config ( ) -> new_user_groups ) ) ; foreach ( $ groups as $ group ) { $ group -> Members ( ) -> add ( $ this -> owner ) ; $ group -> write ( ) ; } } // Send a verification email, if needed if ( Users :: config ( ) -> send_verification_email ) { $ this -> owner -> sendVerificationEmail ( ) ; } // Login (if enabled) if ( Users :: config ( ) -> login_after_register ) { $ this -> owner -> LogIn ( isset ( $ data [ 'Remember' ] ) ) ; } return $ this -> owner ; }
Register a new user account using the provided data
and then return the current member

@param array $data Array of data to create member from

@return Member
Register a new user account using the provided data and then return the current member