Download the PHP package digitalerase/wp-remote-users-sync without Composer
On this page you can find all versions of the php package digitalerase/wp-remote-users-sync. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download digitalerase/wp-remote-users-sync
More information about digitalerase/wp-remote-users-sync
Files in digitalerase/wp-remote-users-sync
Package wp-remote-users-sync
Short Description Synchronise users automatically and securely between multiple wordpress sites.
License GPL-3.0-or-later
Homepage https://github.com/digitalerase/wp-remote-users-sync
Informations about the package wp-remote-users-sync
WP Remote Users Sync - Synchronise WordPress Users across Multiple Sites
- General Description
- Overview
- Adding User Actions
- Hooks - actions & filters
- Actions
- Filters
General Description
If you run multiple websites and want to keep users separated, but synchronise them automatically and securely for specific user operations, then WP Remote Users Sync is the plugin to use.
Overview
This plugin adds the following major features to WordPress:
- WP Remote Users Sync admin page: a settings page under "Settings > WP Remote Users Sync" to manage remote sites, security settings, import/export users, and view activity logs.
- Remote Sites: manage an unlimited amount of connected sites with configuration for incoming and outgoing User Actions (Login, Logout, Create, Update, Delete, Password, Role and Metadata).
- Security: WP Remote Users Sync is the only plugin available allowing users to be synchronised with true layers of security in place. All communications are OpenSSL AES-256-CBC encrypted, HMAC SHA256 signed, token-validated and IP-validated.
- Import and Export Users: connected websites' existing user base can be synchronised manually first thanks to the provided import/export tool.
- Activity Logs: when enabled, all communications between connected sites is logged for admin review and troubleshooting.
- Synchronise all user data: compatible out of the box with WooCommerce, Ultimate Membership, Theme My Login, Gravity Forms, and all user-related plugins as long as they rely on WordPress user metadata and manipulate users with the WordPress user functions.
- Customizable: developers can add their own User Actions using action and filter hooks, and more.
- Unlimited websites, unlimited features: there are no restrictions in the number of websites to connect together, and no premium version feature restrictions shenanigans - WP Remote Users Sync is fully-featured right out of the box.
Adding User Actions
Developers can extend the plugin and add their own custom User Actions by using a few filter and action hooks as well as a class inheriting Wprus_Api_Abstract
.
Below is a simple example of implementation of an Example
action calling the example
API endpoint, firing 1 synchronous request and 1 asynchronous request whenever the wp
action hook is called by WordPress, and logs the received data (not to be used in production environment!).
Implementing filter and actions hooks and including a custom User Action API class - example
In this example, we are first creating a simple plugin to implement the action and filter hooks, and include the User Action API class.
Implementing a custom User Action class - example
The User Action's logic is then implemented in the file class-wprus-api-example.php
included by the plugin.
Hooks - actions & filters
WP Remote Users Sync gives developers the possibilty to customise its behavior with a series of custom actions and filters.
Actions
Actions index:
- wprus_init
- wprus_loaded
- wprus_ready
- wprus_unauthorized_access
- wprus_authorized_access
- wprus_ping_fired
- wprus_ping_success
- wprus_ping_failure
- wprus_before_firing_async_actions
- wprus_after_firing_async_actions
- wprus_before_firing_action
- wprus_after_firing_action
- wprus_before_handle_action_notification
- wprus_after_handle_action_notification
- wprus_before_init_notification_hooks
- wprus_after_init_notification_hooks
- wprus_integration
- wprus_integration_run
wprus_loaded
Description
Fired before initializing the plugin's settings.
wprus_loaded
Description
Fired when all the required files have been loaded and the plugin settings are valid.
wprus_ready
Description
Fired when the plugin apis have been fully instantiated, plugin settings are valid, and the plugin is ready to run.
Parameters
$wprus
(mixed) An instance of the Wprus class.
$api
(mixed) Array of API handlers.
$settings
(mixed) Array of settings.
$wprus_logger
(mixed) An instance of the Wprus_Logger class.
wprus_unauthorized_access
Description
Fired when an action is received and the token could not be validated.
Parameters
$endpoint
(string) The API endpoint receiving the action.
$remote_data
(mixed) Decrypted data received from the remote site. Should not be trusted.
$token
(string) The token used to attempt to authorise the request. May contain encrypted data in the case of an asynchronous request.
$wprus_api_object
(mixed) The
Wprus_Api_Abstract
object used to handle the request.
wprus_authorized_access
Description
Fired when an action is received and the token was successfully validated.
Parameters
$endpoint
(string) The API endpoint receiving the action.
$remote_data
(mixed) Decrypted data received from the remote site.
$token
(string) The token used to authorise the request. Contains encrypted data in the case of an asynchronous request.
$wprus_api_object
(mixed) The
Wprus_Api_Abstract
object used to handle the request.
wprus_ping_fired
Description
Fired when a test ping was sent to a remote site.
Parameters
$endpoint
(string) The API endpoint the test ping was sent to.
$ping_data
(mixed) The data sent to perform the ping.
$response
(mixed) The response received from the remote site.
wprus_ping_success
Description
Fired when a test ping was received from a remote site and was successful.
Parameters
$endpoint
(string) The API endpoint receiving the test ping.
$ping_remote_data
(mixed) The data received from the remote site to perform the ping.
$remote_addr
(string) The IP address of the remote site.
wprus_ping_failure
Description
Fired when a test ping was received from a remote site and failed.
Parameters
$endpoint
(string) The API endpoint receiving the test ping.
$ping_remote_data
(mixed) The data received from the remote site to perform the ping.
$remote_addr
(string) The IP address of the remote site.
wprus_before_firing_async_actions
Description
Fired before outputting the asynchronous scripts sending requests to remote sites in the front end.
Parameters
$endpoint
(string) The API endpoint the requests will be sent to.
$actions
(mixed) An array of request data to send to the remote sites. Structure:
$user_id
(int) The ID of the user for which the actions are to be performed.
wprus_after_firing_async_actions
Description
Fired after outputting the asynchronous scripts sending requests to remote sites in the front end.
Parameters
$endpoint
(string) The API endpoint the requests were sent to.
$actions
(mixed) An array of request data to send to the remote sites. Structure:
$user_id
(int) The ID of the user for which the actions were performed.
wprus_before_firing_action
Description
Fired before sending a synchronous request to a remote site.
Parameters
$endpoint
(string) The API endpoint the request will be sent to.
$url
(string) The URL to send the request to.
$data
(mixed) The data sent to the remote site. Structure:
wprus_after_firing_action
Description
Fired after sending a synchronous request to a remote site.
$endpoint
(string) The API endpoint the request will be sent to.
$url
(string) The URL to send the request to.
$data
(mixed) The data sent to the remote site. Structure:
$response
(mixed) Array containing
headers
,body
,response
,cookies
,filename
. AWP_Error
instance upon error.
wprus_before_handle_action_notification
Description
Fired before handling a notification received from a remote site.
Parameters
$endpoint
(string) The API endpoint receiving the notification request.
$data
(mixed) The data received from the remote site. Structure:
wprus_after_handle_action_notification
Description
Fired after handling a notification received from a remote site.
Parameters
$endpoint
(string) The API endpoint receiving the notification request.
$data
(mixed) The data received from the remote site. Structure:
$result
(bool) Wether handling the notification was successful or failed ; any change to user data is considered successful even if warnings were raised (for example, if the Update action was received and a user was created instead of updated).
wprus_before_init_notification_hooks
Description
Fired before adding hooks used to notify remote sites.
Parameters
$endpoint
(string) The API endpoint name of the object adding the notification hooks.
$wprus_api_object
(mixed) The
Wprus_Api_Abstract
object adding the notification hooks.
wprus_after_init_notification_hooks
Description
Fired after adding hooks used to notify remote sites.
Parameters
$endpoint
(string) The API endpoint name of the object adding the notification hooks.
$wprus_api_object
(mixed) The
Wprus_Api_Abstract
object adding the notification hooks.
wprus_require_integration_file
Description
Fired when an integration with a third-party plugin needs to load a class file inheriting Wprus_Integration
.
Parameters
$plugin_slug
(string) The slug of the plugin integrated.
$class_name
(string) The name of the integration class - must inherit
Wprus_Integration
.
wprus_integration
Description
Fired when an integration with a third-party plugin is active and loaded.
Parameters
$wprus_integration_obj
(mixed) The
Wprus_Integration
object used to provide features integration.
$plugin_slug
(string) The slug of the plugin integrated.
wprus_integration_run
Description
Fired when an integration with a third-party plugin hooks is fully initialized.
Parameters
$wprus_integration_obj
(mixed) The
Wprus_Integration
object used to provide features integration.
Filters
Filters index:
- wprus_enabled_api_endpoints
- wprus_api_endpoint
- wprus_api
- wprus_wp_endpoints
- wprus_actions
- wprus_settings
- wprus_option
- wprus_settings_valid
- wprus_settings_metaboxes
- wprus_sanitize_settings
- wprus_excluded_meta_keys
- wprus_excluded_meta_keys_like
- wprus_init_notification_hooks
- wprus_fire_action_timeout
- wprus_request_token_timeout
- wprus_request_token_retry_timeout
- wprus_is_authorized_remote
- wprus_debug
- wprus_action_data
- wprus_registered_integration
- wprus_get_admin_template_name
- wprus_get_admin_template_args
- wprus_get_template_name
- wprus_get_template_args
- wprus_locate_template
- wprus_locate_template_paths
wprus_enabled_api_endpoints
Description
Filter the enabled endpoints.
Parameters
$endpoints
(array) Array of enabled API endpoints. Default:
wprus_api_endpoint
Description
Filter the handler object for a custom endpoint.
Parameters
$endpoint_handler
(mixed) The object instance of a class inherhiting the
Wprus_Api_Abstract
API class. Defaultfalse
.
$api_endpoint
(string) The custom API endpoint.
$settings
(mixed) Array of all the settings.
wprus_api
Description
Filter the collection of API handlers.
Parameters
$api
(mixed) Array of API handlers. Default:
wprus_wp_endpoints
Description
Filter the endpoints to add to WordPress.
Documented here for the sake of completeness and in case some developers find it useful in very specific cases - adding endpoints to the list should be handled automatically by a class inheriting the Wprus_Api_Abstract
class instead of using this filter.
Parameters
$wprus_endpoints
(mixed) Array of endpoints to add. Default:
wprus_actions
Description
Filter the supported actions.
Parameters
$actions
(mixed) Array of actions - key is the action key, value is the action display value. Default:
wprus_settings
Description
Filter the settings' values.
Parameters
$settings
(mixed) Array of all the settings.
wprus_option
Description
Filter a single setting's option value.
Parameters
$value
(mixed) the value of the option
$key (string) the key used to retrieve the option value
wprus_settings_valid
Description
Filter wether the settings are valid ; called before running any other part of the plugin.
Parameters
$valid
(bool) Wether the settings are valid.
$settings
(mixed ) Array of all the settings.
wprus_settings_metaboxes
Description
Filter the setting's metaboxes of the plugin's screen.
Parameters
$metaboxes
(mixed) Array representing the metaboxes. Structure:
wprus_sanitize_settings
Description
Filter the settings after sanitatization.
Parameters
$sanitized_settings
(mixed) Array of all the settings after sanitatization.
wprus_excluded_meta_keys
Description
Filter the meta keys excluded from selection for synchronization (by default, keys referring to redundant or site-specific data).
Parameters
$excluded_meta_keys
(mixed) Array of exluded meta keys. Default:
wprus_excluded_meta_keys_like
Description
Filter the meta keys LIKE
clauses used to exclude groups of meta keys from selection for synchronization (by default, keys referring to redundant or site-specific data).
Parameters
$excluded_meta_keys_like_expressions
(mixed) Array of meta keys
LIKE
expressions. Default:
wprus_init_notification_hooks
Description
Filter wether to initialise the notification hooks for the current request.
Warning: Must be added before WordPress runs the init
action.
Parameters
$init_notification_hooks
(bool) If truthy, hooks will be initialised and notifications will be sent to remote sites upon user changes. Set to a falsy value to prevent notifications from being sent. Default
true
except in the case of user import.
wprus_fire_action_timeout
Description
Filter the timeout for a synchronous action request.
Parameters
$timeout
(int) The timeout for a synchronous action request expressed in seconds. Default
1
.
$endpoint
(string) The destination endpoint.
$url
(string) The destination website's URL.
$blocking
(bool) Whether the request needs to wait for a response.
wprus_request_token_timeout
Description
Filter the timeout for an authentication token request.
Parameters
$token_timeout
(int) The timeout for a token request expressed in seconds. Default
1
.
wprus_request_token_retry_timeout
Description
Filter the retry timeout for an authentication token request, in case the first request failed.
Parameters
$token_retry_timeout
(int) The retry timeout for token request expressed in seconds. Default
5
.
wprus_is_authorized_remote
Description
Filter wether the received request should be authorised.
Parameters
$is_authorized_remote
(bool) Whether the request is authorised.
$method
(string) The request's method -
post
orget
.
$remote_addr
(string) The IP address received in the
REMOTE_ADDR
header.
$ip_whitelist
(mixed) An array of strings as defined in the "IP Whitelist" settings.
wprus_debug
Description
Filter wether to activate debug mode (PHP error logs, JavaScript console messages, JavaScript alerts if any).
Parameters
$debug
(bool) Wether debug mode is activated - default
WP_DEBUG
constant value.
wprus_action_data
Description
Filter the data sent to a remote site.
Parameters
$data
(array) The data sent to the remote site.
$endpoint
(string) The API endpoint receiving the action.
$url
(string) The URL of the remote site.
wprus_registered_integration
Description
Filter integrations. See inc/integration/class-wprus-integration.php
.
Parameters
$integrations
(array) The integrations info. Structure:
wprus_get_admin_template_name
Description
Filter the file name of the template to include.
Parameters
$template_name
(string) The file name of the template to include.
$args
(array) The variables passed to the template.
wprus_get_admin_template_args
Description
Filter the variables passed to the template.
Parameters
$args
(array) The variables passed to the template.
$template_name
(string) The file name of the template.
wprus_get_template_name
Description
Filter the file name of the template to include.
Parameters
$template_name
(string) The file name of the template to include.
$args
(array) The variables passed to the template.
wprus_get_template_args
Description
Filter the variables passed to the template.
Parameters
$args
(array) The variables passed to the template.
$template_name
(string) The file name of the template.
wprus_locate_template
Description
Filter the fully qualified path of the template file.
Parameters
$template_file
(string) The fully qualified path of the template file.
$template_name
(string) The file name.
$template_path
(string) The file path.
wprus_locate_admin_template
Description
Filter the fully qualified path of the admin template file.
Parameters
$template_file
(string) The fully qualified path of the admin template file.
$template_name
(string) The file name.
$template_path
(string) The file path.
wprus_locate_template_paths
Description
Filter the list of possible theme paths for the template file.
Parameters
$paths
(array) The list of possible theme paths for the template file. Structure: