[evolvis-commits] r15914: Less SQL, more code reuse

mirabilos at evolvis.org mirabilos at evolvis.org
Tue Mar 1 00:39:22 CET 2011


Author: mirabilos
Date: 2011-03-01 00:39:20 +0100 (Tue, 01 Mar 2011)
New Revision: 15914

Modified:
   trunk/gforge_base/evolvisforge-5.1/src/common/include/GroupJoinRequest.class.php
Log:
Less SQL, more code reuse

Modified: trunk/gforge_base/evolvisforge-5.1/src/common/include/GroupJoinRequest.class.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/common/include/GroupJoinRequest.class.php	2011-02-28 23:39:18 UTC (rev 15913)
+++ trunk/gforge_base/evolvisforge-5.1/src/common/include/GroupJoinRequest.class.php	2011-02-28 23:39:20 UTC (rev 15914)
@@ -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 evolvis-commits mailing list