Skip to content

Commit

Permalink
Execute displayAdminLogin hook without shop context
Browse files Browse the repository at this point in the history
  • Loading branch information
idnovate authored and PierreRambaud committed Jul 24, 2019
1 parent 913c4c8 commit f386832
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions classes/Hook.php
Expand Up @@ -602,7 +602,7 @@ public static function getHookModuleExecList($hook_name = null)
{
$context = Context::getContext();
$cache_id = self::MODULE_LIST_BY_HOOK_KEY . (isset($context->shop->id) ? '_' . $context->shop->id : '') . ((isset($context->customer)) ? '_' . $context->customer->id : '');
if (!Cache::isStored($cache_id) || $hook_name == 'displayPayment' || $hook_name == 'displayPaymentEU' || $hook_name == 'paymentOptions' || $hook_name == 'displayBackOfficeHeader') {
if (!Cache::isStored($cache_id) || $hook_name == 'displayPayment' || $hook_name == 'displayPaymentEU' || $hook_name == 'paymentOptions' || $hook_name == 'displayBackOfficeHeader' || $hook_name == 'displayAdminLogin') {
$frontend = true;
$groups = array();
$use_groups = Group::isFeatureActive();
Expand All @@ -625,7 +625,7 @@ public static function getHookModuleExecList($hook_name = null)
$sql = new DbQuery();
$sql->select('h.`name` as hook, m.`id_module`, h.`id_hook`, m.`name` as module');
$sql->from('module', 'm');
if ($hook_name != 'displayBackOfficeHeader') {
if ($hook_name != 'displayBackOfficeHeader' && $hook_name != 'displayAdminLogin') {
$sql->join(Shop::addSqlAssociation('module', 'm', true, 'module_shop.enable_device & ' . (int) Context::getContext()->getDevice()));
$sql->innerJoin('module_shop', 'ms', 'ms.`id_module` = m.`id_module`');
}
Expand All @@ -648,7 +648,7 @@ public static function getHookModuleExecList($hook_name = null)
}
}
}
if (Validate::isLoadedObject($context->shop)) {
if (Validate::isLoadedObject($context->shop) && $hook_name != 'displayAdminLogin') {
$sql->where('hm.`id_shop` = ' . (int) $context->shop->id);
}

Expand Down Expand Up @@ -681,7 +681,7 @@ public static function getHookModuleExecList($hook_name = null)
);
}
}
if ($hook_name != 'displayPayment' && $hook_name != 'displayPaymentEU' && $hook_name != 'paymentOptions' && $hook_name != 'displayBackOfficeHeader') {
if ($hook_name != 'displayPayment' && $hook_name != 'displayPaymentEU' && $hook_name != 'paymentOptions' && $hook_name != 'displayBackOfficeHeader' && $hook_name != 'displayAdminLogin') {
Cache::store($cache_id, $list);
// @todo remove this in 1.6, we keep it in 1.5 for backward compatibility
self::$_hook_modules_cache_exec = $list;
Expand Down

0 comments on commit f386832

Please sign in to comment.