From: <sy...@us...> - 2008-01-30 19:34:40
|
Update of /cvsroot/tikiwiki/tiki/lib In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv31109/lib Modified Files: Tag: BRANCH-1-10 userslib.php Log Message: [FIX]tracker: pick the user tracker of the Registered group is no other group has a user tracker Index: userslib.php =================================================================== RCS file: /cvsroot/tikiwiki/tiki/lib/userslib.php,v retrieving revision 1.247.2.17 retrieving revision 1.247.2.18 diff -u -d -r1.247.2.17 -r1.247.2.18 --- userslib.php 30 Jan 2008 16:45:30 -0000 1.247.2.17 +++ userslib.php 30 Jan 2008 19:34:41 -0000 1.247.2.18 @@ -1573,28 +1573,23 @@ } function get_tracker_usergroup($user) { - $result = $this->get_user_default_group($user); - $ret = ''; - $userTrackerId = $ret; - if (!is_null($result)) { - $ret = $this->get_usertrackerid($result); - if ($ret) { - $userTrackerId = $ret; - } + $userTrackerId = ''; + $group = $this->get_user_default_group($user); + if (!empty($group)) { + $userTrackerId = $this->get_usertrackerid($group); } if (!$userTrackerId) { $groups = $this->get_user_groups($user); - foreach ($groups as $gr) { - if ($gr != "Anonymous" and $gr != "Registered") { - $ret = $this->get_usertrackerid($gr); - if ($ret) { - $userTrackerId = $ret; - break; - } - } + $query = 'select `groupName`, `usersTrackerId` from `users_groups` where `groupName` in ('.implode(',',array_fill(0,count($groups),'?')).') and `groupName` != ? and `usersTrackerId` > 0'; + $groups[] = 'Anonymous'; + $result = $this->query($query, $groups); + while ($res = $result->fetchRow()) { + $userTrackerId = $res['usersTrackerId']; + if ($res['groupName'] != 'Registered') + return $userTrackerId ; } } - return $ret; + return $userTrackerId; } function get_grouptrackerid($group) { |