fast_events_custom_status

This filter is called after a custom order status change from the order contextmenu. It can only be used if the ‘Custom order statuses’ field has been set in the plugin settings.

1<?php
2function your_filter_custom_status( $attr ) {
3  // Do what you need to do
4}
5
6add_filter( 'fast_events_custom_status', 'your_filter_custom_status', 10, 1 );

Parameters

$attr[‘id’]

(int) The id of the event. This value is read-only.

$attr[‘event_name’]

(string) The name of the event. This value is read-only.

$attr[‘name’]

(string) The name of the person placing the order.

$attr[‘email’]

(string) The emailaddress of the person placing the order. This value is read-only.

$attr[‘payment_status’]

(string) The payment status of the event. This value is read-only.

$attr[‘custom_status’]

(string) The new custom status of the event. This value is read-only.

$attr[‘total’]

(string) The total order value. For example 6.50. This value is read-only.

$attr[‘total_vat’]

(string) The total order VAT value. For example 2.50. This value is read-only.

$attr[‘fields’]

array of input fields.

  1. ‘name’ (string, case sensitive) The name of the input field.

  2. ‘value’ (string) The value of the input field.

$attr[‘tickets’]

array of ticket-types ordered.

  1. ‘name’ (string, case sensitive) The name of the ticket-type.

  2. ‘price’ (string) The ticket price. Example 6.25.

  3. ‘vat’ (string) VAT.

  4. ‘count’ (int) The number of tickets ordered.

$attr[‘message’]

(string) The message shown in the popup dialog. Default value is: “Custom status set to: ”.


Return

$attr

A filter can only change $attr['message']. You can return HTML if necessary and it will be shown as popup dialog. The message will be purified to prevent XSS-attacks.


Changelog

Version

Description

1.0

Introduced.


Examples

Send email and create shipping-label

See Examples (Ship a signed photo book) for a more detailed description. For readability not all input-fields that are needed to create a shipping-label, are included. The order of the fields is as they are defined in the ‘Input -tab‘.

 1<?php
 2function your_filter_custom_status( $attr ) {
 3  if ( 'processing' === $attr['custom_status'] ) {
 4    $message = '<p>Dear ' . $attr['name'] . ',</p>' .
 5      '<p>We are processing your order with id <b>' . $attr['order_id'] . '.</b> '.
 6      'You wil receive another email if we ship your order.</p>' .
 7      '<p>Vintage Vinyl Open Air 2019 team</p>';
 8    fast_events_helper_func()->send_email( $attr['email'], "We are processing your order", $message );
 9  }
10  if ( 'shipped' === $attr['custom_status'] ) {
11    $html = '<input type="text" name="email" value="' . $attr['email'] . '"><br>' .
12      '<input type="text" name="person" value="' . $attr['name'] . '"><br>' .
13      '<input type="text" name="zipcode" value="' . $attr['fields'][0]['value'] . '"><br>' .
14      '<input type="text" name="number" value="' . $attr['fields'][1]['value'] . '"><br>' .
15      '<input type="text" name="addition" value="' . $attr['fields'][2]['value'] . '"><br>';
16    $attr['message'] = $html;
17  }
18  return $attr;
19}
20
21add_filter( 'fast_events_custom_status', 'your_filter_custom_status', 10, 1 );