Awesome Support Documentation

Customizing Client and Agent Attributes In The Conditions and Filters Section

The default items in the drop-down list of attributes for clients and agents are set to those provided with a basic installation of WordPress.  However, other plugins usually add additional fields to the user profile screen which will not show up in this list.  For example WooCommerce adds billing and shipping fields to the user profile.  Even Awesome Support itself adds additional fields.

In order to use these additional user profile attributes your developer will need to customize the drop-down list of attributes by hooking into a couple of filters we provided with the add-on.  If you don’t understand what this means please consult a WordPress developer.

Filter: asre_client_attr

Use: Customize the drop-down list of user attributes in the Conditions and Filters section of a rule-set

add_filter( 'asre_client_attr', 'new_client_attribute', 10, 1);
function new_client_attribute( $client_attr ){
$client_attr['user_meta_key'] = 'User Meta Title';
return $client_attr;
}

Filter: asre_agent_attr

Use: Customize the drop-down list of agent attributes in the Conditions and Filters section of a rule-set

add_filter( 'asre_agent_attr', 'new_agent_attribute', 10, 1);
function new_agent_attribute( $agent_attr ){
$agent_attr['wpas_can_be_assigned'] = 'Can Be Assigned';
return $agent_attr;
}

Filter asre_zapier_client_attributes

Use: Customize the attributes for the primary ticket user that are pushed to Zapier

add_filter( 'asre_zapier_client_attributes','set_zapier_client_addl_attributes', 10, 2 );

public function set_zapier_client_addl_attributes( $zapier_data, $author_id ) {

$zapier_data['client_wpas_mobile_phone'] = get_user_option( 'wpas_mobile_phone', $author_id );
$zapier_data['client_wpas_office_phone'] = get_user_option( 'wpas_office_phone', $author_id );
$zapier_data['client_wpas_home_phone'] = get_user_option( 'wpas_home_phone', $author_id );
$zapier_data['client_wpas_other_phone'] = get_user_option( 'wpas_other_phone', $author_id );
return $zapier_data ;
}

Notes:  The client attribute key is prefixed by the word “client_”.  So if the user meta is called ‘wpas_mobile_phone’, the attribute key in the array is ‘client_wpas_mobile_phone’.

Filter asre_zapier_agent_attributes

Use: Customize the attributes for the primary ticket agent that are pushed to Zapier

add_filter( 'asre_zapier_agent_attributes','set_zapier_agent_addl_attributes', 10, 2 );

public function set_zapier_agent_addl_attributes( $zapier_data, $agent_id ) {

$zapier_data['agent_wpas_mobile_phone'] = get_user_option( 'wpas_mobile_phone', $agent_id );
$zapier_data['agent_wpas_office_phone'] = get_user_option( 'wpas_office_phone', $agent_id );
$zapier_data['agent_wpas_home_phone'] = get_user_option( 'wpas_home_phone', $agent_id );
$zapier_data['agent_wpas_other_phone'] = get_user_option( 'wpas_other_phone', $agent_id );

return $zapier_data ;
}

Notes:  The agent attribute key is prefixed by the word “agent_”.  So if the user meta is called ‘wpas_mobile_phone’, the attribute key in the array is ‘agent_wpas_mobile_phone’.

Filter asre_zap_test_data

Use: Add test data to the array of data that is sent to Zapier when the test button is used.

add_filter( 'asre_zap_test_data','zap_test_data' );
public function zap_test_data( $zapier_test_data ) {
$zapier_test_data['agent_wpas_mobile_phone'] = 'Agent Mobile Phone (+12125551212)';
$zapier_test_data['agent_wpas_office_phone'] = 'Agent Office Phone (+12125551212)';
$zapier_test_data['agent_wpas_home_phone'] = 'Agent Home Phone (+12125551212)';
$zapier_test_data['agent_wpas_other_phone'] = 'Agent Other Phone (+12125551212)';
$zapier_test_data['client_wpas_mobile_phone'] = 'Client Mobile Phone (+12125551212)';
$zapier_test_data['client_wpas_office_phone'] = 'Client Office Phone (+12125551212)';
$zapier_test_data['client_wpas_home_phone'] = 'Client Home Phone (+12125551212)';
$zapier_test_data['client_wpas_other_phone'] = 'Client Other Phone (+12125551212)';
return $zapier_test_data ;}

Other Notes

  • If you want to add user / agent attributes that are only used when evaluating your rules on the WordPress server then only the first two filters above are needed.  But if you are going to push the data to zapier or webhooks you need to implement the rest of them.
  • Only data from the user who opened the ticket and the primary agent assigned to the ticket is pushed to Zapier/webhooks.  Secondary and tertiary agent data is not pushed.  You would have to code that up yourself using these hooks it you want to push that data.
  • Data about the user or agent making the reply (if they are different from the primary user and agent) is not pushed to Zapier/webhooks.   You would have to code that up yourself using these hooks it you want to push that data.