This is the main object containing general information about a thread but not the actual messages. It’s pretty simple to load a thread from the DB using OOP syntax:
$thread = new Wphd_Model_Thread(100);
echo $thread->exists() . PHP_EOL;
echo $thread->messages . PHP_EOL;
Properties
id– unique number assigned to the threadpost_id– ID of an associated custom post type in wp_posts tablesource– how the ticket was received – 1: email import, 2: submit ticket form (private), 3: submit ticket form (public)from_name– sender namefrom_email– sender email addresstitle– ticket titlemessages– number of messages in the thread (including trashed)messages_new– number of unread messageslast_activity– (date) last time message in this thread was addedassigned_to– ID of an agent to which the ticket is assigneduser_id– ID of a user who submitted the ticketstatus– thread status, one of 1: open, 2: archived/closed, 3: trashed
Methods
delete()– deletes thread, messages and custom post typeexists()– checks if thread existsfind()– allows to search thread by paramshasDraft()– (boolean) true if some agent created drafts exist for this threadsave()– saves thread data in DBtoArray()– returns all information about thread in associative arrayurl()– returns public thread URL