Integration Hooks load only in a specific page ?

Started by 0mW, June 29, 2021, 03:39:08 PM

Previous topic - Next topic

0mW

Hello,

I'm new on SFM, I particularly interested in the package creation.

I discovered the Integration Hooks (https://wiki.simplemachines.org/smf/Integration_hooks).

I chose a package for example :

https://custom.simplemachines.org/mods/index.php?mod=2712

But I do not understand how to display the clickable link (avatar or name), only if you are on the Profile page (for example) ?

I guess it would be necessary to add a condition before using the hook functions (in CLAAN.hooks.php) ?

How to load the integration only in a specific page (and not for all) ?

Thanks.

Pipke

QuoteBut I do not understand how to display the clickable link (avatar or name), only if you are on the Profile page (for example) ?
you can use a condition for that like:

if ($context['current_action'] == 'profile') {

// do this
}

"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

0mW

Hi Pipke,

Thanks for your help !

The condition must be called before the integration function (add_integration_function) ?

Pipke

that depends on how you build your mod, the best way is to watch other mods how they do it and learn from there.
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

Advertisement: