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.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

[solved] Edit Member Profile Page Not Writing to Member


4 Posts   1558 Views


29 September 2009 at 6:50am (Last edited: 30 September 2009 1:55am), Community Member, 528 Posts

I'm trying to create a Page where Members can edit their own profile, but the form doesn't seem to be writing back to the member table.

function UserProfileForm()
      //Get Current Member Info
      $member = $this->CurrentMember();
      //Create Form
      $fields = new FieldSet(
                      new FieldGroup (
                                  new HeaderField('Personal Information', 3),
                                  new TextField('FirstName', 'First Name', $member->FirstName),
                                  new TextField('Surname','Last Name', $member->Surname ),
                                  new EmailField('Email','Email', $member->Email)
                      new FieldGroup (
                                  new HeaderField('Company Information', 3),
                                  new TextField('CompanyName','Company Name', $member->CompanyName),
                                  new TextField('CompanyURL','Company Website', $member->CompanyURL),
                                  new TextField('HomePhone','Company Phone', $member->HomePhone),
                                  new TextField('Address','Address', $member->Address),
                                  new TextField('AddressLine2','Address Line 2', $member->AddressLine2),
                                  new TextField('City','City', $member->City),
                                  new TextField('State','State or Province', $member->State),
                                  new TextField('Country','Country', $member->Country)
      $fields->push(new HiddenField("ID"));
      $actions = new FieldSet(
                        new FormAction('ChangePersonalDetails', 'Update Profile')
      // Create Validators
      $validator = new RequiredFields('FirstName', 'LastName', 'Email');
      return new Form($this, 'ContactForm', $fields, $actions, $validator);
   function ChangePersonalDetails($data,$form)
      $member = $this->CurrentMember();
      $member->FirstName = $data['FirstName'];
      $member->Surname = $data['LastName'];
      $member->Email = $data['Email'];
      $member->CompanyName = $data['ComapnyName'];
      $member->CompanyURL = $data['CompanyURL'];
      $member->HomePhone = $data['HomePhone'];
      $member->Address = $data['Address'];
      $member->AddressLine2 = $data['AddressLine2'];
      $member->City = $data['City'];
      $member->State = $data['State'];
      $member->Country = $data['Country'];
      $member->companyTypeList = $data['companyTypeList'];
      Director::redirect(Director::baseURL(). $this->URLSegment);

Any Suggestions? The

Dave L

29 September 2009 at 11:32pm Community Member, 56 Posts

At a glance...

return new Form($this, 'ContactForm', $fields, $actions, $validator);
return new Form($this, 'UserProfileForm', $fields, $actions, $validator);


Is ChangePersonalDetails getting called?


30 September 2009 at 1:56am Community Member, 528 Posts

Wow Coding before Caffeine not a good idea. LOL Thanks


3 December 2010 at 11:09am Community Member, 4 Posts

I Know that is an old topic but for newbies in SS (like me =)) this module is very useful