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 cc4ecaeb8c36f1cc19b63b16f75ea6fb4d98dd9b..2c2a4c1b04f5e37e32cc03f7590ab11b679cea42 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)) {
                $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,
                        // Prepare array for the template
                        $content = array(
                                'sw'    => $SW,
@@ -104,6 +98,7 @@ function registerGenerateCategoryTable ($mode, $return=false) {
                                'id'    => $content['id'],
                        );
 
                                '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 {
                        if ((postRequestElement('cat', $content['id']) == 'Y') || ((getConfig('register_default') == 'Y') && (!isPostRequestElementSet('cat', $content['id'])))) {
                                $content['def_y'] = ' checked="checked"';
                        } else {
index 2a3f33ac876c4e5cf0460eabe018f32ee98ad01a..4b7d94ccc4e2b8f2f939c4139a0afc07a45fc577 100644 (file)
@@ -1869,7 +1869,10 @@ function generateCategoryOptionsList ($mode) {
        );
 
        // Get categories
        );
 
        // 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)) {
        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
 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__);
 
 LIMIT 1",
                                        array(bigintval($ucat)), __FUNCTION__, __LINE__);