New function fetchUserData() introduced to API, total rewrite (not all)
[mailer.git] / inc / modules / admin / what-add_points.php
index 91a1c62d7ee6af47829e73202b0c6143824833e0..03546b16d751609971c0f1c1f557900dc339d572 100644 (file)
@@ -83,12 +83,10 @@ if (getRequestElement('userid') == 'all') {
                loadTemplate('admin_add_points_all');
        }
 } elseif (isGetRequestElementSet('userid')) {
-       // User ID found in URL so we use this give him some credits
-       $result = SQL_QUERY_ESC("SELECT `surname`, `family`, `email` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`=%s AND `status`='CONFIRMED' LIMIT 1",
-               array(bigintval(getRequestElement('userid'))), __FILE__, __LINE__);
-       if (SQL_NUMROWS($result) == 1) {
+       // User id found in URL so we use this give him some credits
+       if (fetchUserData(getRequestElement('userid'))) {
                // Selected user does exist
-               $content = SQL_FETCHARRAY($result);
+               $content = getUserDataArray();
 
                if ((isFormSent()) && (isPostRequestElementSet(('points')))) {
                        // Add points and send an email to him...
@@ -117,9 +115,6 @@ if (getRequestElement('userid') == 'all') {
                // User not found!
                loadTemplate('admin_settings_saved', false, "<div class=\"admin_failed\">".sprintf(getMessage('ADMIN_MEMBER_404'), getRequestElement('userid'))."</div>");
        }
-
-       // Free result
-       SQL_FREERESULT($result);
 } else {
        // Output selection form with all confirmed user accounts listed
        addMemberSelectionBox(0, true);