In my plugin I want to accomplish an action after a comment is inserted into the database.
for that I use comment_post action. Here is my code
Codex: comment_post is an action triggered immediately after a comment is inserted into the database.
/*
* Plugin Fonctionalities Class
*/
class PluginFonctionalities {
public function __construct() {
add_action('comment_post', array('do_action_comment'));
}
public function do_action_comment( $comment_ID, $comment_approved ) {
if( 1 === $comment_approved ){
$outputFile = plugins_url('includes/output.txt', __FILE__);
$filehandle = fopen($outputFile, 'a') or die("File creation error.");
fwrite($fileHandle, "Example of message");
fclose($fileHandle);
}
}
}
but nothing is happen when i submit the comment form. Any ideas !?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire