Skip to content

Commit

Permalink
! hook sorting was not working properly
Browse files Browse the repository at this point in the history
Signed-off-by: Spuds <spuds@spudsdesign.com>
  • Loading branch information
Spuds committed Jul 25, 2014
1 parent 330261e commit da465a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion sources/admin/Maintenance.controller.php
Expand Up @@ -1241,7 +1241,7 @@ public function action_hooks()
'status' => array(
'header' => array(
'value' => $txt['hooks_field_hook_exists'],
'style' => 'width:3%;',
'class' => 'nowrap',
),
'data' => array(
'function' => create_function('$data', '
Expand Down
13 changes: 8 additions & 5 deletions sources/subs/AddonSettings.subs.php
Expand Up @@ -145,10 +145,10 @@ function list_integration_hooks_data($start, $per_page, $sort)
}

$sort_types = array(
'hook_name' => array('hook', SORT_ASC),
'hook_name DESC' => array('hook', SORT_DESC),
'function_name' => array('function', SORT_ASC),
'function_name DESC' => array('function', SORT_DESC),
'hook_name' => array('hook_name', SORT_ASC),
'hook_name DESC' => array('hook_name', SORT_DESC),
'function_name' => array('function_name', SORT_ASC),
'function_name DESC' => array('function_name', SORT_DESC),
'file_name' => array('file_name', SORT_ASC),
'file_name DESC' => array('file_name', SORT_DESC),
'status' => array('status', SORT_ASC),
Expand Down Expand Up @@ -203,7 +203,6 @@ function list_integration_hooks_data($start, $per_page, $sort)
$enabled = strstr($function, ']') === false;
$function = str_replace(']', '', $function);
$hook_exists = !empty($hook_status[$hook][$function]['exists']);
$sort[] = $$sort_options[0];

if (strpos($function, '::') !== false)
{
Expand All @@ -226,6 +225,10 @@ function list_integration_hooks_data($start, $per_page, $sort)
'enabled' => $enabled,
'can_be_disabled' => !empty($modSettings['handlinghooks_enabled']) && !isset($hook_status[$hook][$function]['enabled']),
);

// Build the array of sort to values
$sort_end = end($temp_data);
$sort[] = $sort_end[$sort_options[0]];
}
}
}
Expand Down

0 comments on commit da465a9

Please sign in to comment.