From: Roland Häder <roland@mxchange.org>
Date: Tue, 19 Jul 2011 15:04:10 +0000 (+0000)
Subject: Superfluous SQL query rewritten to getUserData() call
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=93eeb9837b0c73e3e91276a2375aabe82a82ad2d;p=mailer.git

Superfluous SQL query rewritten to getUserData() call
---

diff --git a/inc/daily/daily_user.php b/inc/daily/daily_user.php
index 72bb2cf596..99211777ba 100644
--- a/inc/daily/daily_user.php
+++ b/inc/daily/daily_user.php
@@ -95,7 +95,7 @@ FROM
 	`{?_MYSQL_PREFIX?}_user_points`
 WHERE
 	`userid`=%s AND
-	`locked_points` != 0.00000
+	`locked_points` > 0.00000
 ORDER BY
 	`ref_depth` ASC",
 			array(bigintval($content['userid'])), __FILE__, __LINE__);
@@ -115,7 +115,7 @@ SET
 	`locked_points`=0.00000
 WHERE
 	`userid`=%s AND
-	`ref_depth`=%d
+	`ref_depth`=%s
 LIMIT 1",
 					array(
 						$content['locked_points'],
diff --git a/inc/modules/member/what-welcome.php b/inc/modules/member/what-welcome.php
index 637bd6400f..534f2f9a38 100644
--- a/inc/modules/member/what-welcome.php
+++ b/inc/modules/member/what-welcome.php
@@ -54,11 +54,8 @@ $content = array(
 // Load header template
 loadTemplate('member_welcome_header', false, $content);
 
-// Chedk if he is returning from a profile update notification
-$result = SQL_QUERY_ESC("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `notified`='Y' AND `userid`=%s LIMIT 1",
-	array(getMemberId()), __FILE__, __LINE__);
-
-if ((SQL_NUMROWS($result) == 1) && (isExtensionActive('profile'))) {
+// Check if he is returning from a profile update notification
+if ((getUserData('notified') == 'Y') && (isExtensionActive('profile'))) {
 	// Yes, he is so let's place him his wanted buttons
 	loadTemplate('member_profile_outdated');
 } else {
@@ -66,9 +63,6 @@ if ((SQL_NUMROWS($result) == 1) && (isExtensionActive('profile'))) {
 	loadTemplate('member_welcome');
 }
 
-// Free memory
-SQL_FREERESULT($result);
-
 // Load footer template
 loadTemplate('member_welcome_footer');