From 85e4dd49b58eb30cba55efc1b6590dedca6d2d69 Mon Sep 17 00:00:00 2001 From: Anne Limoges Date: Fri, 29 Nov 2013 16:23:59 +0100 Subject: [PATCH] Add user notification when added to xnetgrp by animator. --- configs/mails.conf | 3 +++ modules/xnetgrp.php | 10 +++++++- templates/xnetgrp/forced-subscription.mail.tpl | 35 ++++++++++++++++++++++++++ templates/xnetgrp/membres-add.tpl | 2 +- 4 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 templates/xnetgrp/forced-subscription.mail.tpl diff --git a/configs/mails.conf b/configs/mails.conf index 495cc89..8c060e1 100644 --- a/configs/mails.conf +++ b/configs/mails.conf @@ -67,6 +67,9 @@ from="Carnet Polytechnicien" from="Polytechnique.org" cc=validation+googleapps@polytechnique.org +[xnet_forced_subscription] +from="Gestion des groupes X sur Polytechnique.net" + [xnet_unsubscription] from="Gestion des groupes X sur Polytechnique.net" diff --git a/modules/xnetgrp.php b/modules/xnetgrp.php index 0cafbff..872a180 100644 --- a/modules/xnetgrp.php +++ b/modules/xnetgrp.php @@ -1083,7 +1083,15 @@ class XnetGrpModule extends PLModule Group::subscribe($globals->asso('id'), $user->id()); $this->removeSubscriptionRequest($user->id()); - + if ($user->isActive()) { + $mailer = new PlMailer('xnetgrp/forced-subscription.mail.tpl'); + $mailer->addTo($user->bestEmail()); + $mailer->assign('group', $globals->asso('nom')); + $mailer->assign('anim', S::user()->fullname()); + $mailer->assign('diminutif', $globals->asso('diminutif')); + $mailer->send(); + } + // Check if the group has more than 1000 members, if so, disable the "send mail" function. $full_count = XDB::fetchOneCell('SELECT COUNT(*) FROM group_members diff --git a/templates/xnetgrp/forced-subscription.mail.tpl b/templates/xnetgrp/forced-subscription.mail.tpl new file mode 100644 index 0000000..7523dd4 --- /dev/null +++ b/templates/xnetgrp/forced-subscription.mail.tpl @@ -0,0 +1,35 @@ +{**************************************************************************} +{* *} +{* Copyright (C) 2003-2013 Polytechnique.org *} +{* http://opensource.polytechnique.org/ *} +{* *} +{* This program is free software; you can redistribute it and/or modify *} +{* it under the terms of the GNU General Public License as published by *} +{* the Free Software Foundation; either version 2 of the License, or *} +{* (at your option) any later version. *} +{* *} +{* This program is distributed in the hope that it will be useful, *} +{* but WITHOUT ANY WARRANTY; without even the implied warranty of *} +{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *} +{* GNU General Public License for more details. *} +{* *} +{* You should have received a copy of the GNU General Public License *} +{* along with this program; if not, write to the Free Software *} +{* Foundation, Inc., *} +{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *} +{* *} +{**************************************************************************} + +{config_load file="mails.conf" section="xnet_forced_subscription"} +{if $mail_part eq 'head'} +{from full=#from#} +{to addr="$to"} +{subject text="Inscription au groupe $group"} +{elseif $mail_part eq 'wiki'} +Bonjour, + +Tu viens d'être inscrit au groupe {$group} sur Polytechnique.net par l'animateur de celui-ci, {$anim}. Si tu es opposé à cette inscription, tu peux l'annuler en cliquant [[http://www.polytechnique.net/{$diminutif}/unsubscribe|sur ce lien]]. +{/if} +{include file="include/signature.mail.tpl"} + +{* vim:set et sw=2 sts=2 sws=2: *} diff --git a/templates/xnetgrp/membres-add.tpl b/templates/xnetgrp/membres-add.tpl index f933cd8..56baa3f 100644 --- a/templates/xnetgrp/membres-add.tpl +++ b/templates/xnetgrp/membres-add.tpl @@ -27,7 +27,7 @@
  • Pour ajouter un X dans ton groupe, il suffit d'entrer ici une de ses - adresses email @polytechnique.org. + adresses email @polytechnique.org. Celui-ci sera prévenu de son inscription.
  • S'il s'agit d'un X qui n'est pas inscrit à Polytechnique.org, il faut -- 2.1.4