lat9 / encrypted_master_password

Zen Cart: Encrypted Master Password
GNU General Public License v2.0
1 stars 1 forks source link

New notifier in v155 admin/customers.php #13

Closed drbyte closed 8 years ago

drbyte commented 8 years ago

In v1.5.5 I've added a NOTIFY_ADMIN_CUSTOMERS_MENU_BUTTONS notifier for the buttons section on the customer page. See: https://github.com/zencart/zc-v1-series/pull/817

So, the EMP code for that button can be moved to an admin observer class, which could look like this:

class zcObserverCustomerButtons extends base {

  public function __construct(notifier $zco_notifier = null) {
    if (!$zco_notifier) $zco_notifier = new notifier;
    $this->notifier = $zco_notifier;
    $this->notifier->attach($this, array('NOTIFY_ADMIN_CUSTOMERS_MENU_BUTTONS'));
  }

  // generic update() method for backward compatibility
  public function update(&$class, $eventID, $var, &$contents)
  {
    $this->updateNotifyAdminCustomersMenuButtons($class, $eventID, $var, $contents);
  }

  public function updateNotifyAdminCustomersMenuButtons(&$class, $eventID, $cInfo, &$contents)
  {
// EMP login button logic here, to add to the $contents[] array.

  }

}
lat9 commented 8 years ago

Nice one, DrByte. Once Zen Cart 1.5.5 gets released, I'll make sure to incorporate this change.