SSbits - Home page
Site by Carbon Crayon
Submit a Post >

Tutorials - Big bits of code to help you do more

Registering Users and allowing them to edit their details

SSBregister

 Source files (4 KB)  Demo (admin/pass)

These days many sites require users to register to get full functionality (SSbits included!). This is something that although not avaiable out of the box in SilverStripe is quite strait forward and a great way to gain a better understanding of both the Member and Form systems. In this tutorial we are going to create a simple registration form and a page for users to then edit their details.

There are going to be 3 new classes and 2 new templates created in this tutorial, RegistrationPage.php and it's template RegistrationPage.ss, EditProfilePage.php and it's template EditProfilePage.ss and finally MemberDecorator.php which will be used to add fields and methods to the core Member class. Let's first create our starting initial classes:

mysite/code/RegistrationPage.php

<?php 

class RegistrationPage extends Page 
{

}

class RegistrationPage_Controller extends Page_Controller 
{
	
}

mysite/code/EditProfilePage.php 

<?php 

class EditProfilePage extends Page 
{
	
}

class EditProfilePage_Controller extends Page_Controller 
{
	
}

mysite/code/MemberDecorator.php 

<?php
class MemberDecorator extends DataObjectDecorator {

}

An now the 2 templates, RegistrationPage.ss and EditProfilePage.ss. Both will be initially populated with some basic layout markup:

themes/blackcandy/templates/Layout/RegistrationPage.ss   themes/blackcandy/templates/Layout/EditProfilePage.ss

 

<div class="typography">

	<h2>$Title</h2>

</div>

Registration Form

The first thing we are going to do is create a page for users to register with the site. We are going to keep the form as simple as possible to encourage users to register (and keep this tutorial simple!). They will then be able to add details via their profile page. 

So initially let's create a function within our RegistrationPage_Controller class called RegistrationForm() which will generate our Form so that we  can simple call $RegistrationForm from our RegistrationPage.ss template. So here is our RegsitrationPage.php :

 

<?php 

class RegistrationPage extends Page 
{
}

class RegistrationPage_Controller extends Page_Controller 
{
	//Allow our form as an action
	static $allowed_actions = array(
		'RegistrationForm'
	);
	
	//Generate the registration form
	function RegistrationForm()
	{
	    $fields = new FieldSet(
			new TextField('Name', '<span>*</span> Name (or Nickname)'),
			new EmailField('Email', '<span>*</span> Email'),
			new ConfirmedPasswordField('Password', '<span>*</span> Password')
		);
	 	
	    // Create action
	    $actions = new FieldSet(
			new FormAction('doRegister', 'Register')
	    );
		// Create action
		$validator = new RequiredFields('FirstName', 'Email', 'Password');

	 	return new Form($this, 'RegistrationForm', $fields, $actions, $validator);		
	}
}

So if you have been through previous tutorials involving forms (e.g. creating a simple contact form) then there won't be anything new here. Remember to add the Form Function "RegistrationForm" to the static $allowed_actions array in order to allow SilverStripe to call it from the front end.

Now let's add something a little more interesting, the doRegister() function. This will handle our form submission and add the new user to the Database. Just under the RegistrationForm() function add the following:

