Network hooks
This page lists the 4 hooks of this group. Each entry shows its type, the version it arrived in, where it runs, its arguments and a starting point.
addochat_network_payload
FilterSince 0.1.0 Runs in src/Network/Sync.php.
Filters what a linked site sends to its central site for a conversation.
| Argument | Type | Description |
|---|---|---|
$payload | array<string, mixed> | Conversation and messages. |
$row | array<string, mixed> | Conversation row. |
add_filter( 'addochat_network_payload', function ( $payload, $row ) {
return $payload;
}, 10, 2 );
addochat_network_timeout
FilterSince 0.1.0 Runs in src/Network/Client.php.
Filters the timeout of calls between sites, in seconds. Default 10, and 3 for presence (a visitor waits for it).
| Argument | Type | Description |
|---|---|---|
$timeout | int | Seconds. |
$route | string | Network route. |
add_filter( 'addochat_network_timeout', function ( $timeout, $route ) {
return $timeout;
}, 10, 2 );
addochat_site_paired
ActionSince 0.1.0 Runs in src/Network/Pairing.php.
Linked side: pairs with the central site of the code.
| Argument | Type | Description |
|---|---|---|
$code | string | Pasted code. / public static function pair( string $code ): string { $parsed = self::decode( $code ); if ( null === $parsed ) { return __( 'This is not a valid pairing code.', 'addochat' ); } if ( Host::normalize( $parsed['rest'] ) === Host::current() ) { return __( 'A site cannot pair with itself.', 'addochat' ); } $secret = wp_generate_password( 48, false, false ); $answer = Client::post( $parsed['rest'], 'pair', array( 'code' => $parsed['code'], 'rest' => rest_url(), 'admin' => admin_url(), 'name' => (string) get_bloginfo( 'name' ), 'version' => ADDOCHAT_VERSION, 'locales' => Language::available(), |
add_action( 'addochat_site_paired', function ( $code ) {
// ...
} );
addochat_site_unpaired
ActionSince 0.1.0 Runs in src/Network/Pairing.php.
Fires after a pair was removed.
| Argument | Type | Description |
|---|---|---|
$host | string | Host of the other site. |
$role | string | Role of this site in the pair: central or linked. |
add_action( 'addochat_site_unpaired', function ( $host, $role ) {
// ...
}, 10, 2 );