From c1e906cb46859bb1c1b44364f9fa5d4d7cd2f347 Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Sun, 3 Oct 2010 17:15:28 +0200 Subject: [PATCH] Ensure dead users are not displayed in X.net directories. Moreover, since promotion groups are built at 'user addition in db' time, do not show not registered users in this groups. Signed-off-by: Florent Bruneau --- classes/group.php | 12 ++++++++++-- classes/user.php | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/classes/group.php b/classes/group.php index e3f3b62..b5f4500 100644 --- a/classes/group.php +++ b/classes/group.php @@ -21,6 +21,11 @@ class Group { + const CAT_GROUPESX = "GroupesX"; + const CAT_BINETS = "Binets"; + const CAT_PROMOTIONS = "Promotions"; + const CAT_INSTITUTIONS = "Institutions"; + public $id; public $shortname; private $data = array(); @@ -54,9 +59,12 @@ class Group private function getUF($admin = false, $extra_cond = null, $sort = null) { - $cond = new UFC_Group($this->id, $admin); + $cond = new PFC_And(new UFC_Group($this->id, $admin), new PFC_Not(new UFC_Dead())); if (!is_null($extra_cond)) { - $cond = new PFC_And($cond, $extra_cond); + $cond->addChild($extra_cond); + } + if ($this->cat == self::CAT_PROMOTIONS) { + $cond->addChild(new UFC_Registered()); } return new UserFilter($cond, $sort); } diff --git a/classes/user.php b/classes/user.php index 82c41f4..ea182ef 100644 --- a/classes/user.php +++ b/classes/user.php @@ -611,7 +611,7 @@ class User extends PlUser $result = array(); foreach ($this->groups as $id=>$data) { if ($institutions) { - if ($data['cat'] != 'GroupesX' && $data['cat'] != 'Institutions') { + if ($data['cat'] != Goup::CAT_GROUPESX && $data['cat'] != Group::CAT_INSTITUTIONS) { continue; } } -- 2.1.4