This is the API docs for LemonStand V1, which has been discontinued. LemonStand is now a cloud based platform, available at lemonstand.com.

LemonStand API

cms:onGetCustomerGroupId event

Triggered by Cms_Controller
Author LemonStand eCommerce Inc.

Event handler signature

public int event_onGetCustomerGroupId(Cms_Controller $controller)
$controller Cms_Controller specifies the CMS controller object.
{return} int returns the current customer group identifier.
Allows to override the default current customer group identifier in the front-end requests. The event allows to alter the Cms_Controller::get_customer_group_id() method result, effectively changing the current customer group on the front-end and thus possibly affecting product prices and pages visibility. The handler function should return a customer group identifier or nothing if changing the current customer group is not needed.
Usage example:
public function subscribeEvents()
{
  Backend::$events->addEvent('cms:onGetCustomerGroupId', $this, 'get_customer_group_id');
}

public function get_customer_group_id($controller)
{
  // Do not override the customer group for logged in customers
  if ($controller && $controller->customer)
    return $controller->customer->customer_group_id;

  // Replace the "guest" customer group with some other group
  return 10;
}