Hello,
How to I can set default preferences in table `users.preferences` when user first login to webmail?
I not found any informations about this.
You can set the default preferences by changing the settings in the main.inc.php.
How? I not see any variables for this.
I'll add this for any user:
'a:1:{s:7:"filters";a:1:{i:0;a:4:{s:10:"whatfilter";s:7:"subject";s:12:"searchstring";s:10:"***spam***";s:10:"destfolder";s:4:"Junk";s:8:"messages";s:3:"all";}}}'
Now I must by script like this:
UPDATE `roundcube`.`users` SET `preferences` = 'a:1:{s:7:"filters";a:1:{i:0;a:4:{s:10:"whatfilter";s:7:"subject";s:12:"searchstring";s:10:"***spam***";s:10:"destfolder";s:4:"Junk";s:8:"messages";s:3:"all";}}}' WHERE `users`.`preferences` = NULL;
It looks like your trying to store preferences for a plugin which probably works differently. Check if the plugin has config file with defaults.
Plugin have not this options.
So, how to add to tuple 'preferences' in roundcube.users something when roundcube init user data in mysql what I want?
Unfortunately 'text' tuple in mysql have not default value :(
I done it like this:
--- rcube_user.php.old 2013-05-16 20:06:31.000000000 +0200
+++ rcube_user.php 2013-06-01 21:01:44.000000000 +0200
@@ -493,12 +493,13 @@
$dbh->query(
"INSERT INTO ".$dbh->table_name('users').
- " (created, last_login, username, mail_host, language)".
- " VALUES (".$dbh->now().", ".$dbh->now().", ?, ?, ?)",
+ " (created, last_login, username, mail_host, language, preferences)".
+ " VALUES (".$dbh->now().", ".$dbh->now().", ?, ?, ?,?)",
strip_newlines($data['user']),
strip_newlines($data['host']),
- strip_newlines($data['language']));
-
+ strip_newlines($data['language']),
+ 'a:1:{s:7:"filters";a:1:{i:0;a:4:{s:10:"whatfilter";s:7:"subject";s:12:"searchstring";s:10:"***spam***";s:10:"destfolder";s:4:"Junk";s:8:"messages";s:3:"all";}}}'
+ );
if ($user_id = $dbh->insert_id('users')) {
// create rcube_user instance to make plugin hooks work
$user_instance = new rcube_user($user_id, array(
In my opinion should be possibility in main.inc.php for this.