(0)
2 months ago Comments Off on Hooks And Filters (E-Mail Support Add-on)

Here are some of the more useful hooks that are available in the Email Support add-on.

Action Hooks

wpas_process_ticket_attachments

Available in version 0.3.0 or later.

This action is called when attachments are being processed.  Accepts the id of the ticket and the email attachment array.

do_action('wpas_process_ticket_attachments', $parent_id, $this->email['attachment'] );

wpas_email_reply_converted

Available in version 0.3.0 or later.

This action is fired when an unknown or unassigned email reply is converted into an actual ticket.

do_action( 'wpas_email_reply_converted', $this->post_id, $status );

Filters

ases_post_clean_content_filter

Available in version 0.3.1 or later.

Used to replace the final cleaned content with your filtered content.  Accepts the filtered content and the original raw email content.

One good use would be to handle HTML the way you want.  Extract the data from $raw, reformat it or strip html as you see fit.  When done, put the result in $content.

apply_filters( 'ases_post_clean_content_filter', $content, $raw, $this );

ases_get_raw_content_filter

Available in version 0.3.1 or later.

Used to replace the raw content extracted from the incoming email.  Accepts the raw unfiltered body content of the incoming email.

apply_filters( 'ases_get_raw_content_filter', $raw, $this );

ases_get_user_id

Available in version 0.3.0 or later.

Filter called after a user id has been determined.  Can be used to change the user id for the incoming email. Accepts the user id and the email address (as determined at the time of the filter call)

apply_filters( 'ases_get_user_id', $user_id, $user_email, $this );

wpas_open_ticket_data

Available in version 0.3.0 or later.

Filter called when a ticket is being opened.  Can be used to change the data being saved with the ticket.  Be careful how you use this one!

apply_filters( 'wpas_open_ticket_data', array(
'post_content' => $this->get_content(),
'post_name' => $this->get_subject(),
'post_title' => $this->get_subject(),
'post_status' => 'queued',
'post_type' => 'ticket',
'post_author' => $new_user_id,
'ping_status' => 'closed',
'comment_status' => 'closed',
) );

 

Categorised in:

Comments are closed.