- LOAD_TEMPLATE("admin_settings_saved", true, CATS_LEAST.": ".$CONFIG['least_cats']);
- }
- // Put some data into constants for the template
- define('__ROWS', ($cats*2+4));
-
- // Load header template
- LOAD_TEMPLATE("member_cats_header");
-
- // Start switching colors and load all visible categories
- $SW = 2;
- while (list($id, $cat) = SQL_FETCHROW($result))
- {
- // Default he has not joined
- $JOINED_N = " checked"; $JOINED_Y = "";
-
- // Check category selection
- $result_user = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_user_cats WHERE userid=%d AND cat_id=%d LIMIT 1",
- array($UID, bigintval($id)), __FILE__, __LINE__);
-
- // When we found an entry don't read it, just change the JOINED_x variables
- if (isset($_POST['cat']))
- {
- if ($_POST['cat'][$id] =='Y') { $JOINED_Y = " checked"; $JOINED_N = ""; }
- }
- else
- {
- if (SQL_NUMROWS($result_user) == 1)
- {
- $JOINED_Y = " checked"; $JOINED_N = "";
- }
-
- // Free memory
- SQL_FREERESULT($result_user);
+ displayMessage('{--CHOOSE_MORE_CATEGORIES--}');
+ } // END - if
+
+ // Load all categories of this member
+ $OUT = '';
+ while ($content = sqlFetchArray($result)) {
+ // Default he has not joined, add color switch
+ $content['jn'] = ' checked="checked"';
+ $content['jy'] = '';
+
+ // When we found an entry don't read it, just change the jx elements
+ if ((isFormSent()) && (isPostRequestElementSet('cat'))) {
+ // Form sent?
+ if (postRequestElement('cat', $content['id']) =='Y') {
+ $content['jy'] = ' checked="checked"';
+ $content['jn'] = '';
+ } // END - if
+ } else {
+ // Check if he has an entry
+ if (countSumTotalData(getMemberId(), 'user_cats', 'id', 'userid', TRUE, sprintf(' AND `cat_id`=%s', bigintval($content['id']))) == 1) {
+ $content['jn'] = '';
+ $content['jy'] = ' checked="checked"';
+ } // END - if