Customizing SMF > SMF Coding Discussion

Re: execute another db insert at registration completion

<< < (2/2)

Hetasser:
what I had understood was :

--- Code: ---add_integration_function('integrate_pre_include', '$sourcedir/Subs-AddPlayerToVdd.php',TRUE);
--- End code ---
this one loads the Subs at the begining

in $sourcedir/Subs-AddPlayerToVdd.php, I have this function AddPlayerToVdd_add_hook which adds

--- Code: ---$actionArray['AddPlayerToVdd'] = array('AddPlayerToVdd.php', 'AddPlayertoVdd')
--- End code ---

and in AddPlayerToVdd.php, I have the AddPlayertoVdd function which should print something


--- Code: ---add_integration_function('integrate_activate', 'AddPlayerToVdd_add_hook',TRUE);
--- End code ---
I thing this one should be called when a user or an admin activates his account. since the $sourcedir/Subs-AddPlayerToVdd.php file was included at the begining, I can't find where the hole in the chain is

Arantor:
OK, so the first one does load your file. But you don't need to touch the actionArray, that's just the list of actions for handling with index.php?action= items. That's only useful if you're calling index.php?action=AddPlayerToVdd in your case - which you're not.

Instead your function that actually carries out registration should be the one named AddPlayerToVdd_add_hook. Check what integrate_activate sends so that your function receives it.

Andre N:

--- Quote from: Hetasser on May 05, 2012, 11:30:31 AM ---
--- Quote from: Labradoodle-360 on May 04, 2012, 11:49:31 AM ---I went ahead and split your topic...

--- End quote ---
Thanks, I wasn't sure if I should create a new topic or not.


--- Quote ---Not sure what, if anything you're doing wrong but try this method instead:
http://www.simplemachines.org/community/index.php?topic=453008.0
--- End quote ---
I had read this post, but I was under the impression that SMF2 hooks allowed to do what I wanted without adding a new file.

Well, if I can't get anything else to work, I thing I will try his method

thanks


--- End quote ---

So where are you writing your functions? You have to call a new file somewhere... and where are you defining what function your hooks should call?
IMHO it's better to just keep it all in one central location, hence the hooks file above. That way when you need to mess with the hooks you know exactly where to go :)

Navigation

[0] Message Index

[*] Previous page

Go to full version