[Fusionforge-commits] r12749 - trunk/src/common/include

Roland Mas lolando at fusionforge.org
Mon Mar 14 17:47:27 CET 2011


Author: lolando
Date: 2011-03-14 17:47:26 +0100 (Mon, 14 Mar 2011)
New Revision: 12749

Modified:
   trunk/src/common/include/User.class.php
Log:
Added new optional parameter email to GFUser::update()

Modified: trunk/src/common/include/User.class.php
===================================================================
--- trunk/src/common/include/User.class.php	2011-03-14 16:47:12 UTC (rev 12748)
+++ trunk/src/common/include/User.class.php	2011-03-14 16:47:26 UTC (rev 12749)
@@ -531,9 +531,10 @@
 	 * @param	string	The users title.
 	 * @param	string	The users ccode.
 	 * @param	int	The users preference for tooltips.
+	 * @param	string	The users email.
 	 */
 	function update($firstname, $lastname, $language_id, $timezone, $mail_site, $mail_va, $use_ratings,
-		$jabber_address, $jabber_only, $theme_id, $address, $address2, $phone, $fax, $title, $ccode, $tooltips) {
+			$jabber_address, $jabber_only, $theme_id, $address, $address2, $phone, $fax, $title, $ccode, $tooltips, $email='') {
 		$mail_site = $mail_site ? 1 : 0;
 		$mail_va   = $mail_va   ? 1 : 0;
 		$block_ratings = $use_ratings ? 0 : 1;
@@ -597,28 +598,33 @@
 			$this->setError(_('ERROR - Could Not Update User Object:'). ' ' .db_error());
 			db_rollback();
 			return false;
-		} else {
-			// If there's a transaction from using to not
-			// using ratings, remove all rating made by the
-			// user (ratings by others should not be removed,
-			// as it opens possibility to abuse rate system)
-			if (!$use_ratings && $this->usesRatings()) {
-				db_query_params('DELETE FROM user_ratings WHERE rated_by=$1',
-						 array($user_id));
-			}
-			if (!$this->fetchData($this->getID())) {
-				db_rollback();
-				return false;
-			}
-			
-			$hook_params = array ();
-			$hook_params['user'] = $this;
-			$hook_params['user_id'] = $this->getID();
-			plugin_hook ("user_update", $hook_params);
-			
-			db_commit();
-			return true;
 		}
+
+		if ($email && $email != $this->getEmail()
+		    && !$this->setEmail($email)) {
+			return false;
+		}
+
+		// If there's a transaction from using to not
+		// using ratings, remove all rating made by the
+		// user (ratings by others should not be removed,
+		// as it opens possibility to abuse rate system)
+		if (!$use_ratings && $this->usesRatings()) {
+			db_query_params('DELETE FROM user_ratings WHERE rated_by=$1',
+					array($user_id));
+		}
+		if (!$this->fetchData($this->getID())) {
+			db_rollback();
+			return false;
+		}
+		
+		$hook_params = array ();
+		$hook_params['user'] = $this;
+		$hook_params['user_id'] = $this->getID();
+		plugin_hook ("user_update", $hook_params);
+		
+		db_commit();
+		return true;
 	}
 
 	/**




More information about the Fusionforge-commits mailing list