Menu

#425 implementation of get_pref* hooks in db_prefs.php

open
nobody
5
2007-01-18
2007-01-18
No

The attached patch implements the get_pref_override and get_pref hooks in functions/db_prefs.php. This allows the administrator to set local defaults through a plugin instead of modifications to the core.

Here's a quick and dirty example of a "default_prefs" plugin:

<?php

function squirrelmail_plugin_init_default_prefs() {
global $squirrelmail_plugin_hooks;
$squirrelmail_plugin_hooks['get_pref']['default_prefs'] = 'plugin_default_prefs_do';
}

function plugin_default_prefs_do($args) {
$username = $args[0];
$string = $args[1];
if($strings == 'timezone') {
return ('US/Pacific');
}
}

?>

Discussion

  • Wayne Tucker

    Wayne Tucker - 2007-01-18

    patch against functions/db_prefs.php

     
  • Wayne Tucker

    Wayne Tucker - 2007-01-18

    Logged In: YES
    user_id=1695701
    Originator: YES

    Correction to the example plugin, s/strings/string/

     
  • Tomas Kuliavas

    Tomas Kuliavas - 2007-01-19

    Logged In: YES
    user_id=225877
    Originator: NO

    See loading_prefs hook and forced_prefs plugin.

     

Log in to post a comment.