Skip to content

Pro hooks reference ​

Hooks of the Pro add-on (prefix ubdwpp_). Pro also uses the hooks of the free plugin, which remain the main way to extend filters, exports and deletions. All hooks below are available since 1.0.0.

Recycle bin ​

ubdwpp_snapshot_data ​

filter

The data kept in the recycle bin for a user. Add data of your plugin here to give it back when the user is restored, or to clean it up when the user leaves the bin.

ParameterTypeDescription
$dataarray<string, mixed>Snapshot data
$userWP_UserUser about to be deleted

ubdwpp_user_restored ​

action

Fires after a user was restored from the recycle bin.

ParameterTypeDescription
$user_idintUser ID
$entryobjectRecycle bin entry, with the decoded data

ubdwpp_bin_entries_removed ​

action

Fires after users were removed from the bin for good (emptied, expired or deleted permanently), to clean up data that was kept so they could be restored. $entries is an array of entries with their decoded data.

php
// Keep a "credits" user meta in the bin and give it back on restore.
add_filter( 'ubdwpp_snapshot_data', function ( $data, $user ) {
	$data['my_credits'] = get_user_meta( $user->ID, 'credits', true );
	return $data;
}, 10, 2 );

add_action( 'ubdwpp_user_restored', function ( $user_id, $entry ) {
	if ( isset( $entry->data['my_credits'] ) ) {
		update_user_meta( $user_id, 'credits', $entry->data['my_credits'] );
	}
}, 10, 2 );

Blocked registrations ​

HookTypeParametersDescription
ubdwpp_registration_blockedfilter( bool $blocked, string $email, string $login )Whether a registration is blocked
ubdwpp_registration_blocked_messagefilter( string $message )The error shown when a registration is blocked

Filters ​

HookTypeParametersDescription
ubdwpp_disposable_domainsfilter( array $domains )Lowercase domains of the "Disposable email" filter
ubdwpp_wc_order_statusesfilter( array $statuses )Order statuses counted by the WooCommerce filters, without the wc- prefix
ubdwpp_login_import_sourcesfilter( array $sources )User meta keys the last login is imported from, with plugin names; values may be Unix timestamps (seconds or milliseconds) or dates
ubdwpp_saved_filter_usagefilter( array $usage, string $filter_id )What uses a saved filter; a filter in use cannot be deleted

Scheduled cleanups ​

HookTypeParametersDescription
ubdwpp_warnings_per_runfilter( int $limit, array $schedule )Warning emails one run sends; the others are sent on the next runs
ubdwpp_is_scheduled_jobfilter( bool $scheduled, int $job_id )Whether a deletion job was started by a scheduled cleanup

Multisite ​

HookTypeParametersDescription
ubdwpp_network_user_deletedaction( int $user_id, WP_User $user )After an account was deleted from the whole network

Settings and modules ​

HookTypeParametersDescription
ubdwpp_default_settingsfilter( array $defaults )Default settings, keyed by setting name
ubdwpp_sanitize_settingsfilter( array|WP_Error $settings, array $input )Sanitize the fields of your module; return a WP_Error to refuse the form
ubdwpp_settings_tab_endaction( string $tab )Print sections at the end of a Pro tab of the Settings page, after the Save button
ubdwpp_modulesfilter( array $module_classes )Module classes (implementing UbdwppModuleInterface) keyed by name
ubdwpp_setup_siteaction( string $previous_version )The add-on data of the site is created or upgraded (licensed copies only); create your tables here
ubdwpp_clear_scheduled_eventsaction—The add-on is deactivated; unschedule your events
ubdwpp_fs_loadedaction( Freemius $freemius )The Freemius SDK of the add-on was started

The free plugin is released under the GPL v2 or later. The Pro add-on is sold through Freemius.