News:

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

Main Menu

Do these hooks exists for smf 2.0x?

Started by Doug Heffernan, April 22, 2019, 04:50:01 PM

Previous topic - Next topic

Doug Heffernan

I am working a couple of mods that will add extra options/settings to the Maintenance and Tasks. As far as I could see there are no hooks to add in those 2 areas. Am I right or have I missed them?

SychO

I don't really know,

All hooks are listed here https://wiki.simplemachines.org/smf/Integration_hooks

Usually when I make a mod, I look for a call to "call_integration_hook" around the area I wish to customize, so if you can't find one, then there isn't. SMF2.0 is very poor in hooks, SMF2.1 on the hand is full of them so I really don't think mod authors will have to modify the code at all except for a few rare cases for that version.
Checkout My Themes:
-

Potato  •  Ackerman  •  SunRise  •  NightBreeze

Suki

Do you mean scheduled tasks? if so, you have to add yours in the corresponding table,  something like scheduled_tasks or so, can't remember correctly the actual table name.  Check a mod that adds a scheduled task to see for yourself, I got one for posting birthdays.

I can't remember if theres a hook for maintenance.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Doug Heffernan

Quote from: SychO on April 22, 2019, 05:05:05 PM
I don't really know,

All hooks are listed here https://wiki.simplemachines.org/smf/Integration_hooks

Usually when I make a mod, I look for a call to "call_integration_hook" around the area I wish to customize, so if you can't find one, then there isn't. SMF2.0 is very poor in hooks, SMF2.1 on the hand is full of them so I really don't think mod authors will have to modify the code at all except for a few rare cases for that version.

I did look but I could find any. I thought that maybe I missed it, but now I see that I was right in my assumtion that there are no hooks for those areas. I am glad to read that about 2.1. It will make coding/developing mods much much easier.

Quote from: Suki on April 22, 2019, 05:05:30 PM
Do you mean scheduled tasks? if so, you have to add yours in the corresponding table,  something like scheduled_tasks or so, can't remember correctly the actual table name.  Check a mod that adds a scheduled task to see for yourself, I got one for posting birthdays.

I can't remember if theres a hook for maintenance.

Yes, I meant the scheduled tasks. And yes, I have added it to the smf_ scheduled_tasks as well.

Many thanks for your replies guys.

Kindred

check the RSS Feed importer mod... I know that one adds a scheduled task
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Sesquipedalian

FYI, you can create your own hooks at any arbitrary place in the SMF 2.0.x code that you like. Just use modification.xml to insert a single line like this where appropriate:


call_integration_hook('modname_funcname', array(&var1, &var2));


Then use the normal methods in your mod package for connecting your mod's functions with the hook.

This approach keeps your file edits nice and clean (only one line added), and allows you to use the same code in both 2.0 and 2.1 without any significant rewrites.

For an example of how to do this, feel free to look at the 2.0 install code I use in my Paragrapher mod.
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

Arantor

The real trick is hijacking existing hooks to do things because other hooks don't exist ;D LevGal has a great example, there's no hook in 2.0 to do stuff on the back of deleting a group (no tidy up option there) but careful manipulation of other hooks means it does become possible to do...

Just hard work and ugly though :( and the less we say about abusing integrate_buffer the better.

Doug Heffernan

Thanks for the tips guys, really appreciate it.

Advertisement: