[imp] accessing $notify from within a hook

Liam Hoekenga liamr at deathstar.org
Fri Jan 5 09:50:22 PST 2007


So, I'm playing around with IMP's "postlogin" hook, and want the ability 
to display notices based on certain criteria.

This works...

    if (!function_exists('_imp_hook_postlogin')) {
        function _imp_hook_postlogin($actionID, $isLogin)
        {
           $GLOBALS['notification']->push(_("this is a notice"), 
'horde.message');
        }
    }

But, I'd wondered if I should try to use $notify instead of 
$GLOBALS['notify'].  So I tried...

    if (!function_exists('_imp_hook_postlogin')) {
        function _imp_hook_postlogin($actionID, $isLogin)
        {
            require_once HORDE_BASE . '/lib/base.php';
            $notification->push(_("this is a notice"), 'horde.message');
        }
    }

...which sort of looks like it works, but I see this in my error log...

    [Fri Jan 05 12:42:04 2007] [error] [client 141.213.234.109]
            script 
'/usr/local/projects/webmail/html-ssl/horde/mailbox.php' not found or 
unable to stat

I tried adding this...

        @define('IMP_BASE', dirname(__FILE__));
        require_once IMP_BASE . '/lib/base.php';

...which didn't help.

So, my question is, what's the best way to access $notify from within a 
hook?  Is $GLOBALS['notify'] going to work for the foreseeable future, 
or should I make the effort to get $notify into my function's namespace 
(and if so, how do I do it?)?

Liam


More information about the imp mailing list