I want to trigger a function immidiately after a user posted a comment on a post. I want to read from session data, find the user ID and look his facebook_id if he/she has any. Then i will post the same comment on his/her Facebook page.
How can i immidiately know if a user has posted a comment?
How can i know which user is that?
How can i trigger a function after that?
There is a hook called “wp_insert_comment“, that is executed right after the comment is added. This actions passes 2 arguements first the comment id and the second is the comment.
Well it depends on if the user is a registered subsriber of your blog.
Use the hook “wp_insert_comment” in conjunction with the function “get_comment“.
It’s just php so you can do whatever you want in your function.
This is just a help to solve your problem by your own. The hardest part will be to work on with the Facebook API.