• Welcome to Simple Machines Community Forum. Please login or sign up.
September 17, 2021, 03:59:54 AM

News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord


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."
My Mods for SMF:
Avatars Display Integration
Avatars on Board and/or MessageIndex
Recent Forum Topics on Boardindex
Relative Time Formats

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."
My Mods for SMF:
Avatars Display Integration
Avatars on Board and/or MessageIndex
Recent Forum Topics on Boardindex
Relative Time Formats

Advertisement: