New function fetchUserData() introduced to API, total rewrite (not all)
[mailer.git] / inc / modules / member / what-html_mail.php
index 462ef4152dc723a55a0f5ab468897b1ee8b8c4d5..278e8b865ba67154420e79bbe51d9af6edce427b 100644 (file)
@@ -59,19 +59,15 @@ if (isFormSent()) {
        loadTemplate('admin_settings_saved', false, getMessage('MEMBER_SETTINGS_SAVED'));
 } else {
        // Load template for changing settings
-       $result = SQL_QUERY_ESC("SELECT `html` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`=%s LIMIT 1",
-               array(getUserId()), __FILE__, __LINE__);
-
-       // Get the mode
-       $content = SQL_FETCHARRAY($result);
-
-       // Free result
-       SQL_FREERESULT($result);
+       if (!fetchUserData(getUserId())) {
+               // Something really bad happened
+               debug_report_bug('No user account ' . getUserId() . ' found.');
+       } // END - if
 
        // Prepare it
        $content['html_y'] = '';
        $content['html_n'] = '';
-       $content['html_' . strtolower($content['html'])] = ' checked="checked"';
+       $content['html_' . strtolower(getUserData('html'))] = ' checked="checked"';
 
        // Load main template
        loadTemplate('member_html_mail_settings', false, $content);