[Fusionforge-commits] r10662 - trunk/src/common/include
Roland Mas
lolando at libremir.placard.fr.eu.org
Fri Sep 24 13:44:18 CEST 2010
Author: lolando
Date: 2010-09-24 13:44:17 +0200 (Fri, 24 Sep 2010)
New Revision: 10662
Modified:
trunk/src/common/include/GroupJoinRequest.class.php
Log:
Less SQL, more code reuse
Modified: trunk/src/common/include/GroupJoinRequest.class.php
===================================================================
--- trunk/src/common/include/GroupJoinRequest.class.php 2010-09-24 11:21:38 UTC (rev 10661)
+++ trunk/src/common/include/GroupJoinRequest.class.php 2010-09-24 11:44:17 UTC (rev 10662)
@@ -106,12 +106,12 @@
}
// Check if user is already a member of the project
- $result = db_query_params ('SELECT * FROM user_group WHERE group_id=$1 AND user_id=$2',
- array ($this->Group->getID(),
- $user_id)) ;
- if (db_numrows($result)) {
- $this->setError(_('You are already a member of this project.'));
- return false;
+ $user = user_get_object ($user_id) ;
+ foreach ($user->getGroups() as $p) {
+ if ($p->getID() == $this->Group->getID()) {
+ $this->setError(_('You are already a member of this project.'));
+ return false;
+ }
}
// Check if user has already submitted a request
More information about the Fusionforge-commits
mailing list