Documentation

Object Wphd_Model_Thread

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 thread
  • post_id – ID of an associated custom post type in wp_posts table
  • source – how the ticket was received – 1: email import, 2: submit ticket form (private), 3: submit ticket form (public)
  • from_name – sender name
  • from_email – sender email address
  • title – ticket title
  • messages – number of messages in the thread (including trashed)
  • messages_new – number of unread messages
  • last_activity – (date) last time message in this thread was added
  • assigned_to – ID of an agent to which the ticket is assigned
  • user_id – ID of a user who submitted the ticket
  • status – thread status, one of 1: open, 2: archived/closed, 3: trashed

Methods

  • delete() – deletes thread, messages and custom post type
  • exists() – checks if thread exists
  • find() – allows to search thread by params
  • hasDraft() – (boolean) true if some agent created drafts exist for this thread
  • save() – saves thread data in DB
  • toArray() – returns all information about thread in associative array
  • url() – returns public thread URL