6.0.0-beta1
8/17/25

[#13185] Get access to current set of addresses in vacation_addresses() hook
Summary Get access to current set of addresses in vacation_addresses() hook
Queue Ingo
Queue Version Git master
Type Enhancement
State Resolved
Priority 1. Low
Owners jan (at) horde (dot) org
Requester skhorde (at) smail (dot) inf (dot) fh-bonn-rhein-sieg (dot) de
Created 05/14/2014 (4113 days ago)
Due
Updated 05/19/2014 (4108 days ago)
Assigned
Resolved 05/19/2014 (4108 days ago)
Milestone
Patch Yes

History
05/19/2014 08:38:33 AM Jan Schneider Assigned to Jan Schneider
State ⇒ Resolved
Version ⇒ Git master
 
05/19/2014 08:38:29 AM Git Commit Comment #2 Reply to this comment
Changes have been made in Git (master):

commit f996a72fd11b836a77a4b44d1262be2b625c7dbc
Author: Jan Schneider <jan@horde.org>
Date:   Mon May 19 10:38:00 2014 +0200

     [jan] Pass current vacation addresses to hook 
(skhorde@smail.inf.fh-bonn-rhein-sieg.de, Request #13185).

  ingo/config/hooks.php.dist    |    8 +++++++-
  ingo/docs/CHANGES             |    2 ++
  ingo/lib/Storage/Vacation.php |    2 +-
  ingo/package.xml              |    4 ++--
  4 files changed, 12 insertions(+), 4 deletions(-)

http://github.com/horde/horde/commit/f996a72fd11b836a77a4b44d1262be2b625c7dbc
05/14/2014 02:21:01 PM skhorde (at) smail (dot) inf (dot) fh-bonn-rhein-sieg (dot) de Comment #1
Priority ⇒ 1. Low
New Attachment: h5_ingo-hook-vacation_addresses.diff.bz2 Download
Patch ⇒ Yes
Milestone ⇒
Queue ⇒ Ingo
Summary ⇒ Get access to current set of addresses in vacation_addresses() hook
Type ⇒ Enhancement
State ⇒ New
Reply to this comment
Maybe related to bug #10764

When you enable this hook, the returned array overrides the addresses 
on save and each time the form is opened. I found no way to get the 
current set of addresses, which the user had modified probably.

Attached patch changes the interface of the hook function to pass the 
current value, just like the pref_init() hook does.

Now you can return defaults, if no addresses are available already, 
but keep that existing set otherwise:
//        // Example #2: Keep user-supplied values, return defaults only
//        return is_array($value) && count($array)
//         ? $value
//         : array($user . '@example.com', $user . '@foobar.com');

Because now you have both the user-modified set and the set of the 
administrator (well, the default one), the hook can keep user-supplied 
entries, add new ones or remove ones.

Saved Queries