Superfluous SQL query rewritten to getUserData() call
authorRoland Häder <roland@mxchange.org>
Tue, 19 Jul 2011 15:04:10 +0000 (15:04 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 19 Jul 2011 15:04:10 +0000 (15:04 +0000)
inc/daily/daily_user.php
inc/modules/member/what-welcome.php

index 72bb2cf596f830eb98397d89cbf422b0c287578b..99211777ba14add8af3f1fc25f1e283d42320cee 100644 (file)
@@ -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'],
index 637bd6400fdfd96104bb0840be2fda1425218298..534f2f9a388de4b63276fcd236066d9c9b2580a1 100644 (file)
@@ -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');