From 7db7d1ad72783bf7650fbb39a0a00a447b0c147a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 6 Nov 2009 17:23:40 +0000 Subject: [PATCH] Fix for marking categories in registration page --- inc/libs/register_functions.php | 7 +------ inc/mysql-manager.php | 9 +++++++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/inc/libs/register_functions.php b/inc/libs/register_functions.php index cc4ecaeb8c..2c2a4c1b04 100644 --- a/inc/libs/register_functions.php +++ b/inc/libs/register_functions.php @@ -89,12 +89,6 @@ function registerGenerateCategoryTable ($mode, $return=false) { $SW = 2; $OUT .= "\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 { diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 2a3f33ac87..4b7d94ccc4 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -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__); -- 2.30.2