Fix for marking categories in registration page
authorRoland Häder <roland@mxchange.org>
Fri, 6 Nov 2009 17:23:40 +0000 (17:23 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 6 Nov 2009 17:23:40 +0000 (17:23 +0000)
inc/libs/register_functions.php
inc/mysql-manager.php

index cc4ecae..2c2a4c1 100644 (file)
@@ -89,12 +89,6 @@ function registerGenerateCategoryTable ($mode, $return=false) {
                $SW = 2;
                $OUT .= "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">\n";
                while ($content = SQL_FETCHARRAY($result)) {
-                       // Is the array element not set?
-                       if (!isPostRequestElementSet('cat', $content['id'])) {
-                               // Then set it
-                               setRequestPostElement('cat', array($content['id'] => ''));
-                       } // END - if
-
                        // Prepare array for the template
                        $content = array(
                                'sw'    => $SW,
@@ -104,6 +98,7 @@ function registerGenerateCategoryTable ($mode, $return=false) {
                                'id'    => $content['id'],
                        );
 
+                       // Mark categories
                        if ((postRequestElement('cat', $content['id']) == 'Y') || ((getConfig('register_default') == 'Y') && (!isPostRequestElementSet('cat', $content['id'])))) {
                                $content['def_y'] = ' checked="checked"';
                        } else {
index 2a3f33a..4b7d94c 100644 (file)
@@ -1869,7 +1869,10 @@ function generateCategoryOptionsList ($mode) {
        );
 
        // Get categories
-       $result = SQL_QUERY("SELECT id, cat FROM `{?_MYSQL_PREFIX?}_cats`".$whereStatement." ORDER BY `sort`", __FUNCTION__, __LINE__);
+       $result = SQL_QUERY("SELECT `id`, `cat` FROM `{?_MYSQL_PREFIX?}_cats`".$whereStatement." ORDER BY `sort` ASC",
+               __FUNCTION__, __LINE__);
+
+       // Do we have entries?
        if (SQL_NUMROWS($result) > 0) {
                // ... and begin loading stuff
                while ($content = SQL_FETCHARRAY($result)) {
@@ -1890,7 +1893,9 @@ function generateCategoryOptionsList ($mode) {
 FROM
        `{?_MYSQL_PREFIX?}_user_data`
 WHERE
-       `userid`=%s AND `status`='CONFIRMED' AND `receive_mails` > 0".runFilterChain('exclude_users', $mode)."
+       `userid`=%s AND
+       `status`='CONFIRMED' AND
+       `receive_mails` > 0".runFilterChain('exclude_users', $mode)."
 LIMIT 1",
                                        array(bigintval($ucat)), __FUNCTION__, __LINE__);