public function beforeValidate()
 {
     if ($this->isNewRecord) {
         $this->createtime = time();
     }
     return parent::beforeValidate();
 }
 public static function model($className = __CLASS__)
 {
     if (!Yum::module('profile')->enableProfileVisitLogging) {
         return false;
     }
     return parent::model($className);
 }
 public function afterSave()
 {
     // If the user has activated email receiving, send a email
     if ($user = $this->profile->user) {
         if (Yum::hasModule('messages') && $user->privacy && $user->privacy->message_new_profilecomment) {
             Yii::import('application.modules.messages.models.YumMessage');
             YumMessage::write($user, $this->user_id, Yum::t('New profile comment from {username}', array('{username}' => $this->user->username)), YumTextSettings::getText('text_profilecomment_new', array('{username}' => $this->user->username, '{message}' => $this->comment, '{link_profile}' => Yii::app()->controller->createUrl('//profile/profile/view'))));
         }
     }
     return parent::afterSave();
 }
 public function afterSave()
 {
     // If the user has activated email receiving, send a email
     if ($user = $this->profile->user) {
         if (Yum::hasModule('messages') && $user->privacy && $user->privacy->message_new_profilecomment) {
             Yii::import('application.modules.messages.models.YumMessage');
             YumMessage::write($user, $this->user_id, Yum::t('New profile comment from {username}', array('{username}' => $this->user->username)), strtr('A new profile comment has been made from {username}: {message} <br /> <a href="{link_profile}">to my profile</a>', array('{username}' => $this->user->username, '{message}' => $this->comment, '{link_profile}' => Yii::app()->controller->createUrl('//profile/profile/view'))));
         }
     }
     return parent::afterSave();
 }
 public function beforeValidate()
 {
     $this->ignore_users = trim(strtr($this->ignore_users, array(', ' => ',')));
     if (!isset($this->message_new_friendship) || is_null($this->message_new_friendship)) {
         $this->message_new_friendship = true;
     }
     if (!isset($this->message_new_message) || is_null($this->message_new_message)) {
         $this->message_new_message = true;
     }
     if (!isset($this->message_new_profilecomment) || is_null($this->message_new_profilecomment)) {
         $this->message_new_profilecomment = true;
     }
     return parent::beforeValidate();
 }
 /**
  * Returns the static model of the specified AR class.
  * Please note that you should have this exact method in all your CActiveRecord descendants!
  * @param string $className active record class name.
  * @return YumUserTypes the static model class
  */
 public static function model($className = __CLASS__)
 {
     return parent::model($className);
 }
 public function afterSave()
 {
     if (Yum::hasModule('profile') && Yum::module('profile')->enablePrivacySetting) {
         // create a new privacy setting, if not already available
         $setting = YumPrivacySetting::model()->cache(500)->findByPk($this->id);
         if (!$setting) {
             $setting = new YumPrivacySetting();
             $setting->user_id = $this->id;
             $setting->save();
         }
         if ($this->isNewRecord) {
             Yum::log(Yum::t('A user has been created: user: {user}', array('{user}' => json_encode($this->attributes))));
         }
     }
     return parent::afterSave();
 }
 public function beforeValidate()
 {
     $this->jointime = time();
     return parent::beforeValidate();
 }
 public function beforeSave()
 {
     $this->updatetime = time();
     // If the user has activated email receiving, send a email
     if ($this->isNewRecord) {
         if ($user = YumUser::model()->findByPk($this->friend_id)) {
             if (Yum::hasModule('messages') && $user->privacy && $user->privacy->message_new_friendship) {
                 Yii::import('application.modules.messages.models.YumMessage');
                 YumMessage::write($user, $this->inviter, Yum::t('New friendship request from {username}', array('{username}' => $this->inviter->username)), YumTextSettings::getText('text_friendship_new', array('{username}' => $this->inviter->username, '{link_friends}' => Yii::app()->controller->createUrl('//friendship/friendship/index'), '{link_profile}' => Yii::app()->controller->createUrl('//profile/profile/view'), '{message}' => $this->message)));
             }
         }
     }
     return parent::beforeSave();
 }
Example #10
0
 public function beforeDelete()
 {
     if ($this->to_user_id != Yii::app()->user->id) {
         throw new CHttpException(403);
     }
     return parent::beforeDelete();
 }
 public function afterSave()
 {
     return parent::afterSave();
 }
 public function beforeSave()
 {
     $this->updatetime = time();
     // If the user has activated email receiving, send a email
     if ($this->isNewRecord) {
         if ($user = YumUser::model()->findByPk($this->friend_id)) {
             if (Yum::hasModule('message') && $user->privacy && $user->privacy->message_new_friendship) {
                 Yii::import('user.message.models.YumMessage');
                 YumMessage::write($user, $this->inviter, Yum::t('New friendship request from {username}', array('{username}' => $this->inviter->username)), strtr('A new friendship request from {username} has been made: {message} <a href="{link_friends}">Manage my friends</a><br /><a href="{link_profile}">To the profile</a>', array('{username}' => $this->inviter->username, '{link_friends}' => Yii::app()->controller->createUrl('//friendship/friendship/index'), '{link_profile}' => Yii::app()->controller->createUrl('//profile/profile/view'), '{message}' => $this->message)));
             }
         }
     }
     return parent::beforeSave();
 }
 public function afterSave()
 {
     if ($this->isNewRecord) {
         Yii::log(Yum::t('A profile has been created: {profile}', array('{profile}' => json_encode($this->attributes))));
     } else {
         Yii::log(Yum::t('A profile has been updated: {profile}', array('{profile}' => json_encode($this->attributes))));
     }
     return parent::afterSave();
 }