News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Deactivating hooks does not work?

Started by @rjen, July 26, 2022, 03:07:21 AM

Previous topic - Next topic

@rjen

I am fiddling around with some mods that use hooks and I was trying to deactivate a hook from the Integration hook maintenance screen, to find that it seems to be behave erratically..

SMF2.1.2, vanilla install

I have a Mod that uses integrate_credits hook: Installs fine and works fine.
Note: this mod is an example, the same behaviour with other mods: this is not mod related but SMF related...

Install code in the package-info.xml:
<hook hook="integrate_credits" function="recent_top_credits" file="$sourcedir/Subs-recent_top.php" />

Results in this entry in the settings table:
variable: integrate_credits
value: $sourcedir/Subs-recent_top.php|recent_top_credits

All works fine: Credits are showing..

Then I go to the Hooks maintenance page in admin and I try to deactivate the hook.
You cannot view this attachment.

The result is showing as below:
You cannot view this attachment.

I am expecting the hook to be disabled now, but to my surprise it still shows the credits from the disabled hook to users...
You cannot view this attachment.

The settings table is updated as follows:
variable: integrate_credits
value: $sourcedir/Subs-recent_top.php|recent_top_credits,recent_top_credits!

Then I reactivate the hook, which results in the credits showing twice...(!)
You cannot view this attachment.

You cannot view this attachment.

Basically when I now uninstall the mod I am left with orphaned entries in the settings table...

You cannot view this attachment.

Is this intentional or is this a bug?

I would expect the hooks maintenance to allow me to actually deactivate the functionality of a certain hook completely, and to be able to reactivate it without 'doubling up' the functionality...
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

@rjen

The lack of response seems to indicate that this is an issue no one else has???
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Diego Andrés

I think the general opinion is that something is wrong with this section but it's unreliable to reproduce the issues.
Though some have been fixed like the slow loading, and re-enabling the hooks.

Shawn opened an issue for other issue but seems the bug went away? https://github.com/SimpleMachines/SMF/issues/7372

SMF Tricks - Free & Premium Responsive Themes for SMF.

@rjen

Urr? Something is wrong with section, but cannot reproduce ?

This happens on a clean install of 2.1.2. Has anyone tried to reproduce it? The bug you are referring to is not the same as I reported ...
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Diego Andrés

I know it's not the same, just pointing out that there are issues with the section, but somehow everyone gets a different result with their different actions.
As for this one, I already marked it as confirmed as it can definitely be reproduced.

SMF Tricks - Free & Premium Responsive Themes for SMF.

@rjen

Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

shawnb61

A question worth asking is born in experience & driven by necessity. - Fripp

Advertisement: