Sfoglia il codice sorgente

#281 Groups: email notifications

Alex Trofimov 10 anni fa
parent
commit
d093100723

+ 6 - 4
inc/classes/BxDolConnection.php

@@ -180,10 +180,12 @@ class BxDolConnection extends BxDol implements iBxDolFactoryObject
     {
         if (!$iContent)
             $iContent = bx_process_input($_POST['id'], BX_DATA_INT);
-
-        $a = $this->actionReject($iContent);
-        if (false == $a['err'])
-            return $a;
+        
+        if ($iContent != bx_get_logged_profile_id()) {
+            $a = $this->actionReject($iContent);
+            if (false == $a['err'])
+                return $a;
+        }
 
         return $this->_action ($iInitiator ? $iInitiator : bx_get_logged_profile_id(), $iContent, 'removeConnection', '_sys_conn_err_connection_does_not_exists');
     }

+ 2 - 2
inc/classes/BxDolConnectionQuery.php

@@ -196,10 +196,10 @@ class BxDolConnectionQuery extends BxDolDb
     public function removeConnection ($iInitiator, $iContent)
     {
         if (!($aConnection = $this->getConnection($iInitiator, $iContent))) // connection doesn't exist
-            return false;
+            return true;
 
         $sQuery = $this->prepare("DELETE FROM `" . $this->_sTable . "` WHERE `initiator` = ? AND `content` = ?", $iInitiator, $iContent);
-        if (!$this->query($sQuery))
+        if (!$this->res($sQuery))
             return false;
 
         if (BX_CONNECTIONS_TYPE_MUTUAL == $this->_sType && $aConnection['mutual'])

+ 4 - 1
inc/classes/BxDolGridConnections.php

@@ -81,7 +81,10 @@ class BxDolGridConnections extends BxTemplGrid
         else
             $a = $this->_oConnection->actionReject($iId, $iViewedId);
 
-        return isset($a['err']) && $a['err'] ? false : true;
+        if (isset($a['err']) && $a['err'])
+            return false;
+
+        return true;
     }
 
     protected function _getCellName ($mixedValue, $sKey, $aField, $aRow)

+ 11 - 10
inc/classes/BxDolProfile.php

@@ -363,37 +363,37 @@ class BxDolProfile extends BxDol implements iBxDolProfile
     /**
      * Change profile status to 'Active'
      */
-    public function activate($iAction, $iProfileId = 0)
+    public function activate($iAction, $iProfileId = 0, $bSendEmailNotification = true)
     {
         $sStatus = $this->getStatus($iProfileId);
-        return $this->changeStatus(BX_PROFILE_STATUS_ACTIVE, BX_PROFILE_STATUS_PENDING == $sStatus ? 'approve' : 'activate', $iAction, $iProfileId);
+        return $this->changeStatus(BX_PROFILE_STATUS_ACTIVE, BX_PROFILE_STATUS_PENDING == $sStatus ? 'approve' : 'activate', $iAction, $iProfileId, $bSendEmailNotification);
     }
 
     /**
      * Change profile status from 'Pending' to the next level - 'Active'
      */
-    public function approve($iAction, $iProfileId = 0)
+    public function approve($iAction, $iProfileId = 0, $bSendEmailNotification = true)
     {
-        return $this->changeStatus(BX_PROFILE_STATUS_ACTIVE, 'approve', $iAction, $iProfileId);
+        return $this->changeStatus(BX_PROFILE_STATUS_ACTIVE, 'approve', $iAction, $iProfileId, $bSendEmailNotification);
     }
 
     /**
      * Change profile status to 'Pending'
      */
-    public function disapprove($iAction, $iProfileId = 0)
+    public function disapprove($iAction, $iProfileId = 0, $bSendEmailNotification = true)
     {
-        return $this->changeStatus(BX_PROFILE_STATUS_PENDING, 'disapprove', $iAction, $iProfileId);
+        return $this->changeStatus(BX_PROFILE_STATUS_PENDING, 'disapprove', $iAction, $iProfileId, $bSendEmailNotification);
     }
 
     /**
      * Change profile status to 'Suspended'
      */
-    public function suspend($iAction, $iProfileId = 0)
+    public function suspend($iAction, $iProfileId = 0, $bSendEmailNotification = true)
     {
-        return $this->changeStatus(BX_PROFILE_STATUS_SUSPENDED, 'suspend', $iAction, $iProfileId);
+        return $this->changeStatus(BX_PROFILE_STATUS_SUSPENDED, 'suspend', $iAction, $iProfileId, $bSendEmailNotification);
     }
 
-    protected function changeStatus($sStatus, $sAlertActionName, $iAction, $iProfileId = 0)
+    protected function changeStatus($sStatus, $sAlertActionName, $iAction, $iProfileId = 0, $bSendEmailNotification = true)
     {
         if (!$iProfileId)
             $iProfileId = $this->_iProfileID;
@@ -412,7 +412,8 @@ class BxDolProfile extends BxDol implements iBxDolProfile
         bx_alert('profile', $sAlertActionName, $iProfileId, false, array('action' => $iAction));
 
         // send email to member about status change
-        sendMailTemplate('t_ChangeStatus' . ucfirst($sStatus), $oAccount->id(), $iProfileId, array('status' => $sStatus), BX_EMAIL_SYSTEM);
+        if ($bSendEmailNotification)
+            sendMailTemplate('t_ChangeStatus' . ucfirst($sStatus), $oAccount->id(), $iProfileId, array('status' => $sStatus), BX_EMAIL_SYSTEM);
 
         return true;
     }

+ 2 - 2
inc/utils.inc.php

@@ -243,10 +243,10 @@ function htmlspecialchars_adv( $string )
  */
 function sendMailTemplate($sTemplateName, $iAccountId = 0, $iProfileId = 0, $aReplaceVars = array(), $iEmailType = BX_EMAIL_NOTIFY)
 {
-    $oAccount = BxDolAccount::getInstance($iAccountId);
-
     $oProfile = BxDolProfile::getInstance($iProfileId);
 
+    $oAccount = $iAccountId ? BxDolAccount::getInstance($iAccountId) : ($oProfile ? $oProfile->getAccountObject() : null);
+
     $oEmailTemplates = BxDolEmailTemplates::getInstance();
 
     if (!$oAccount || !$oProfile || !$oEmailTemplates)

+ 2 - 2
modules/base/profile/classes/BxBaseModProfileFormsEntryHelper.php

@@ -88,7 +88,7 @@ class BxBaseModProfileFormsEntryHelper extends BxBaseModGeneralFormsEntryHelper
 
         // change profile to 'pending' only if profile is 'active'
         if (!$this->isAutoApproval() && BX_PROFILE_STATUS_ACTIVE == $aProfileInfo['status'] && !empty($aTrackTextFieldsChanges['changed_fields']))
-            $oProfile->disapprove(BX_PROFILE_ACTION_AUTO);
+            $oProfile->disapprove(BX_PROFILE_ACTION_AUTO, 0, $this->_oModule->serviceActAsProfile());
 
         // create an alert
         bx_alert($this->_oModule->getName(), 'edited', $aContentInfo[$CNF['FIELD_ID']]);
@@ -108,7 +108,7 @@ class BxBaseModProfileFormsEntryHelper extends BxBaseModGeneralFormsEntryHelper
         // approve profile if auto-approval is enabled and profile status is 'pending'
         $sStatus = $oProfile->getStatus();
         if ($sStatus == BX_PROFILE_STATUS_PENDING && $this->isAutoApproval())
-            $oProfile->approve(BX_PROFILE_ACTION_AUTO);
+            $oProfile->approve(BX_PROFILE_ACTION_AUTO, 0, $this->_oModule->serviceActAsProfile());
 
         // set created profile some default membership
         $iAclLevel = !isset($CNF['PARAM_DEFAULT_ACL_LEVEL']) ? MEMBERSHIP_ID_STANDARD : 

+ 2 - 1
modules/base/profile/classes/BxBaseModProfileGridAdministration.php

@@ -110,7 +110,8 @@ class BxBaseModProfileGridAdministration extends BxBaseModGeneralGridAdministrat
     		return false;
 
 		$iAction = BX_PROFILE_ACTION_MANUAL;
-    	return $isChecked ? $oProfile->activate($iAction) : $oProfile->suspend($iAction);
+        $bSendEmailNotification = $this->_oModule->serviceActAsProfile();
+    	return $isChecked ? $oProfile->activate($iAction, 0, $bSendEmailNotification) : $oProfile->suspend($iAction, 0, $bSendEmailNotification);
     }
 
     protected function _getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage)

+ 1 - 1
modules/boonex/groups/classes/BxGroupsAlertsResponse.php

