Skip to content

Actions and filters

OAuth: 15 hooks.

Every hook here has a description in the source.

7 actions8 filters

action

davo_social_login_after_builtin_providers

Fires after built-in providers are registered. Hook here to register Facebook, Discord, LinkedIn, Apple, etc.

Example: add_action( 'davo_social_login_after_builtin_providers', function( $registry ) { $registry->register( new OAuth_Provider_Facebook() ); });

Parameters of davo_social_login_after_builtin_providers
ParameterTypeDescription
$registryOAuth_Provider_RegistryProvider registry.
add_action
add_action( 'davo_social_login_after_builtin_providers', 'my_action_callback', 10, 1 );

/**
 * @param OAuth_Provider_Registry $registry
 */
function my_action_callback( $registry ) {
	// Your code here.
}

src/domains/oauth/initializer.php:182

filter

davo_social_login_allow_registration

Filter to allow social registration even when general registration is off. Set to true in the admin to allow social-only registration.

Parameters of davo_social_login_allow_registration
ParameterTypeDescription
$allowboolWhether to allow social registration.
$provider_idstringProvider slug.
add_filter
add_filter( 'davo_social_login_allow_registration', 'my_filter_callback', 10, 2 );

/**
 * @param bool $allow
 * @param string $provider_id
 */
function my_filter_callback( $allow, $provider_id ) {
	// Change $allow as needed, then return it.
	return $allow;
}

src/domains/oauth/repository.php:386

filter

davo_social_login_auth_params

Filters the query parameters of a provider's authorization URL.

Parameters of davo_social_login_auth_params
ParameterTypeDescription
$paramsarray<string, string>The query parameters.
$provider_idstringProvider ID.

Returns array<string, string>

add_filter
add_filter( 'davo_social_login_auth_params', 'my_filter_callback', 10, 2 );

/**
 * @param array<string, string> $params
 * @param string $provider_id
 */
function my_filter_callback( $params, $provider_id ) {
	// Change $params as needed, then return it.
	return $params;
}

src/domains/oauth/provider-abstract.php:231

action

davo_social_login_avatar_fetch_failed

Fires when seeding a new user's avatar from their social provider's photo fails. Purely informational — the user account and login already succeeded regardless.

Parameters of davo_social_login_avatar_fetch_failed
ParameterTypeDescription
$user_idintWordPress user ID.
$urlstringProvider avatar URL that failed.
$errorWP_ErrorThe resulting error.
add_action
add_action( 'davo_social_login_avatar_fetch_failed', 'my_action_callback', 10, 3 );

/**
 * @param int $user_id
 * @param string $url
 * @param WP_Error $error
 */
function my_action_callback( $user_id, $url, $error ) {
	// Your code here.
}

src/domains/oauth/repository.php:462

filter

davo_social_login_bind_state_to_browser

Filters whether the sign-in state is bound to the browser with a cookie. On by default. It can be switched off for hosts whose cache strips Set-Cookie from REST responses.

Parameters of davo_social_login_bind_state_to_browser
ParameterTypeDescription
$bindboolWhether to bind the state.
$provider_idstringProvider ID.

Returns bool

add_filter
add_filter( 'davo_social_login_bind_state_to_browser', 'my_filter_callback', 10, 2 );

/**
 * @param bool $bind
 * @param string $provider_id
 */
function my_filter_callback( $bind, $provider_id ) {
	// Change $bind as needed, then return it.
	return $bind;
}

src/domains/oauth/provider-abstract.php:337

action

davo_social_login_connection_unlinked

Fires after a social connection is unlinked.

Parameters of davo_social_login_connection_unlinked
ParameterTypeDescription
$user_idintWordPress user ID.
$provider_idstringProvider slug.
add_action
add_action( 'davo_social_login_connection_unlinked', 'my_action_callback', 10, 2 );

/**
 * @param int $user_id
 * @param string $provider_id
 */
function my_action_callback( $user_id, $provider_id ) {
	// Your code here.
}

src/domains/oauth/repository.php:237

action

davo_social_login_linking_to_existing_user

Fires before linking a new provider to an existing user.

Parameters of davo_social_login_linking_to_existing_user
ParameterTypeDescription
$existingWP_UserWordPress user.
$profileOAuth_ProfileNormalized profile.
add_action
add_action( 'davo_social_login_linking_to_existing_user', 'my_action_callback', 10, 2 );

/**
 * @param WP_User $existing
 * @param OAuth_Profile $profile
 */
function my_action_callback( $existing, $profile ) {
	// Your code here.
}

src/domains/oauth/repository.php:310

filter

davo_social_login_new_user_data

Filter the new user data before insertion.

Parameters of davo_social_login_new_user_data
ParameterTypeDescription
$user_dataarray<string, mixed>User data array.
$profileOAuth_ProfileNormalized provider profile.
add_filter
add_filter( 'davo_social_login_new_user_data', 'my_filter_callback', 10, 2 );

/**
 * @param array<string, mixed> $user_data
 * @param OAuth_Profile $profile
 */
