Events and why using references is so nice
I just checked in a couple changes that fire new events in case of a new account being created. The really nice things is now that event listener have a chance of modifying the account directly without having to change a single line of core code (or globals!).
For example, the following code would change the default authentication status for all new accounts:
class Blocker {
public function onZMCreateAccount($args) {
$account = $args['account'];
$account->setAuthorization(ZM_ACCOUNT_AUTHORIZATION_BLOCKED);
}
}
ZMEvents::instance()->attach(new Blocker());
I guess it couldn’t be any easier than that (other than re-defining the default authentication value ![]()
