If the user did not explicitly chose its skin, it has to be null.
authorStéphane Jacob <sj@m4x.org>
Fri, 4 Jun 2010 07:14:50 +0000 (09:14 +0200)
committerStéphane Jacob <sj@m4x.org>
Fri, 4 Jun 2010 07:15:33 +0000 (09:15 +0200)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
modules/admin.php
upgrade/account/00_account.sql
upgrade/account/99_insertion.sql

index 3aa7a7c..891602a 100644 (file)
@@ -436,7 +436,7 @@ class AdminModule extends PLModule
             if (Post::i('skin') != $user->skin) {
                 $to_update['skin'] = Post::i('skin');
                 if ($to_update['skin'] == 0) {
-                    $to_update['skin'] = 1;
+                    $to_update['skin'] = null;
                 }
             }
             if (Post::s('state') != $user->state) {
index 65e4608..cc73aea 100644 (file)
@@ -25,7 +25,7 @@ CREATE TABLE accounts (
   display_name varchar(255) default null,
   sex enum('female', 'male') not null default 'male',
   email_format enum('text', 'html') not null default 'html',
-  skin tinyint(1) unsigned not null default 1,
+  skin tinyint(1) unsigned default null,
   last_version varchar(16) not null,
 
   primary key uid (uid),
index d8b920b..b78cb18 100644 (file)
@@ -20,7 +20,7 @@ insert into accounts
             prenom AS display_name,
             IF(FIND_IN_SET('femme', flags), 'female', 'male') AS sex,
             IF(q.core_mail_fmt = 'html', 'html', 'text') AS email_format,
-            IF(q.skin IS NULL OR q.skin = 0, 1, q.skin) AS skin,
+            IF(q.skin = 0, NULL, q.skin) AS skin,
             q.last_version AS last_version
        from #x4dat#.auth_user_md5 as u
   left join #x4dat#.auth_user_quick as q on (q.user_id = u.user_id)