.
.
.
class RegistrationPage_Controller extends Page_Controller 
{
	.
	.
	.
	//Submit the registration form
	function doRegister($data,$form)
	{
		//Check for existing member email address
		if($member = DataObject::get_one("Member", "`Email` = '". Convert::raw2sql($data['Email']) . "'")) 
		{
			//Set error message
			$form->AddErrorMessage('Email', "Sorry, that email address already exists. Please choose another.", 'bad');
			//Set form data from submitted values
			Session::set("FormInfo.Form_RegistrationForm.data", $data);		
			//Return back to form
			return Director::redirectBack();;			
		}	

		//Otherwise create new member and log them in
		$Member = new Member();
		$form->saveInto($Member);			
		$Member->write();
		$Member->login();
		
		//Find or create the 'user' group
		if(!$userGroup = DataObject::get_one('Group', "Code = 'users'"))
		{
			$userGroup = new Group();
			$userGroup->Code = "users";
			$userGroup->Title = "Users";
			$userGroup->Write();
			$userGroup->Members()->add($Member);
		}
		//Add member to user group
		$userGroup->Members()->add($Member);
		
		//Get profile page
		if($ProfilePage = DataObject::get_one('EditProfilePage'))
		{
		return Director::redirect($ProfilePage->Link('?success=1');
		}
	}	
}

So there will probably be a few unfamiliar things here. The first thing we need to do is check whether the user is trying to register an email address that already exists. We do this by simply trying to fetch a member with the email address that has been submitted. If we find one we know it exists so we add an error to the form, set the values of the fields which have been submitted and then return the user to the form. 

If we get to line 23 then we know that the email address is unique and can go ahead and create the new Member. All we need to do to populate the new Member is call saveInto() on the form object and pass in the $Member object we just created. This is why we love SilverStripe ;) We then log the user in and move on to assigning them a group.

In this example we wan't all our site's users to be in a group called 'Users'. While you could probably get away with assuming it exists it's always good practice to write code that doesn't rely on particular instances existing. So if we can't find the group we create it before adding the member to it by calling Members()->add() on the Group and passing in the $Member object we just created. This is how you can add items to any many_many relation, in this case the relation is 'Members'. The add() funtion will take either a DataObject or an ID. If you wanted to add more than 1 item you could use addMany($Items) instead, passing in an array of IDs or a DataObjectSet. Anyway I digress....

So once the user has registered, we want to pass them over to their new profile page with a nice success message to say they have successfully registered. We do this by grabbing a (soon to be created) EditProfilePage and then redirecting it to that along with a ?success=1 GET var, which we will then use to show a message on that page (see creating a simple contact form for theory behind this).

Now we can simply add $RegistrationForm to our RegistrationPage.ss template like so:

<div class="typography">

	<h2>$Title</h2>

	$Content	
	$RegistrationForm

</div>

Decorating Member

Before we get into creating a page for users to edit their details let's add a couple of fields to the Member object. We do this by decorating the Member object, MemberDecorator.php:

<?php
class MemberDecorator extends DataObjectDecorator {

	//Add extra database fields
	public function extraStatics()
	{	
		return array(
			'db' => array(
				"JobTitle" => 'Varchar',
				"Blurb" => "Text",
				"Website" => "Varchar(100)"
			)
		);
	}
	
	//Add form fields to CMS
	public function updateCMSFields(FieldSet &$fields) 
	{
		$fields->addFieldToTab("Root.Profile", new TextField('JobTitle', 'Job Title')); 		
		$fields->addFieldToTab("Root.Profile", new TextField('Website', 'Website', 'http://')); 		
		$fields->addFieldToTab("Root.Profile", new TextareaField('Blurb', 'Blurb')); 		
	}
}

This is all pretty straitforward stuff for those of you that have used decorators before. If you haven't have a look at working with siteconfig for a good introduction to this concept. Effectively all we are doing here is adding some extra fields (Website, JobTitle and Blurb) to the Member class without having to edit the core file.

To let SilverStripe know that we want to use a decorator on Member, we add this line to our _config.php file:

Object::add_extension('Member', 'MemberDecorator');

Finally run a dev/build to create the new fields in the database.

The Profile Page

In order to allow users to edit their details we need to create a page that has a form with all the fields that we want users to enter on it. This form also needs to be pre-populated with any data they have already entered. So within our EditProfilePage.php: 

<?php 

class EditProfilePage extends Page 
{
}

class EditProfilePage_Controller extends Page_Controller 
{
	static $allowed_actions = array(
		'EditProfileForm'
	);

	function EditProfileForm()
	{
		//Create our fields
	    $fields = new FieldSet(
			new TextField('Name', '<span>*</span> Name (or Nickname)'),
			new EmailField('Email', '<span>*</span> Email'),
			new TextField('JobTitle', 'Job Title'),
			new TextField('Website', 'Website (Without http://)'),
			new TextareaField('Blurb'),
			new ConfirmedPasswordField('Password', 'New Password')
		);
	 	
	    // Create action
	    $actions = new FieldSet(
			new FormAction('SaveProfile', 'Save')
	    );
		
		// Create action
		$validator = new RequiredFields('FirstName', 'Email');
	   
	   //Create form
		$Form = new Form($this, 'EditProfileForm', $fields, $actions, $validator);

		//Populate the form with the current members data
		$Member = Member::CurrentMember();
		$Form->loadDataFrom($Member->data());
		
		//Return the form
		return $Form;
	}
	
	//Save profile
	function SaveProfile($data, $form)
	{
		//Check for a logged in member
		if($CurrentMember = Member::CurrentMember())
		{
			//Check for another member with the same email address
			if($member = DataObject::get_one("Member", "Email = '". Convert::raw2sql($data['Email']) . "' AND ID != " . $CurrentMember->ID)) 
			{
				$form->addErrorMessage("Name", 'Sorry, that Name already exists.', "bad");
					
				Session::set("FormInfo.Form_EditProfileForm.data", $data);
					
				return Director::redirectBack();
			}
			//Otherwise check that user IDs match and save
			else
			{
				$form->saveInto($CurrentMember);	
				
				$CurrentMember->write();

				return Director::redirect($this->Link('?saved=1'));								
			}
		}
		//If not logged in then return a permission error
		else
		{
			return Security::PermissionFailure($this->controller, 'You must <a href="register">registered</a> and logged in to edit your profile:');
		}
	}			
}

The first function here is not too dissimilar to the RegistrationForm() function, we simnply generate a form to display in the template with all the fieldswe want the user to be able to edit. We then pre-populate the form (line 38) using the loadDataFrom() call on the Form object, passing in the serialized data from the current Member, generated by calling data() on the Member object.

The next function, SaveProfile() is also similar to the doRegistration() function, only it simply saves the current members data submitted in the form rather than creating a new member. The first thing we do is check that there is indeed a member logged in. Then we check that their email does not clash with another users, as they could have changed it. Once we have checked this we save the data into the member and return back to the profile page, along with a GET var of '?saved=1' so we can easily display the saved message. If there is no user logged in then we return a permission failure asking the user to login or register.

Now before we create the template for this page there are 2 more functions we need to create. They will check whether we have a particular GET var passed in the URL so that we can create the relevent <% if %> blocks in our template. so let's add these underneath the SaveProfile() function:

.
.
.
class EditProfilePage_Controller extends Page_Controller 
{
	.
	.
	.
	//Check for just saved
	function Saved()
	{
		return $this->request->getVar('saved');
	}
	
	//Check for success status
	function Success()
	{
		return $this->request->getVar('success');
	}			
}

These funtions are pretty self explanitory, if we have a var 'saved' passed in then the Saved() function returns 1. So now in our template we can use <% if Saved %>Saved message<% end_if %> which will display any time the GET var ?saved=1 is passed in the URL.

So here is our EditProfilePage.ss template:

<div class="typography">
	
	<h2>$Title</h2>

	<% if Success %>
	
		<p class="savedMessage">You have successfully registered!</p>
		
		<p>Your details are as follows: </p>
		<% control CurrentMember %>
			<p>
				Name: $Name<br />
				Email: $Email<br />
				Website: <% if Website %>$Website<% else %>Unspecified<% end_if %><br />
				Job Title: <% if JobTitle %>$JobTitle<% else %>Unspecified<% end_if %><br />
				Blurb: <% if Blurb %>$Blurb<% else %>Unspecified<% end_if %>
			</p>
		<% end_control %>	
		
		<a href="$Link">Edit details</a>
	
	<% else %>
	
		<% if Saved %>
			
			<p class="savedMessage">Your profile has been saved!</p>
		
		<% end_if %>	
		
		$EditProfileForm
	
	<% end_if %>

</div>

Now run a dev/build and create a "Registration Page" and an "Edit Profile Page" in the CMS.

