Inbox hooks
This page lists the 13 hooks of this group. Each entry shows its type, the version it arrived in, where it runs, its arguments and a starting point.
addochat_addofy_notificationsaddochat_agent_repliedaddochat_agent_rolesaddochat_agents_onlineaddochat_can_edit_messageaddochat_conversation_claimedaddochat_conversation_closedaddochat_deliveryaddochat_is_openaddochat_message_editedaddochat_opening_hoursaddochat_ref_linkaddochat_single_view_url
addochat_addofy_notifications
FilterSince 0.1.0 Runs in src/Inbox/Screen.php.
Filters whether Addofy's notifications replace the desktop notifications of the inbox.
| Argument | Type | Description |
|---|---|---|
$addofy | bool | Default: adba_alerts_browser() for the current user (Addofy 2.36.0+), else whether Addofy runs with its notifications API. |
add_filter( 'addochat_addofy_notifications', function ( $addofy ) {
return $addofy;
} );
addochat_agent_replied
ActionSince 0.1.0 Runs in src/Inbox/Actions.php.
Fires after a colleague answered.
| Argument | Type | Description |
|---|---|---|
$conversation | array<string, mixed> | Conversation row. |
$message_id | int | Message id. |
$user_id | int | Colleague. |
add_action( 'addochat_agent_replied', function ( $conversation, $message_id, $user_id ) {
// ...
}, 10, 3 );
addochat_agent_roles
FilterSince 0.1.0 Runs in src/Inbox/Agents.php.
Filters the roles that may answer chats. Applied on activation, on each upgrade and when the settings are saved; a role that is not in the list loses the capability.
| Argument | Type | Description |
|---|---|---|
$roles | string[] | Role names, from the setting "Roles that answer chats". |
add_filter( 'addochat_agent_roles', function ( $roles ) {
return $roles;
} );
addochat_agents_online
FilterSince 0.1.0 Runs in src/Inbox/Agents.php.
Filters whether a colleague is online for visitors (for example opening hours or a shared phone line).
| Argument | Type | Description |
|---|---|---|
$online | bool | Whether a colleague is online. |
add_filter( 'addochat_agents_online', function ( $online ) {
return $online;
} );
addochat_can_edit_message
FilterSince 0.2.0 Runs in src/Inbox/Actions.php.
Filters whether a colleague may edit a message in the inbox.
| Argument | Type | Description |
|---|---|---|
$allowed | bool | Own answer, or any colleague answer for an administrator. |
$message | array<string, mixed> | Message. |
$user_id | int | Colleague. |
add_filter( 'addochat_can_edit_message', function ( $allowed, $message, $user_id ) {
return $allowed;
}, 10, 3 );
addochat_conversation_claimed
ActionSince 0.1.0 Runs in src/Inbox/Actions.php.
Fires after a colleague took a conversation.
| Argument | Type | Description |
|---|---|---|
$conversation | array<string, mixed> | Conversation row (before the change). |
$user_id | int | Colleague. |
add_action( 'addochat_conversation_claimed', function ( $conversation, $user_id ) {
// ...
}, 10, 2 );
addochat_conversation_closed
ActionSince 0.1.0 Runs in src/Inbox/Actions.php.
Fires after a conversation was closed.
| Argument | Type | Description |
|---|---|---|
$conversation | array<string, mixed> | Conversation row (before the change). |
$user_id | int | Colleague. |
add_action( 'addochat_conversation_closed', function ( $conversation, $user_id ) {
// ...
}, 10, 2 );
addochat_delivery
FilterSince 0.1.0 Runs in src/Inbox/Actions.php.
Filters how a message from the inbox reaches the conversation. Return a subclass of \Addochat\Inbox\Delivery, for example to send it on to another site.
| Argument | Type | Description |
|---|---|---|
$delivery | \Addochat\Inbox\Delivery | Delivery. |
$conversation | array<string, mixed> | Conversation row. |
add_filter( 'addochat_delivery', function ( $delivery, $conversation ) {
return $delivery;
}, 10, 2 );
addochat_is_open
FilterSince 0.1.0 Runs in src/Inbox/Hours.php.
Filters whether live chat is open at a moment. False means visitors get the email form straight away.
| Argument | Type | Description |
|---|---|---|
$open | bool | Whether it is open. |
$now | \DateTimeImmutable | The moment, in the WordPress time zone. |
$settings | array<string, mixed> | Effective settings of the site. |
add_filter( 'addochat_is_open', function ( $open, $now, $settings ) {
return $open;
}, 10, 3 );
addochat_message_edited
ActionSince 0.2.0 Runs in src/Inbox/Actions.php.
Fires after a colleague changed the text of a message.
| Argument | Type | Description |
|---|---|---|
$conversation | array<string, mixed> | Conversation row. |
$message_id | int | Message id. |
$old | string | Text before. |
$text | string | Text now. |
$user_id | int | Colleague. |
add_action( 'addochat_message_edited', function ( $conversation, $message_id, $old, $text, $user_id ) {
// ...
}, 10, 5 );
addochat_opening_hours
FilterSince 0.1.0 Runs in src/Inbox/Hours.php.
Filters the opening hours of live chat, for example to read them from your own roster.
| Argument | Type | Description |
|---|---|---|
$schedule | array<string, mixed> | days: 1 (Monday) to 7 => [start, end] in minutes after midnight, or null when closed; closed: dates (Y-m-d); set: false when no day was filled in (always open). |
$settings | array<string, mixed> | Effective settings of the site. |
add_filter( 'addochat_opening_hours', function ( $schedule, $settings ) {
return $schedule;
}, 10, 2 );
addochat_ref_link
FilterSince 0.2.0 Runs in src/Inbox/Links.php.
Filters a link in the inbox to something a conversation used: change the label, the detail line or the address (for example to another admin screen), or return null to leave it out.
| Argument | Type | Description |
|---|---|---|
$link | array{label: string, detail: string, url: string}|null | Link, null when the object is gone. |
$type | string | order, product, customer or page. |
$id | int | Id. |
add_filter( 'addochat_ref_link', function ( $link, $type, $id ) {
return $link;
}, 10, 3 );
addochat_single_view_url
FilterSince 0.2.0 Runs in src/Inbox/Screen.php.
Filters the address of the separate window with one conversation. The inbox adds "#<uuid>".
| Argument | Type | Description |
|---|---|---|
$url | string | Address without the conversation. |
add_filter( 'addochat_single_view_url', function ( $url ) {
return $url;
} );