From: Thomas Minvielle Date: Sun, 3 Nov 2013 10:13:36 +0000 (+0100) Subject: Automatically disables the 'send mail' function when reaching 1000 members. X-Git-Tag: xorg/1.1.10~18 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=3d84dcc5127daa206c769642f320e289a6e2815b;p=platal.git Automatically disables the 'send mail' function when reaching 1000 members. --- diff --git a/modules/xnetgrp.php b/modules/xnetgrp.php index 051b0da..9fab4ae 100644 --- a/modules/xnetgrp.php +++ b/modules/xnetgrp.php @@ -1079,6 +1079,20 @@ class XnetGrpModule extends PLModule Group::subscribe($globals->asso('id'), $user->id()); $this->removeSubscriptionRequest($user->id()); + + // 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 + WHERE asso_id = {?}', + $globals->asso('id')); + if ($full_count > 999) { + XDB::execute( + "UPDATE groups + SET disable_mails = 1 + WHERE id = {?}", + $globals->asso('id')); + } + if ($suggest_account_activation) { pl_redirect('member/suggest/' . $user->login() . '/' . $email . '/' . $globals->asso('nom')); } else {