The last thing we are going to do is create a persistent part of our template which provides the user with a link to their profile and a link to logout, or a link to login if not logged in. In order to link to the Profile page, we are going to add a Link() function to our member, which will then allow us to use $Link while within the Member in the template (you will see this in use shortly). So in MemberDecorator.php, add this function at the bottom of the class:

<?php
class MemberDecorator extends DataObjectDecorator 
{
	.
	.
	.
	//Link to the edit profile page
	function Link()
	{
		if($ProfilePage = DataObject::get_one('EditProfilePage'))
		{
			return $ProfilePage->Link();
		}
	}
}

 

All we are doing here is grabbing a Profile page and returning a link to it. However the reason we are adding it to the Member object is so that we can do the following in our template; inside our main themes/blackcandy/templates/Page.ss add the following so that it sits just after the <div id="Layout"> tags (as shown below):

.
.
.
<div id="Layout">
	
	<p class="memberLinks">
		<% if CurrentMember %>
			<% control CurrentMember %>
				You are logged in as $Name | <a href="$Link">Edit Profile</a> | <a href="Security/logout">Logout</a>
			<% end_control %>
		<% else %>
			<a href="Security/login">Login</a> | <a href="$Page(register).Link">Register</a>
		<% end_if %>
	</p>

 	 $Layout
	 
</div>
.
.
.

This will then be visible on all the pages, sitting just inside the white content area. The thing to notice is that within the <% control CurrentMember %> loop we simply call $Link to insert the link to the profile page since we have added this function to our Member decorator above.

Obviously this is slightly crudely placed in the template and you would probably want to add this somewhere more appropriate, but it does the job in this example.

And there we have it! A simple user registration system which is easy to extend to perform just as you want it to.

The first thing you could do to extend this is create a separate template for 'viewing' the profile page and 'editing details'. This could be easily achieved using an 'action', like the one using in the DataObjects as Pages tutorials. You could create an 'edit' action which displayed the edit form while the default template simply showed the users details and provided a link to edit them, very much like the SSbits profile page does.

As always if you have any questions, corrections or suggestions please leave them in the comments!

Aram Balakjian avatar

Aram Balakjian

Aram is a web developer running London based agency Aab Web. He has a strong passion for developing attractive, usable sites around the SilverStripe CMS.

  • Martin Pales
    20/12/2010 7:03pm (4 years ago)

    I currently use memberprofiles module written by Andrew Short.
    http://wiki.github.com/ajshort/silverstripe-memberprofiles

    Anyway, thanks for sharing Aram! Very useful.

    Martin

  • Frank Mullenger
    20/12/2010 9:50pm (4 years ago)

    I use the memberprofiles module as well but I think its really useful to see an example of accomplishing the same thing without a module. Especially for people learning silverstripe.

  • MRKDevelopment
    23/12/2010 2:55am (4 years ago)

    This is exactly the type of tutorial that I really enjoy.

    It gives great tips of how to work with the framework and extend the system.

  • Bart van Irsel
    27/12/2010 8:47pm (4 years ago)

    Thanks for this very nice tutorial!

    Results in a easily extensible solution for users managing their own profiles.

  • Jeroen Marechal
    28/12/2010 8:29pm (4 years ago)

    Like Bart mentioned above, a very nice example of a basic member extension!

  • Bart van Irsel
    05/01/2011 9:16am (4 years ago)

    Very small thing i came noticed; when user is on the account edit page and clicks logout the form cannot populate because there is no CurrentMember object.

    Adding this to EditProfilePage.php solved it (probably can be done more elegant as well):

    [code]
    //Populate the form with the current members data
    $Member = Member::CurrentMember();

    // check if Member is object and redirect home if it's not
    if (!is_object($Member))
    return Director::redirect(Director::absoluteBaseURL());

    [/code]

  • Aram Balakjian
    05/01/2011 11:47am (4 years ago)

    Hi Bart, thanks for pointing that out, I think you could also achieve that by setting the Edit Profile pages access to 'logged in users only' from within the CMS, that would mean when they log out on that page, they are sent to the login page. Either way should work :)

  • abyss
    07/01/2011 9:06am (4 years ago)

    Cool stuff thanks again. Nice and simple receipe for adding and managing additional member details for CMS users.

  • cp
    23/01/2011 2:39am (4 years ago)

    How can I make this work with PasswordValidator() that I have set-up in _config.php ? I'm getting an object not written error.

  • Parkpre
    02/02/2011 10:19am (4 years ago)

    Hey all, just having an issue with this....

    When trying to edit a users profile via the 'Edit Profile' button, ForumMemberProfile/show/1 it shows a 'Server Error' page.

    Also the registration page shows, but the $Content isnt showing, thus meaning the Registration form isnt showing.

    Any help would be great, i'll post a link up if that helps too.

  • Aram Balakjian
    02/02/2011 1:32pm (4 years ago)

    Hi Parkpre, have you tried the attached files?

  • Parkpre
    02/02/2011 10:38pm (4 years ago)

    Hi Aram, im back. Had to re-register on here. Luckily it let me use the same Username.

    My problem with the 'edit profile' link can be fixed if i just link direct to the page rather then using the $Link method.

    However the register form not showing on the register page is proving a little more troublesome. It looks like $RegistrationForm isnt pulling the data through.

    I have the "function RegistrationForm()" in the RegistrationPage.php but still nothing. Grrr....

  • Aram Balakjian
    03/02/2011 7:16am (4 years ago)

    Hi Parkpre,

    Could you try the attached source files so that we know if it's an issue in my code or yours ;)

    Sorry you had to rteregister, I think you misspelled your email address the first time round, @yaho.com :)

    Aram

  • Micschk
    25/03/2011 10:04am (4 years ago)

    Hi Aram,

    What would you consider to be a good place to add a hook to send a confirmation email? And how would you do this, call another class for that or add it to one of the existing objects?

  • Micschk
    25/03/2011 4:28pm (4 years ago)

    Small typo causing the form not to be pre-filled when a user gets redirected back upon registering with an existing e-mail address;

    doRegister($data,$form) {
    ...
    // Set form data from submitted values
    Session::set("FormInfo.Form_RegisterForm.data", $data);


    Should be: ..._RegistrationForm.data

  • Shelly
    28/03/2011 1:46am (4 years ago)

    Hi Aram
    I'm getting the same or similar error as Micshik. I've downloaded your code and dropped it in and still getting the same error. When I try to go to the Edit Profile Page either from the Link (after logging in) or after Registering I get the error below. Using SilverStripe v2.4.5 on a WAMP server. Thanks!


    ( ! ) Parse error: syntax error, unexpected '}' in C:\WINDOWS\Temp\silverstripe-cacheC--wamp-www-SSBRegUsers\.cache.themes.mysite.templates.Layout.EditProfilePage.ss on line 97
    Call Stack
    # Time Memory Function Location
    1 0.0006 401616 {main}( ) ..\main.php:0
    2 0.1061 12813496 Director::direct( ) ..\main.php:127
    3 0.1075 12943856 Director::handleRequest( ) ..\Director.php:125
    4 0.1101 13065288 ModelAsController->handleRequest( ) ..\Director.php:282
    5 0.2276 15919616 ContentController->handleRequest( ) ..\ModelAsController.php:67
    6 0.2277 15919648 Controller->handleRequest( ) ..\ContentController.php:199
    7 0.2916 16541040 RequestHandler->handleRequest( ) ..\Controller.php:147
    8 0.2924 16546248 Controller->handleAction( ) ..\RequestHandler.php:143
    9 0.2932 16547704 SSViewer->process( ) ..\Controller.php:202
    10 0.3018

  • Aram Balakjian
    29/03/2011 10:42am (4 years ago)

    @Micschk - Thanks for the typo, post amended. For the email, best place for this is in the doRegister() function. Take a look at the 'Creating a simple contact form' post for some example code to send an email.

    @Shelly - I have tested the code again and it all seems to work for me, are you sure you haven't edited any files as it looks like a syntax error in the template?

  • William Melbourne
    30/03/2011 7:09pm (4 years ago)

    Hi, another good ssbits post.
    I know this is a bit beyond the scope of this tutorial but just wondering if you guys had thought much about the friendship link. I already posted this question in the forums at http://www.silverstripe.org/general-questions/show/15718#post301289 but am interested to see what your opionions are.

    the basic of my thought was how you link members to members. a simple many to many link would be able to determine friend or not. but the link is morec omplicated than that iwth invite, ban, favorite being possible options and it is directional too. I haven't really come across any database operations like this before so not sure best approach. It would be a good community project though so more than happy to input some time into this.

  • Aram Balakjian
    30/03/2011 7:27pm (4 years ago)

    Hi William,

    I think you could so all you mention with a few many_many relations between members and have an invite DO which holds both members and the state of the invite, once being approved it would create the many_many join for friendship.

    If that became limiting then you could create an intermediary DataObject called 'FirendshipLink' or something which would have 2 has_one => member relations and whatever other fields/relations/functions you needed to perform.

    My preference would be with the first way though as it would be much cleaner and more efficient database wise.

    Hope that helps! :)

    Aram

  • William Melbourne
    04/04/2011 11:20pm (4 years ago)

    EDIT:Thanks for the advice Aram. only just noticed the reply. Maybe I am misreading it but I don't see the difference between the two ways?

    The first way is a dataobject called invite which holds both members by having two has_one => member links and the second is a dataobject called friendship linnk with two has_one=>member links. Or are youo suggesting a different way to hold both members in the invite DO?

    Thanks

    Will

  • Aram Balakjian
    05/04/2011 8:30am (4 years ago)

    Hi Will,

    The first one is similar, but the intermediary DO is only used for invites and once approved a direct relationship is created. The second uses an intermediary DO for all related data, even after the friendship has been approved :)

    Aram

  • William Melbourne
    06/04/2011 1:20am (4 years ago)

    interesting, are you suggesting the invite DO would only be temporary and once approved it could be deleted? that does seem simpler for sure

  • Darren-Lee
    09/04/2011 11:33am (4 years ago)

    Nice post, Aram. A great follow-up to this would be a tut in response to @Micschk using the info from this post combined with the info from your 'Creating a simple contact form' post. When I get a moment, I'll test it out and post my first tut ;) Thanks again, dude.

  • Shisuke
    28/05/2011 3:19am (3 years ago)

    Hi Aram, this post was a huge help to me, but I had another question to add onto this. Would it be possible to setup the users to edit a DOM form that you could publish to their profile page as well? I'm working on an idea to allow the users to have their own produced page of info that they store by editing their profile, and the easiest way to get them to fill it out (Because I'm going for a spreadsheet design) would be for there to be the functionality of giving them a DOM that they can add and remove items from. Hope that makes sense.
    Thanks so much for this tutorial, it was fantastic to already help me get a jump start in this idea.

  • ruffo
    14/06/2011 7:56am (3 years ago)

    Hi Aram.. and thanks!!
    this works perfectly for me, but I need something more and I can't figure how I can do it: I need to add on the Form registration a Role option and with this information show a profile page depending of the especific role selected. Is there something can I do? Thanks again (:

    (oh btw... and then make some 'searches' with this info)
    (and sorry for my english, I'm a south american guy)

  • Aram Balakjian
    14/06/2011 2:54pm (3 years ago)

    Hi Ruffo,

    I would probably do this by creating an index() function in the controller which looks at the current users 'role' and serves up a different template using $this->renderWith(array('RoleTemplate', 'Page'); etc.

    Aram

  • Mom Bunheng
    23/08/2011 5:36am (3 years ago)

    Hi
    Is is possible to let them upload photo to there profile?

    Thanks
    Bunheng

  • Kumar Sekhar
    02/12/2011 11:56am (3 years ago)

    Hey Aram,

    Thanks for nice tutorial. Lots of learning, spl for the new SS lovers.

    I am using this above registration code in one of project. I have exactly followed each steps which you have detailed above.

    But when I try to access the registration page using URL http://domain.com/register , It is not working for me. It is giving me "page not found"

    -Kumar Sekhar

  • iSense Daniel
    10/04/2012 2:43am (3 years ago)

    Very much appreciated is this tutorial. Really enjoyed it and learned a lot as a new Silverstriper.

    The error messages appear to the right of the field and I want them to appear above the label.

    I managed to do this with the error messages in the Validator.js file.

    However the error messages we created in the RegistraionPage.php file that appear in green on the form are still appearing to the right.

    Would you be able to tell where I could change this or at least give me some hints as to how I might track this down?

  • john
    07/06/2012 1:04pm (2 years ago)

    I'm trying to do this tut in SS3 but I get this error

    Strict Standards: Declaration of MemberDecorator::updateCMSFields() should be compatible with that of DataExtension::updateCMSFields() in /Applications/MAMP/htdocs/xxxx/mysite/code/MemberDecorator.php on line 10

    Does anyone know what's going on here.

  • kumo99
    07/07/2012 2:16pm (2 years ago)

    I see the password confirm fields show a long dotted value. Can we have blank fields instead?

  • David
    14/09/2012 4:24pm (2 years ago)

    Nice tutorial. I like it how you keep things so simple with minimal code.

    I am currently hitting problems updating the code so that it works in a self-contained module.

    Can you offer any pointers for someone who is using Version 2.4?

  • Aram Balakjian
    14/09/2012 4:31pm (2 years ago)

    Hi David,

    Simply download the source files, they are already in a module :)

    Aram

  • David
    14/09/2012 9:45pm (2 years ago)

    Hi Aram,

    Thank you very much for getting back to me. Yes, I thought the source download looked like a module!

    For some reason the only way I could get the module to work in Version 2.4.7 was to add <% include Login %> to my template instead of adding the code in your last frame. I then added the code in your last frame into a new file called Login.ss which I placed in the module's templates/Includes folder which I also created.

    Regarding the rest of the code, files either sit in the code or the template/Layout folders as arranged in your source files download.

    David.

    PS. Thinking about it there is no reason why I had to put code in your last frame in a separate include file. Perhaps I omitted to do something fundamental when I first tried to run your version. I think this is quite likely.

  • tv
    29/11/2012 12:45pm (2 years ago)

    Just found this. Really had some 'Aha!' moments reading through this. Thanks Aram!

  • helenclarko
    20/02/2013 9:15pm (2 years ago)

    Hi Aram,

    Is this module available for SilverStripe 2.4.5?

    Thanks
    -helenclarko

  • Jonas
    16/04/2013 9:48pm (2 years ago)

    Hey, how are you? I wanted to ask you, how could I modify this tutorial, that it would work on silverstripe v3 ? Realy need to make user registration on my SS site. Thanks in advance.

  • Cacho
    25/04/2013 9:10am (2 years ago)

    Hi Aram, I tried using the code for creating the form on my Home Page and it seems that the default function of SS is breaking my Javascripts on the page. Is there are workaround for this?

  • Anujit
    06/05/2013 9:00am (1 year ago)

    I am a newbie in silverstripe. While implementing your registration and edit profile module, I am getting an error like 'Call to undefined method Member::CurrentMember() in EditProfilePage.php on line 48'. And I couldn't find the CurrentMember method in Method.php file.

    Any idea of the error?

  • Aram Balakjian
    06/05/2013 10:14am (1 year ago)

    Hi Anujit,

    In SS3 you need to use Member::CurrentUser();

    Aram

  • neerom
    28/05/2013 11:15am (1 year ago)

    Please anyone help me on editing profiles for multiform

Post a comment ...

You cannot post comments until you have logged in. Login Here.

Advertisement

Site of the Month

Find SSbits on

Top Contributers

Rank Avatar Name
1 article image Aram Balakjian
2 article image Daniel Hensby
3 article image Marcus Dalgren
4 article image Hamish Campbell
5 article image Ty Barho
6 article image Martijn van Nieuwenhoven
7 article image Darren-Lee
8 article image Roman Schmid
9 article image Matt Clegg
10 article image dalesaurus

View full leaderboard


Advertisement