@@ -16,7 +16,7 @@ class BxGroupsAlertsResponse extends BxDolAlertsResponse
 {
     public function response($oAlert)
     {
-        if ('bx_groups_fans' == $oAlert->sUnit && 'connection_added' == $oAlert->sAction && !$oAlert->aExtras['mutual']) {
+        if ('bx_groups_fans' == $oAlert->sUnit && 'connection_added' == $oAlert->sAction) {
             BxDolService::call('bx_groups', 'add_mutual_connection', array($oAlert->aExtras['content'], $oAlert->aExtras['initiator']));
         }
 

+ 1 - 1
modules/boonex/groups/classes/BxGroupsFormsEntryHelper.php

@@ -41,7 +41,7 @@ class BxGroupsFormsEntryHelper extends BxBaseModProfileFormsEntryHelper
         foreach ($aInitialProfiles as $iProfileId) {
             if (!($oProfile = BxDolProfile::getInstance($iProfileId)))
                 continue;
-            $this->_oModule->serviceAddMutualConnection ($oGroupProfile->id(), $oProfile->id(), true);
+            $this->_oModule->serviceAddMutualConnection ($oGroupProfile->id(), $oProfile->id(), true);            
         }
         
         return '';

+ 48 - 5
modules/boonex/groups/classes/BxGroupsGridConnections.php

@@ -105,27 +105,70 @@ class BxGroupsGridConnections extends BxDolGridConnections
      */
     public function performActionFromAdmins()
     {
-        $this->_performActionAdmins('fromAdmins');
+        $this->_performActionAdmins('fromAdmins');        
     }
 
     public function _performActionAdmins($sFunc)
     {
-        list ($iId, $iContentId) = $this->_prepareIds();
+        list ($iId, $iGroupProfileId) = $this->_prepareIds();
 
         if (!$iId) {
             echoJson(array('msg' => _t('_sys_txt_error_occured')));
             exit;
         }
 
-        if (CHECK_ACTION_RESULT_ALLOWED !== $this->_oModule->checkAllowedManageAdmins($iContentId)) {
+        if (CHECK_ACTION_RESULT_ALLOWED !== $this->_oModule->checkAllowedManageAdmins($iGroupProfileId)) {
             echoJson(array('msg' => _t('_sys_txt_access_denied')));
             exit;
         }
     
-        if (!$this->_oModule->_oDb->$sFunc($iContentId, $iId))
+        if (!$this->_oModule->_oDb->$sFunc($iGroupProfileId, $iId)) {
             echoJson(array('msg' => _t('_sys_txt_error_occured')));
-        else
+        } 
+        else {
+
+            $sEmailTemplate = 'toAdmins' == $sFunc ? 'bx_groups_fan_become_admin' : 'bx_groups_admin_become_fan';
+            list($iGroupProfileId, $iProfileId) = $this->_prepareGroupProfileAndMemberProfile($iGroupProfileId, $iId);
+            if (bx_get_logged_profile_id() != $iProfileId) {
+                sendMailTemplate($sEmailTemplate, 0, $iProfileId, array(
+                    'EntryUrl' => BxDolProfile::getInstance($iGroupProfileId)->getUrl(),
+                    'EntryTitle' => BxDolProfile::getInstance($iGroupProfileId)->getDisplayName(),
+                ), BX_EMAIL_NOTIFY);
+            }
+
             echoJson(array('grid' => $this->getCode(false), 'blink' => $iId));
+        }
+    }
+
+    protected function _delete ($mixedId)
+    {
+        list ($iId, $iViewedId) = $this->_prepareIds();
+
+        // send email notification
+        $sEmailTemplate = $this->_oConnection->isConnected($iViewedId, $iId, true) ? 'bx_groups_fan_remove' : 'bx_groups_join_reject';
+        list($iGroupProfileId, $iProfileId) = $this->_prepareGroupProfileAndMemberProfile($iId, $iViewedId);
+        if (bx_get_logged_profile_id() != $iProfileId) {
+            sendMailTemplate($sEmailTemplate, 0, $iProfileId, array(
+                'EntryUrl' => BxDolProfile::getInstance($iGroupProfileId)->getUrl(),
+                'EntryTitle' => BxDolProfile::getInstance($iGroupProfileId)->getDisplayName(),
+            ), BX_EMAIL_NOTIFY);
+        }
+
+        // delete admin associated with profile
+        $this->_oModule->_oDb->deleteAdminsByProfileId($iProfileId);
+
+        return parent::_delete ($mixedId);
+    }
+
+    /**
+     * @return array where first element is group profile id and second element is some other persons profile id
+     */
+    protected function _prepareGroupProfileAndMemberProfile($iId1, $iId2)
+    {
+        if (BxDolProfile::getInstance($iId1)->getModule() == $this->_sContentModule)
+            return array($iId1, $iId2);
+        else
+            return array($iId2, $iId1);
     }
 }
 

+ 60 - 4
modules/boonex/groups/classes/BxGroupsModule.php

@@ -99,17 +99,73 @@ class BxGroupsModule extends BxBaseModProfileModule
 
     public function serviceAddMutualConnection ($iGroupProfileId, $iInitiatorId, $iIgnoreJoinConfirmation = false)
     {        
+        $CNF = &$this->_oConfig->CNF;
+
         if (!($oGroupProfile = BxDolProfile::getInstance($iGroupProfileId)))
             return false;
 
-        $aContentInfo = $this->_oDb->getContentInfoById((int)$oGroupProfile->getContentId());
-        if (!$aContentInfo || (!$iIgnoreJoinConfirmation && $aContentInfo['join_confirmation']))
+        if ($oGroupProfile->getModule() == $this->getName()) {
+            $iProfileId = $iInitiatorId;
+            $iGroupProfileId = $oGroupProfile->id();
+        } else {
+            $iProfileId = $oGroupProfile->id();
+            $iGroupProfileId = $iInitiatorId;
+        }
+
+        if (!($aContentInfo = $this->_oDb->getContentInfoById((int)BxDolProfile::getInstance($iGroupProfileId)->getContentId())))
+            return false;
+
+        if (!($oConnection = BxDolConnection::getObjectInstance($CNF['OBJECT_CONNECTIONS'])))
+            return false;
+
+
+
+        $sEntryTitle = $aContentInfo[$CNF['FIELD_NAME']];
+        $sEntryUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aContentInfo[$CNF['FIELD_ID']]);
+
+        // send invitation to the group
+        if ($iIgnoreJoinConfirmation && !$oConnection->isConnected((int)$iInitiatorId, $oGroupProfile->id()) && !$oConnection->isConnected($oGroupProfile->id(), (int)$iInitiatorId) && bx_get_logged_profile_id() != $iProfileId) {
+            sendMailTemplate('bx_groups_invitation', 0, $iProfileId, array(
+                'InviterUrl' => BxDolProfile::getInstance()->getUrl(),
+                'InviterDisplayName' => BxDolProfile::getInstance()->getDisplayName(),
+                'EntryUrl' => $sEntryUrl,
+                'EntryTitle' => $sEntryTitle,
+            ), BX_EMAIL_NOTIFY);
+        }
+        // send notification to group's admins that new connection is pending confirmation
+        elseif (!$iIgnoreJoinConfirmation && $oConnection->isConnected((int)$iInitiatorId, $oGroupProfile->id()) && !$oConnection->isConnected($oGroupProfile->id(), (int)$iInitiatorId) && $aContentInfo['join_confirmation']) {
+            $aAdmins = $this->_oDb->getAdmins($iGroupProfileId);
+            foreach ($aAdmins as $iAdminProfileId) {
+                sendMailTemplate('bx_groups_join_request', 0, $iAdminProfileId, array(
+                    'NewMemberUrl' => BxDolProfile::getInstance($iProfileId)->getUrl(),
+                    'NewMemberDisplayName' => BxDolProfile::getInstance($iProfileId)->getDisplayName(),
+                    'EntryUrl' => $sEntryUrl,
+                    'EntryTitle' => $sEntryTitle,
+                ), BX_EMAIL_NOTIFY);
+            }
+        }
+        // send notification that join request was accepted
+        else if (!$iIgnoreJoinConfirmation && $oConnection->isConnected((int)$iInitiatorId, $oGroupProfile->id(), true) && $oGroupProfile->getModule() != $this->getName() && bx_get_logged_profile_id() != $iProfileId) {
+            sendMailTemplate('bx_groups_join_confirm', 0, $iProfileId, array(
+                'EntryUrl' => $sEntryUrl,
+                'EntryTitle' => $sEntryTitle,
+            ), BX_EMAIL_NOTIFY);
+        }
+
+
+
+        // don't automatically add back connection (mutual) if group requires manual join confirmation
+        if (!$iIgnoreJoinConfirmation && $aContentInfo['join_confirmation'])
+            return false;
+
+        // check if connection already exists
+        if ($oConnection->isConnected($oGroupProfile->id(), (int)$iInitiatorId, true) || $oConnection->isConnected($oGroupProfile->id(), (int)$iInitiatorId))
             return false;
 
-        if (!($oConnection = BxDolConnection::getObjectInstance($this->_oConfig->CNF['OBJECT_CONNECTIONS'])))
+        if (!$oConnection->addConnection($oGroupProfile->id(), (int)$iInitiatorId))
             return false;
 
-        return $oConnection->addConnection($oGroupProfile->id(), (int)$iInitiatorId);
+        return true;
     }
 
     public function serviceFansTable ()

+ 50 - 0
modules/boonex/groups/install/langs/en.xml

@@ -216,4 +216,54 @@
     <string name="_bx_groups_cat_Causes"><![CDATA[Causes]]></string>
     <string name="_bx_groups_cat_Fun"><![CDATA[Fun]]></string>
     <string name="_bx_groups_cat_Uncategorised"><![CDATA[Uncategorised]]></string>
+
+    <string name="_bx_groups_email_join_request"><![CDATA[Group join request]]></string>
+    <string name="_bx_groups_email_join_request_subject"><![CDATA[Request to join your group]]></string>
+    <string name="_bx_groups_email_join_request_body"><![CDATA[
+<bx_include_auto:_email_header.html />
+<p>New request to join <a href="{EntryUrl}">{EntryTitle}</a> group from <a href="{NewMemberUrl}">{NewMemberDisplayName}</a></p>
+<bx_include_auto:_email_footer.html />]]></string>
+
+    <string name="_bx_groups_email_join_reject"><![CDATA[Group join request was rejected]]></string>
+    <string name="_bx_groups_email_join_reject_subject"><![CDATA[Request to join a group was rejected]]></string>
+    <string name="_bx_groups_email_join_reject_body"><![CDATA[
+<bx_include_auto:_email_header.html />
+<p>Your request to join <a href="{EntryUrl}">{EntryTitle}</a> group was rejected by group admin.</p>
+<bx_include_auto:_email_footer.html />]]></string>
+
+    <string name="_bx_groups_email_join_confirm"><![CDATA[Group join request was confirmed]]></string>
+    <string name="_bx_groups_email_join_confirm_subject"><![CDATA[Your request to join a group was confirmed]]></string>
+    <string name="_bx_groups_email_join_confirm_body"><![CDATA[
+<bx_include_auto:_email_header.html />
+<p>Your request to join <a href="{EntryUrl}">{EntryTitle}</a> group was confirmed by the group admin.</p>
+<bx_include_auto:_email_footer.html />]]></string>
+
+    <string name="_bx_groups_email_fan_remove"><![CDATA[Profile was removed from group fans]]></string>
+    <string name="_bx_groups_email_fan_remove_subject"><![CDATA[Your profile was removed from the group]]></string>
+    <string name="_bx_groups_email_fan_remove_body"><![CDATA[
+<bx_include_auto:_email_header.html />
+<p>Your profile was removed from <a href="{EntryUrl}">{EntryTitle}</a> group by the group admin.</p>
+<bx_include_auto:_email_footer.html />]]></string>
+
+    <string name="_bx_groups_email_fan_become_admin"><![CDATA[Group admin status was granted]]></string>
+    <string name="_bx_groups_email_fan_become_admin_subject"><![CDATA[You are a group admin now]]></string>
+    <string name="_bx_groups_email_fan_become_admin_body"><![CDATA[
+<bx_include_auto:_email_header.html />
+<p>You are an admin of <a href="{EntryUrl}">{EntryTitle}</a> group now.</p>
+<bx_include_auto:_email_footer.html />]]></string>
+
+    <string name="_bx_groups_email_admin_become_fan"><![CDATA[Group admin status was revoked]]></string>
+    <string name="_bx_groups_email_admin_become_fan_subject"><![CDATA[Your group admin status was revoked]]></string>
+    <string name="_bx_groups_email_admin_become_fan_body"><![CDATA[
+<bx_include_auto:_email_header.html />
+<p>Your admin status was revoked from <a href="{EntryUrl}">{EntryTitle}</a> group.</p>
+<bx_include_auto:_email_footer.html />]]></string>
+
+    <string name="_bx_groups_email_invitation"><![CDATA[Invitation to group]]></string>
+    <string name="_bx_groups_email_invitation_subject"><![CDATA[Invitation to "{EntryTitle}" group]]></string>
+    <string name="_bx_groups_email_invitation_body"><![CDATA[
+<bx_include_auto:_email_header.html />
+<p><a href="{InviterUrl}">{InviterDisplayName}</a> invited you to <a href="{EntryUrl}">{EntryTitle} group</a>.</p>
+<bx_include_auto:_email_footer.html />]]></string>
+
 </resources>

+ 52 - 2
modules/boonex/groups/install/langs/ru.xml

@@ -149,8 +149,8 @@
     <string name="_bx_groups_menu_item_title_unfriend_cancel_request"><![CDATA[Отменить запрос о дружбе]]></string>
     <string name="_bx_groups_menu_item_title_unfriend_reject_request"><![CDATA[Отвергнуть запрос о дружбе]]></string>
 
-    <string name="_bx_groups_menu_item_title_system_become_fan"><![CDATA[Присоедениться]]></string>
-    <string name="_bx_groups_menu_item_title_become_fan"><![CDATA[Присоедениться]]></string>
+    <string name="_bx_groups_menu_item_title_system_become_fan"><![CDATA[Присоединиться]]></string>
+    <string name="_bx_groups_menu_item_title_become_fan"><![CDATA[Присоединиться]]></string>
     <string name="_bx_groups_menu_item_title_become_fan_sent"><![CDATA[Присоединение запрошено]]></string>
     <string name="_bx_groups_menu_item_title_become_fan_confirm"><![CDATA[Одобрить присоединение]]></string>
     <string name="_bx_groups_menu_item_title_system_leave_group"><![CDATA[Покинуть группу]]></string>
@@ -215,4 +215,54 @@
     <string name="_bx_groups_cat_Causes"><![CDATA[Движение]]></string>
     <string name="_bx_groups_cat_Fun"><![CDATA[Юмор]]></string>
     <string name="_bx_groups_cat_Uncategorised"><![CDATA[Без категории]]></string>
+
+    <string name="_bx_groups_email_join_request"><![CDATA[Запрос на присоединение к группе]]></string>
+    <string name="_bx_groups_email_join_request_subject"><![CDATA[Запрос на присоединение к группе]]></string>
+    <string name="_bx_groups_email_join_request_body"><![CDATA[
+<bx_include_auto:_email_header.html />
+<p>Получен запрос на присоединение к группе <a href="{EntryUrl}">{EntryTitle}</a> от <a href="{NewMemberUrl}">{NewMemberDisplayName}</a></p>
+<bx_include_auto:_email_footer.html />]]></string>
+
+    <string name="_bx_groups_email_join_reject"><![CDATA[Отклонение запроса на присоединение к группе]]></string>
+    <string name="_bx_groups_email_join_reject_subject"><![CDATA[Ваш запрос на присоединение к группе был отклонен]]></string>
+    <string name="_bx_groups_email_join_reject_body"><![CDATA[
+<bx_include_auto:_email_header.html />
+<p>Ваш запрос на присоединение к группе <a href="{EntryUrl}">{EntryTitle}</a> был отклонен администратором группы.</p>
+<bx_include_auto:_email_footer.html />]]></string>
+
+    <string name="_bx_groups_email_join_confirm"><![CDATA[Одобрение запроса на присоединение к группе]]></string>
+    <string name="_bx_groups_email_join_confirm_subject"><![CDATA[Ваш запрос на присоединение к группе был одобрен]]></string>
+    <string name="_bx_groups_email_join_confirm_body"><![CDATA[
+<bx_include_auto:_email_header.html />
+<p>Ваш запрос на присоединение к группе <a href="{EntryUrl}">{EntryTitle}</a> был одобрен.</p>
+<bx_include_auto:_email_footer.html />]]></string>
+
+    <string name="_bx_groups_email_fan_remove"><![CDATA[Удаление из группы]]></string>
+    <string name="_bx_groups_email_fan_remove_subject"><![CDATA[Вы были удалены из группы]]></string>
+    <string name="_bx_groups_email_fan_remove_body"><![CDATA[
+<bx_include_auto:_email_header.html />
+<p>Ваш профиль был удален из группы <a href="{EntryUrl}">{EntryTitle}</a> администратором группы.</p>
+<bx_include_auto:_email_footer.html />]]></string>
+
+    <string name="_bx_groups_email_fan_become_admin"><![CDATA[Получение статуса администратора группы]]></string>
+    <string name="_bx_groups_email_fan_become_admin_subject"><![CDATA[Вы стали администратором группы]]></string>
+    <string name="_bx_groups_email_fan_become_admin_body"><![CDATA[
+<bx_include_auto:_email_header.html />
+<p>Вы получили статус администратора группы <a href="{EntryUrl}">{EntryTitle}</a>.</p>
+<bx_include_auto:_email_footer.html />]]></string>
+
+    <string name="_bx_groups_email_admin_become_fan"><![CDATA[Лишение статуса администратора группы]]></string>
+    <string name="_bx_groups_email_admin_become_fan_subject"><![CDATA[Вы были лишены статуса администратора группы]]></string>
+    <string name="_bx_groups_email_admin_become_fan_body"><![CDATA[
+<bx_include_auto:_email_header.html />
+<p>Вы были лишены статуса администратора группы <a href="{EntryUrl}">{EntryTitle}</a></p>
+<bx_include_auto:_email_footer.html />]]></string>
+
+    <string name="_bx_groups_email_invitation"><![CDATA[Приглашение в группу]]></string>
+    <string name="_bx_groups_email_invitation_subject"><![CDATA[Приглашение в группу "{EntryTitle}"]]></string>
+    <string name="_bx_groups_email_invitation_body"><![CDATA[
+<bx_include_auto:_email_header.html />
+<p><a href="{InviterUrl}">{InviterDisplayName}</a> пригласил Вас в группу <a href="{EntryUrl}">{EntryTitle}</a>.</p>
+<bx_include_auto:_email_footer.html />]]></string>
+
 </resources>

+ 4 - 0
modules/boonex/groups/install/sql/disable.sql

@@ -52,3 +52,7 @@ DELETE FROM `sys_alerts_handlers` WHERE `id` = @iHandler;
 
 DELETE FROM `sys_objects_privacy` WHERE `object` = 'bx_groups_allow_view_to';
 
+-- EMAIL TEMPLATES
+
+DELETE FROM `sys_email_templates` WHERE `Module` = 'bx_groups';
+

+ 11 - 0
modules/boonex/groups/install/sql/enable.sql

@@ -371,3 +371,14 @@ INSERT INTO `sys_alerts` (`unit`, `action`, `handler_id`) VALUES
 INSERT INTO `sys_objects_privacy` (`object`, `module`, `action`, `title`, `default_group`, `table`, `table_field_id`, `table_field_author`, `override_class_name`, `override_class_file`) VALUES
 ('bx_groups_allow_view_to', 'bx_groups', 'view', '_bx_groups_form_profile_input_allow_view_to', '3', 'bx_groups_data', 'id', 'author', 'BxGroupsPrivacy', 'modules/boonex/groups/classes/BxGroupsPrivacy.php');
 
+-- EMAIL TEMPLATES
+
+INSERT INTO `sys_email_templates` (`Module`, `NameSystem`, `Name`, `Subject`, `Body`) VALUES
+('bx_groups', '_bx_groups_email_join_request', 'bx_groups_join_request', '_bx_groups_email_join_request_subject', '_bx_groups_email_join_request_body'),
+('bx_groups', '_bx_groups_email_join_reject', 'bx_groups_join_reject', '_bx_groups_email_join_reject_subject', '_bx_groups_email_join_reject_body'),
+('bx_groups', '_bx_groups_email_join_confirm', 'bx_groups_join_confirm', '_bx_groups_email_join_confirm_subject', '_bx_groups_email_join_confirm_body'),
+('bx_groups', '_bx_groups_email_fan_remove', 'bx_groups_fan_remove', '_bx_groups_email_fan_remove_subject', '_bx_groups_email_fan_remove_body'),
+('bx_groups', '_bx_groups_email_fan_become_admin', 'bx_groups_fan_become_admin', '_bx_groups_email_fan_become_admin_subject', '_bx_groups_email_fan_become_admin_body'),
+('bx_groups', '_bx_groups_email_admin_become_fan', 'bx_groups_admin_become_fan', '_bx_groups_email_admin_become_fan_subject', '_bx_groups_email_admin_become_fan_body'),
+('bx_groups', '_bx_groups_email_invitation', 'bx_groups_invitation', '_bx_groups_email_invitation_subject', '_bx_groups_email_invitation_body');
+