SHOW:
|
|
- or go back to the newest paste.
1 | <?php | |
2 | /** | |
3 | * @param $data | |
4 | * @param $form | |
5 | * @return bool|SS_HTTPResponse | |
6 | */ | |
7 | public function SaveProfile($data, $form){ | |
8 | - | switch($data['Status']){ |
8 | + | |
9 | - | case 0: |
9 | + | |
10 | - | $data['Status'] = (int)1; |
10 | + | |
11 | return $this->redirectBack(); | |
12 | } else { | |
13 | // Don't check for empty password here. Instead use ConfirmedPasswordField::setCanBeEmpty | |
14 | // http://api.silverstripe.org/3.1/class-ConfirmedPasswordField.html#_setCanBeEmpty | |
15 | ||
16 | $form->saveInto($CurrentMember); | |
17 | - | }else{ |
17 | + | if($data['Status'] == 0) $CurrentMember->Status = 1; |
18 | - | // If no password don't save the field |
18 | + | |
19 | - | if(!isset($data['password'])){ |
19 | + | |
20 | - | unset($data['password']); |
20 | + | $this->setFlash(_t('EditProfilePage.EmailSuccessText', 'Your account has been updated'), 'success'); |
21 | - | } |
21 | + | |
22 | - | $this->setFlash(_t('EditProfilePage.EmailSuccessText', 'Your account has been updated'), 'success'); |
22 | + | |
23 | }else{ | |
24 | return Security::PermissionFailure($this->controller, 'You must <a href="register">registered</a> and logged in to edit your profile:'); | |
25 | } | |
26 | ||
27 | } |