[RCD] Override plugin config with user's preferences

A.L.E.C alec at alec.pl
Wed Feb 10 18:56:58 CET 2010


Benjamin Meichsner wrote:
> hey,
> 
> I am using the plugin "automatic_addressbook" (vers. 0.1, RC vers.
> 0.3.1) and everything works fine, except the possibilty for the users to
> override the default configuration.
> 
> I solved the problem, as I manually merged the users preferences with
> the fresh loaded plugin configuration. Like this:
> 
> #automatic_addressbook.php:
> ...
>         $this->load_config('config/config.inc.php.dist');

I think it is useless to load .dist config.

> if(file_exists("./plugins/automatic_addressbook/config/config.inc.php"))
>           $this->load_config('config/config.inc.php');

In svn-trunk version file existing check is not needed, load_config() 
will not generate a warning if file doesn't exists.

          $rcmail = rcmail::get_instance();
>         $config = $rcmail->config;
>         $config->merge($rcmail->user->get_prefs());

And this is not needed. See load_config(), it uses 
rcube_config::load_from_file() with 2nd argument set to false, so user 
preferences will be not overwritten.

-- 
Aleksander 'A.L.E.C' Machniak http://alec.pl gg:2275252
LAN Management System Developer http://lms.org.pl
Roundcube Webmail Developer http://roundcube.net
_______________________________________________
List info: http://lists.roundcube.net/dev/



More information about the Dev mailing list