- $JOINED_N = " checked"; $JOINED_Y = "";
-
- // Check category selection
- $result_user = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_user_cats WHERE userid=%s AND cat_id=%s 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 = "";
+ $content['jn'] = ' checked="checked"';
+ $content['jy'] = '';
+
+ // When we found an entry don't read it, just change the jx elements
+ if (isPostRequestParameterSet(('cat'))) {
+ // Form sent?
+ if (postRequestParameter('cat', $content['id']) =='Y') {
+ $content['jy'] = ' checked="checked"';
+ $content['jn'] = '';
+ }
+ } 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"';