Execute a function when new topic is created

Started by bhawan, June 25, 2011, 09:08:25 PM

Previous topic - Next topic

bhawan

Hello ,

i wan to to execute a php function when ever a new topic is created.
i was trying to figure it out but i wasn't able to do .
so plz can abybody help me with this where should i call the function ?

SMF version : 2.0

bhawan

i am trying to get it work through post.php and sub-post.php but it jst seems not to work.
where should i exactly call the function so it should run when new topic is created

ZerK

after data is send and there isnt any error.
at the moment im using my laptop, but i ll check as soon as posible.

bhawan

i think it shuld be included somewhere in subs-post.php's createpost function

what i'm trying to do is that as soon as new topic is created it should be added to sitemap.xml and then ping it to google bot. i have made the function to add url and ping to google but unable figure out where to call it   :-\

Suki

You can use the SMF hooks for that, there is one:  integrate_create_topic   that  is called automatically after a new topic has been posted, an example of that hook can be found in the auto Respond mod:

http://custom.simplemachines.org/mods/index.php?mod=2963


basically all you have to do its use   

add_integration_function('integrate_create_topic','NameOfMyFunction');



then you just make your function:

NameOfMyFunction(){

// this will be called right after someone creates a new topic


}
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

bhawan

thnks a lot
i changed the code in autorespond.php  and it was executed every time a new topic was created.

again Thanks for your help.

Advertisement: