/** * {@inheritDoc} * @return boolean */ public function beforeSave() { $beforeSave = parent::beforeSave(); if ($this->profile->get('email') == '*****@*****.**') { $this->profile->set('email', ''); } return $beforeSave; }
public function beforeSave() { $user =& $this->object; if ($this->getProperty('use_captcha') && !$user->SocialProfiles) { $this->checkCaptcha(); } $ok = parent::beforeSave(); if ($ok !== true) { return $ok; } $profile =& $this->profile; $profile->fromArray(array("fullname" => $this->getProperty('fullname'))); // else $validator = new modWebSocietyUsersValidator($this); $ok = $validator->validate(); if ($ok !== true) { return $ok; } # print '<pre>'; // Добавляем сразу все типы уведомлений $notices = array(); foreach ($this->modx->getCollection('SocietyNoticeType', ["active" => '1']) as $noticeType) { $notice = $this->modx->newObject('SocietyNoticeUser'); $notice->NoticeType = $noticeType; # print_r($notice->toArray()); $notices[] = $notice; } $user->Notices = $notices; # print_r($user->toArray()); # # return "Ведутся работы"; /* print_r($this->properties); print $activate_link; */ # return "Debug"; return true; }