Changeset 6311


Ignore:
Timestamp:
May 24, 2010, 1:18:59 AM (14 years ago)
Author:
plg
Message:

bug 1683 fixed: as soon as an admin modifies the admin>conf>options>guest settings, registration is broken. This is because user_infos.theme/language are emptied (while they should not).

I have also added an "automatic repair" piece of code in get_default_user_info function. This piece of code should be removed for 2.2 with the appropriate migration task.

Location:
branches/2.1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.1/include/functions_user.inc.php

    r6090 r6311  
    797797      unset($cache['default_user']['status']);
    798798      unset($cache['default_user']['registration_date']);
     799
     800      // theme and language fields may be null in the database (see
     801      // bug:1683) This is absolutely not nice to have this code in this
     802      // very place, but it avoids a complexe upgrade with an "automatic
     803      // fix" in the database => this code should be removed after branch
     804      // 2.1 if a migration tasks performs the job the same way
     805      if (empty($cache['default_user']['theme']))
     806      {
     807        mass_updates(
     808          USER_INFOS_TABLE,
     809          array(
     810            'primary' => array('user_id'),
     811            'update'  => array('theme')
     812            ),
     813          array(
     814            array(
     815              'user_id' => $conf['default_user_id'],
     816              'theme' => PHPWG_DEFAULT_TEMPLATE
     817              )
     818            )
     819          );
     820        $cache['default_user']['theme'] = PHPWG_DEFAULT_TEMPLATE;
     821      }
     822     
     823      if (empty($cache['default_user']['language']))
     824      {
     825        mass_updates(
     826          USER_INFOS_TABLE,
     827          array(
     828            'primary' => array('user_id'),
     829            'update'  => array('language')
     830            ),
     831          array(
     832            array(
     833              'user_id' => $conf['default_user_id'],
     834              'language' => PHPWG_DEFAULT_LANGUAGE
     835              )
     836            )
     837          );
     838        $cache['default_user']['language'] = PHPWG_DEFAULT_LANGUAGE;
     839      }
    799840    }
    800841  }
  • branches/2.1/profile.php

    r6276 r6311  
    106106      $_POST['language']
    107107      );
     108    $_POST['theme'] = get_default_theme();
     109    $_POST['language'] = get_default_language();
    108110  }
    109111
Note: See TracChangeset for help on using the changeset viewer.