I have created my plugin(simple mail).
Which sends mail to administrator whenever a user gives a feedback.
I have added a feedback page on site which collects user info as name, contact no. , email-address and feedback.
I want to trigger my plugin when the user submits (clicks on Submit button).
I mean when user enters all info and submits it , the plugin should send mail to administrator.
normally to hook to wordpress we write:
add_action('action_hook', 'action_function_name');
What should i use in place of action_hook.
Myplugin: hremail
----------------------
function hremail(){
if(isset($_REQUEST['email']))
//if email is filled out ,send email
{
//send email
$name = $_REQUEST['name'];
$contact = $_REQUEST['contact'];
$email = $_REQUEST['email'];
$subject = $_REQUEST['subject'];
$comments = $_REQUEST['comments'];
$list = 'maheshstiwari@gmail.com,harsh@gmail.com';
mail( $list, "Subject: $subject", $comments, "From: $email" );
echo "Thank you for using our mail form";
}
else
//if "email" is not filled out, display the error messsage
{
echo "Please enter the email";
}
}
add_action('post_comment','hremail');
?>
i have added post_comment as action hook but its not working.