function my_filter_callback( $user_data, $profile ) {
	// Change $user_data as needed, then return it.
	return $user_data;
}

src/domains/oauth/repository.php:419

filter

davo_social_login_provider_enabled

Filters whether a social sign-in provider is enabled. Defaults to the provider's own enabled setting, which is off until the owner turns it on.

Parameters of davo_social_login_provider_enabled
ParameterTypeDescription
$enabledboolWhether the provider is enabled.
$provider_idstringProvider ID.

Returns bool

add_filter
add_filter( 'davo_social_login_provider_enabled', 'my_filter_callback', 10, 2 );

/**
 * @param bool $enabled
 * @param string $provider_id
 */
function my_filter_callback( $enabled, $provider_id ) {
	// Change $enabled as needed, then return it.
	return $enabled;
}

src/domains/oauth/provider-abstract.php:143

action

davo_social_login_register_providers

Fires when the social provider registry is ready to accept registrations.

Parameters of davo_social_login_register_providers
ParameterTypeDescription
$registryOAuth_Provider_RegistryThe registry instance.
add_action
add_action( 'davo_social_login_register_providers', 'my_action_callback', 10, 1 );

/**
 * @param OAuth_Provider_Registry $registry
 */
function my_action_callback( $registry ) {
	// Your code here.
}

src/domains/oauth/provider-registry.php:61

filter

davo_social_login_store_provider_tokens

Filters whether the provider's tokens are stored with the sign-in connection. Defaults to false.

Parameters of davo_social_login_store_provider_tokens
ParameterTypeDescription
$storeboolWhether to store the tokens.
$profile\OAuth_ProfileThe normalized provider profile.
$user_idintThe connected user's ID.

Returns bool

add_filter
add_filter( 'davo_social_login_store_provider_tokens', 'my_filter_callback', 10, 3 );

/**
 * @param bool $store
 * @param \OAuth_Profile $profile
 * @param int $user_id
 */
function my_filter_callback( $store, $profile, $user_id ) {
	// Change $store as needed, then return it.
	return $store;
}

src/domains/oauth/repository.php:500

action

davo_social_login_success

Fires after a successful social login.

Parameters of davo_social_login_success
ParameterTypeDescription
$userWP_UserThe authenticated user.
$profileOAuth_ProfileNormalized provider profile.
$provider_idstringProvider slug.
add_action
add_action( 'davo_social_login_success', 'my_action_callback', 10, 3 );

/**
 * @param WP_User $user
 * @param OAuth_Profile $profile
 * @param string $provider_id
 */
function my_action_callback( $user, $profile, $provider_id ) {
	// Your code here.
}

src/domains/oauth/repository.php:159

filter

davo_social_login_token_encryption_key_material

Filters the key material used to derive the AES-256-GCM key for encrypting stored provider access/refresh tokens.

Return raw key material of any length (it is hashed down to 32 bytes) — not the final key itself.

Parameters of davo_social_login_token_encryption_key_material
ParameterTypeDescription
$default_materialstringDefault material (WP's AUTH_KEY + SECURE_AUTH_KEY salt).
add_filter
add_filter( 'davo_social_login_token_encryption_key_material', 'my_filter_callback', 10, 1 );

/**
 * @param string $default_material
 */
function my_filter_callback( $default_material ) {
	// Change $default_material as needed, then return it.
	return $default_material;
}

src/domains/oauth/database.php:573

filter

davo_social_login_token_exchange_headers_{suffix}

Filters the headers sent with the token-exchange POST request.

Lets a concrete provider (e.g. X, which requires Basic Auth credentials instead of client_id/client_secret in the body) inject custom headers for its own token exchange only.

The name is built at runtime: davo_social_login_token_exchange_headers_ followed by a suffix.

Parameters of davo_social_login_token_exchange_headers_…
ParameterTypeDescription
$headersarray<string, string>Headers to send (empty by default).
add_filter
// $suffix is the part of the name that varies.
add_filter( 'davo_social_login_token_exchange_headers_' . $suffix, 'my_filter_callback', 10, 1 );

/**
 * @param array<string, string> $headers
 */
function my_filter_callback( $headers ) {
	// Change $headers as needed, then return it.
	return $headers;
}

src/domains/oauth/provider-abstract.php:539

action

davo_social_login_user_created

Fires after a new user is created via social login.

Parameters of davo_social_login_user_created
ParameterTypeDescription
$userWP_UserNewly created user.
$profileOAuth_ProfileNormalized provider profile.
add_action
add_action( 'davo_social_login_user_created', 'my_action_callback', 10, 2 );

/**
 * @param WP_User $user
 * @param OAuth_Profile $profile
 */
function my_action_callback( $user, $profile ) {
	// Your code here.
}

src/domains/oauth/repository.php:476

Note. Generated from the plugin source. Descriptions and parameters are the ones written in the code. The starter code uses the parameter names from those comments, or generic names where there are none, so check them against your use.

See it on your own site.

Davo is a WordPress theme and plugin by Exorex.

  • Runs on your own WordPress
  • Guided setup wizard
  • AI is off until you switch it on
  • Read the licence on the marketplace first