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(); }
/** * Activation of an user account. * If everything is set properly, and the emails exists in the database, * and is associated with a correct user, and this user has the status * NOTACTIVE and the given activationKey is identical to the one in the * database then generate a new Activation key to avoid double activation, * set the status to ACTIVATED and save the data * Error Codes: * -1 : User is not inactive, it can not be activated * -2 : Wrong activation key * -3 : Profile found, but no user - database inconsistency? */ public static function activate($email, $key) { Yii::import('application.modules.profile.models.*'); if ($profile = YumProfile::model()->find("email = :email", array(':email' => $email))) { if ($user = $profile->user) { if ($user->status != self::STATUS_INACTIVE) { return -1; } if ($user->activationKey == $key) { $user->activationKey = $user->generateActivationKey(true); $user->status = self::STATUS_ACTIVE; if ($user->save(false, array('activationKey', 'status'))) { Yum::log(Yum::t('User {username} has been activated', array('{username}' => $user->username))); if (Yum::hasModule('messages') && Yum::module('registration')->enableActivationConfirmation) { Yii::import('application.modules.messages.models.YumMessage'); YumMessage::write($user, 1, Yum::t('Your activation succeeded'), strtr('The activation of the account {username} succeeded. Please use <a href="{link_login}">this link</a> to go to the login page', array('{username}' => $user->username, '{link_login}' => Yii::app()->controller->createUrl('//user/user/login')))); } return $user; } } else { return -2; } } else { return -3; } } return false; }
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(); }
/** * Activation of an user account. * If everything is set properly, and the emails exists in the database, * and is associated with a correct user, and this user has the status * NOTACTIVE and the given activationKey is identical to the one in the * database then generate a new Activation key to avoid double activation, * set the status to ACTIVATED and save the data * Error Codes: * -1 : User is not inactive, it can not be activated * -2 : Wrong activation key * -3 : Profile found, but no user - database inconsistency? */ public static function activate($email, $key) { Yii::import('application.modules.profile.models.*'); if ($profile = YumProfile::model()->find("email = :email", array( ':email' => $email)) ) { if ($user = $profile->user) { if ($user->status != self::STATUS_INACTIVE) return -1; if ($user->activationKey == $key) { $user->activationKey = $user->generateActivationKey(true); $user->status = self::STATUS_ACTIVE; if ($user->save(false, array('activationKey', 'status'))) { Yum::log(Yum::t('User {username} has been activated', array( '{username}' => $user->username))); if (Yum::hasModule('messages') && Yum::module('registration')->enableActivationConfirmation ) { Yii::import('application.modules.messages.models.YumMessage'); YumMessage::write($user, 1, Yum::t('Your activation succeeded'), YumTextSettings::getText('text_email_activation', array( '{username}' => $user->username, '{link_login}' => Yii::app()->controller->createUrl('//user/user/login')))); } return $user; } } else return -2; } else return -3; } return false; }
public function sendPaymentConfirmation() { Yii::import('application.modules.message.models.*'); return YumMessage::write($this->user, 1, Yum::t('Payment arrived'), YumTextSettings::getText('text_payment_arrived', array('{payment_date}' => date(Yum::module()->dateTimeFormat, $this->payment_date), '{id}' => $this->id))); }
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 sendPaymentConfirmation () { if(Yum::hasModule('message')) { Yii::import('application.modules.message.models.*'); return YumMessage::write($this->user, 1, Yum::t('Payment arrived'), strtr( 'The payment of order {id} has been arrived at {payment_date}', array( '{payment_date}' => date(Yum::module()->dateTimeFormat, $this->payment_date), '{id}' => $this->id, ))); } }