[horde] Sharing user information between hooks

Michael J Rubinsky mrubinsk at horde.org
Fri Oct 2 19:14:28 UTC 2015


Quoting Jens Wahnes <wahnes at uni-koeln.de>:

> To customize the user experience, we are using hooks in our Horde
> installation.  Among others, we are using preauth-Hooks both within the
> "horde" scope (.../config/hooks.php) and within the "imp" scope
> (.../imp/config/hooks.php).  So far, these hooks work completely
> independent from each other.  However, we would like to change that and
> access information that has been generated by Horde's preauth hook from
> within IMP's preauth hook.  What is the best way to share such
> information between these hooks?  Should I add some key-value pair to
> the user's session?  If so, how should I go about that?  Should I use
> PHP's $_SESSION variable?  Or is there a preferred way to do that
> through some interface the Horde framework provides?

IIRC, depending on the context, it's possible for the preauth hooks to  
be executed before the session is created, so you may or may not be  
able to utilize the horde session within those hooks. For the record,  
though, you should access the session using the $GLOBALS['session']  
object, not the raw php $_SESSION variable.

>
> BTW, another thing I noticed with the last "pear upgrade" is that the
> .../imp/config/hooks.php file gets overwritten.  This applies to IMP's
> hooks.php only - it does not happen with Horde's hooks
> (.../config/hooks.php).  Is that on purpose or is it a bug?

I don't see how this would be possible. From PEAR's point of view,  
there is no hooks.php file - only hooks.php.dist.


-- 
mike
The Horde Project
http://www.horde.org
https://www.facebook.com/hordeproject
https://www.twitter.com/hordeproject
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5751 bytes
Desc: S/MIME Signature
URL: <http://lists.horde.org/archives/horde/attachments/20151002/eefe4adb/attachment.bin>


More information about the horde mailing list