diff --git a/config.inc.php b/config.inc.php index 8a65a476..7554803f 100644 --- a/config.inc.php +++ b/config.inc.php @@ -372,6 +372,11 @@ function maildir_name_hook($domain, $user) { return $struct; # important! } $CONF['admin_struct_hook'] = 'x_struct_admin_modify'; + + You can also use e.g. + $CONF['admin_struct_hook'] = function($struct) { // logic + return $struct; } + ); */ $CONF['admin_struct_hook'] = ''; $CONF['domain_struct_hook'] = ''; diff --git a/model/PFAHandler.php b/model/PFAHandler.php index 9129bc85..82f0e6d9 100644 --- a/model/PFAHandler.php +++ b/model/PFAHandler.php @@ -239,8 +239,9 @@ abstract class PFAHandler ); } + // default *_struct_hooks are empty strings $struct_hook = Config::read($this->db_table . '_struct_hook'); - if (!empty($struct_hook) && is_string($struct_hook) && $struct_hook != 'NO' && function_exists($struct_hook)) { + if (!empty($struct_hook) && $struct_hook != 'NO' && is_callable($struct_hook)) { $this->struct = $struct_hook($this->struct); }