Skip to content

Instantly share code, notes, and snippets.

@gwin
Created May 28, 2015 15:39
Show Gist options
  • Save gwin/75a55a4b6becfdc53d75 to your computer and use it in GitHub Desktop.
Save gwin/75a55a4b6becfdc53d75 to your computer and use it in GitHub Desktop.
Action my_wphd_new_message Basci Example
<?php
// Register action, notice fourth argument (3)
// it allows to pass 3 params to callback function
add_action("wphd_new_message", "my_wphd_new_message", 10, 3);
/**
* @var $thread Wphd_Model_Thread Current thread
* @var $message Wphd_Model_Message Current message
* @var $context string One of: "admin", "email-import", "submit-ticket", "tickets"
**/
function my_wphd_new_message($thread, $message, $context) {
// do something with the ticket here
// once done save message and thread
$message->save();
$thread->save();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment