Zen Follower
- Join Date:
- Jun 2012
- Posts:
- 481
- Plugin Contributions:
- 0
$messageStack->add(...) in observer won't work
I'm writing an observer and need to display an error message under certain conditions. I'm getting a fatal error "Call to a member function add() on null in /includes/classes/observers/class.login_checks.php on line xx". The notifier for this observer is in includes/modules/pages/login/header_php.php (NOTIFY_PROCESS_3RD_PARTY_LOGINS). The logic works perfectly in zc 1.5.1 when the same logic is back in the header_php.php file. The parameters for the add function are not nulls (checked with var_dump). Since zc 1.5.5 has the notifier, I'm trying to move my changes out of this core file and use the observer instead. Code snippet follows:
// notify customer
$error = true;
$messageStack->add('login', LOGIN_VALIDATION_ERROR, 'error');
What does the error mean and how can I fix it?
zc v155f, PHP 5.6