Helper Classes
Fluent Support offers several helper classes to simplify interactions for building advanced functionalities in your plugin. While primarily used by the plugin, these functions are available for your use in custom addons.
Fluent Support Core Helper Class
- Class with Namespace:
FluentSupport\App\Services\Helper - Method Types:
static
Helper::getOption()
Get fluent-support Option. This is similar to WordPress's get_option() function, but it uses its own database table instead of wp_options table
Parameters
- $key
stringrequired - $default
mixedoptional, defaults to''. Returned when the option is missing or its stored value is corrupt. When$defaultis an array and the stored value is not,$defaultis returned
Return mixed
Helper::updateOption()
Update fluent-support Option. This is similar to WordPress's update_option() function, but it uses its own database table instead of wp_options table
Parameters
- $key
stringrequired - $value
mixed
Return mixed
Helper::deleteOption($key)
Delete fluent-support Option. This is similar to WordPress's delete_option() function, but it uses its own database table instead of wp_options table
Parameters
- $key
stringrequired
Return boolean
Helper::getAgentByUserId($userId = null)
Get agent information by WordPress user id
Parameters
- $userId
intoptional — defaults to the current logged-in user (get_current_user_id()) when omitted
Return FluentSupport\App\Models\Agent|null|false — false if no user ID is available (not logged in and none passed), null if the ID doesn't match an agent
Helper::customerTicketPriorities()
This function will return the list of ticket priorities for customer
Return array
Source:
public static function customerTicketPriorities()
{
return apply_filters('fluent_support/customer_ticket_priorities', [
'normal' => __('Normal', 'fluent-support'),
'medium' => __('Medium', 'fluent-support'),
'critical' => __('Critical', 'fluent-support')
]);
}Available Filter Hook: fluent_support/customer_ticket_priorities
Helper::adminTicketPriorities()
This function will return the list of ticket priorities for Admin
Return array
Source:
public static function adminTicketPriorities()
{
return apply_filters('fluent_support/admin_ticket_priorities', [
'normal' => __('Normal', 'fluent-support'),
'medium' => __('Medium', 'fluent-support'),
'critical' => __('Critical', 'fluent-support')
]);
}Available Filter Hook: fluent_support/admin_ticket_priorities
Helper::ticketStatusGroups()
This function will return ticket status group
Return array
Source:
public static function ticketStatusGroups()
{
return apply_filters('fluent_support/ticket_status_groups', [
'open' => ['new', 'active'],
'active' => ['active'],
'closed' => ['closed'],
'new' => ['new'],
'all' => []
]);
}Available Filter Hook: fluent_support/ticket_status_groups
Helper::changeableTicketStatuses()
This function will return the ticket status groups an agent is allowed to change a ticket to — the same as ticketStatusGroups(), minus the all and open groups.
Return array
Source:
public static function changeableTicketStatuses()
{
$ticketStatus = static::ticketStatusGroups();
unset($ticketStatus['all']);
unset($ticketStatus['open']);
return apply_filters('fluent_support/changeable_ticket_statuses', $ticketStatus);
}Available Filter Hook: fluent_support/changeable_ticket_statuses
Helper::ticketStatuses()
This function will return the ticket status list (status key => human-readable label).
Return array
Source:
public static function ticketStatuses()
{
return apply_filters('fluent_support/ticket_statuses', [
'new' => __('New', 'fluent-support'),
'active' => __('Active', 'fluent-support'),
'closed' => __('Closed', 'fluent-support'),
]);
}Available Filter Hook: fluent_support/ticket_statuses
Helper::getCustomerByID($customerId)
Get a customer by its Fluent Support customer ID (fs_persons.id, not the WordPress user ID)
Parameters
- $customerId
IntegerCustomer ID
Return FluentSupport\App\Models\Customer|null
Helper::getCurrentAgent()
Get the agent record of the logged-in WordPress user
Return FluentSupport\App\Models\Agent|null — null when no user is logged in or the user is not an agent
Helper::getCurrentCustomer()
Get the customer record of the logged-in WordPress user. If several customer rows share the user ID, the oldest is returned
Return FluentSupport\App\Models\Customer|null
Helper::getCurrentPerson()
Get the agent or customer record of the logged-in WordPress user, whichever was created first
Return FluentSupport\App\Models\Person|null
Helper::isSupportStaffEmail($email)
Check whether an email belongs to support staff: an agent, or a WordPress user who is an administrator or an agent. Fluent Support never offers or creates such people as customers
Parameters
- $email
stringrequired
Return boolean
Helper::getTicketMeta($ticketId, $key, $default = '')
Get a meta value stored for a ticket
Parameters
- $ticketId
intrequired - $key
stringrequired - $default
mixedoptional, defaults to''. Also returned when the stored value is empty (for example0or'')
Return mixed
Helper::updateTicketMeta($ticketId, $key, $value)
Add or update a meta value for a ticket. Arrays and objects are serialized
Parameters
- $ticketId
intrequired - $key
stringrequired - $value
mixedrequired
Return mixed — rows updated when the key existed, otherwise the insert result
Helper::getBusinessSettings($key = null, $default = null)
Get the global business settings, or a single setting. The settings are cached for the request
Parameters
- $key
stringoptional — omit to get all settings - $default
mixedoptional — returned only when the key is missing from both the stored settings and the built-in defaults
Return mixed — the settings array when $key is omitted
Helper::getDefaultMailBox()
Get the default mailbox, falling back to the oldest mailbox
Return FluentSupport\App\Models\MailBox|null
Helper::getPortalBaseUrl()
Get the customer portal URL, without a trailing slash. Depending on the Ticket link portal setting this is the WooCommerce My Account, FluentCart or FluentCommunity support page; otherwise it is the configured portal page
Return string
Available Filter Hook: fluent_support/portal_base_url
Helper::getTicketViewUrl($ticket)
Get the customer portal URL of a ticket
Parameters
- $ticket
objectrequired — a ticket withserial_numberorid
Return string, for example https://example.com/support/#/ticket/123/view
Helper::getTicketAdminUrl($ticket)
Get the admin (agent) URL of a ticket
Parameters
- $ticket
objectrequired
Return string, for example https://example.com/wp-admin/admin.php?page=fluent-support/#/tickets/123/view
Available Filter Hook: fluent_support/portal_admin_base_url
