Add user notification when added to xnetgrp by animator.
authorAnne Limoges <anne.limoges_git@polytechnique.org>
Fri, 29 Nov 2013 15:23:59 +0000 (16:23 +0100)
committerAnne Limoges <anne.limoges_git@polytechnique.org>
Tue, 3 Dec 2013 08:02:59 +0000 (09:02 +0100)
configs/mails.conf
modules/xnetgrp.php
templates/xnetgrp/forced-subscription.mail.tpl [new file with mode: 0644]
templates/xnetgrp/membres-add.tpl

index 495cc89..8c060e1 100644 (file)
@@ -67,6 +67,9 @@ from="Carnet Polytechnicien" <support_carnet@polytechnique.org>
 from="Polytechnique.org" <support@polytechnique.org>
 cc=validation+googleapps@polytechnique.org
 
+[xnet_forced_subscription]
+from="Gestion des groupes X sur Polytechnique.net" <support@polytechnique.org>
+
 [xnet_unsubscription]
 from="Gestion des groupes X sur Polytechnique.net" <support@polytechnique.org>
 
index 0cafbff..872a180 100644 (file)
@@ -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 (file)
index 0000000..7523dd4
--- /dev/null
@@ -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: *}
index f933cd8..56baa3f 100644 (file)
@@ -27,7 +27,7 @@
   <ul class='descr'>
     <li>
       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.
     </li>
     <li>
       S'il s'agit d'un X qui n'est pas inscrit à Polytechnique.org, il faut