protected function _publishAndNotify() { // posting on own profile is status change, which is logged separately if ($this->get('user_id') != $this->get('profile_user_id')) { parent::_publishAndNotify(); } if ($this->isInsert() && $this->get('profile_user_id') != $this->get('user_id')) { $this->_alertUser(); } }
protected function _publishAndNotify() { parent::_publishAndNotify(); // send an alert if the message is visible, is not posted on the user's own profile // is an insert, or is an update with message state changed from 'moderated' $isAlertable = $this->get('message_state') == 'visible' && ($this->isInsert() || $this->getExisting('message_state') == 'moderated'); if ($isAlertable) { $alerted = $this->_alertUser(); $maxTagged = $this->getOption(self::OPTION_MAX_TAGGED_USERS); if ($maxTagged && $this->_taggedUsers) { if ($maxTagged > 0) { $alertTagged = array_slice($this->_taggedUsers, 0, $maxTagged, true); } else { $alertTagged = $this->_taggedUsers; } if (!($profileUser = $this->getExtraData(self::DATA_PROFILE_USER))) { $profileUser = $this->_getUserModel()->getUserById($this->get('profile_user_id'), array('join' => XenForo_Model_User::FETCH_USER_FULL)); } $profilePost = $this->getMergedData(); $this->_getProfilePostModel()->alertTaggedMembers($profilePost, $profileUser, $alertTagged, $alerted); } } }