[horde] question on horde identities on_change hook
Jan Schneider
jan at horde.org
Wed Mar 29 10:26:29 UTC 2017
Zitat von Michael Menge <michael.menge at zdv.uni-tuebingen.de>:
> Hi,
>
> I try to write an on_change hook for horde identities/from_addr. My
> goal is to restrict the
> addresses our users can configure in horde/imp to their own
> addresses and variants (plus-addressing).
> The address verification feature ($conf[user][verify_from_addr])
> could work but we don't want to
> allow external addresses and it should be unnecessary to send an
> email as we already know the
> allowed addresses.
>
>
>
> In horde/config/prefs.local.php I have the following function.
>
> $_prefs['from_addr']['on_change'] = function() {
> global $prefs, $registry;
> $data = $GLOBALS['registry']->getAuthInfo();
> $userID=$data['authId'];
> $value=$GLOBALS['prefs']->getValue('identities');
> $value2=$prefs->getValue('from_addr');
> Horde::logMessage("Horde Prefs call on_change for identities:
> ".$userID." value: ".$value." value2: ".$value2);
> myVerifyFunction($userID, $value);
> }
>
> This function is call every time the Identity UI/form is saved.
> But the value retrieved by getValue('identities') still contain the
> old value before the change.
> This is different then the other on_change calls in horde/imp
> prefs.php (e.g. language, use_trash, trash_folder)
> how can I retrieve the new value.
This is because the from_addr preference, as being a part of the
identities preference, won't really get stored. You need to use
on_change hook for the identities preference instead.
Though I'm not sure how you want to achieve what you explained,
because this callback is not used to verify the submitted value of
some sort.
--
Jan Schneider
The Horde Project
https://www.horde.org/
More information about the horde
mailing list