Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: The Wizard - helmikuu 16, 2014, 10:41:46 IP

Otsikko: Hook Question
Kirjoitti: The Wizard - helmikuu 16, 2014, 10:41:46 IP
Hello:

I was wondering if I need to have the
'integrate_admin_include' => '$sourcedir/Subs-Toy_Shophooks.php',
Twice like I wrote it below OR can I remove it and just keep the     
'integrate_admin_areas' => 'toy_shop_admin_areas_sub_hooks',
???

Wanted to ask before I try this

thanks

Wiz


$hooks = array(
'integrate_pre_include' => '$sourcedir/Subs-Toy_Shophooks.php',
'integrate_actions' => 'toy_shop_add_hook',
'integrate_admin_include' => '$sourcedir/Subs-Toy_Shophooks.php',
'integrate_admin_areas' => 'toy_shop_admin_areas',
  'integrate_admin_include' => '$sourcedir/Subs-Toy_Shophooks.php',
'integrate_admin_areas' => 'toy_shop_admin_areas_sub_hooks',
);

foreach ($hooks as $hook => $function)
add_integration_function($hook, $function, true);
Otsikko: Re: Hook Question
Kirjoitti: margarett - helmikuu 17, 2014, 05:12:16 AP
You just need once. In fact, you don't get an error regarding duplicate functions because SMF uses a require_once to load the pointed file ;)

// Any files to include for administration?
if (!empty($modSettings['integrate_admin_include']))
{

..................................

require_once($include);
Otsikko: Re: Hook Question
Kirjoitti: The Wizard - helmikuu 17, 2014, 07:09:20 AP
Thanks for the answer margarett I thought that was the case, but i wanted to be sure.

Wiz 8)