Created
November 3, 2022 11:00
-
-
Save yuriinalivaiko/49905e3714c3ac572f6f908d0f7ef123 to your computer and use it in GitHub Desktop.
Login hooks examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Hook: um_login_form_button_one | |
* | |
* Type: filter | |
* | |
* Description: Change the Login Form primary button text. | |
* | |
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/um-actions-login.php#L358 | |
* @link https://docs.ultimatemember.com/article/1166-umloginformbuttonone | |
* | |
* @package um\core | |
* @see um_add_submit_button_to_login() | |
* @since 2.0 | |
* @version 3.0 | |
* | |
* @param string $primary_btn_word Button text. | |
* @param array $args Login Form arguments. | |
*/ | |
function my_login_form_button_one( $primary_btn_word, $args ) { | |
// your code here. | |
return $primary_btn_word; | |
} | |
add_filter( 'um_login_form_button_one', 'my_login_form_button_one', 10, 2 ); | |
/** | |
* Hook: um_login_form_button_two | |
* | |
* Type: filter | |
* | |
* Description: Change the Login Form secondary button text. | |
* | |
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/um-actions-login.php#L386 | |
* @link https://docs.ultimatemember.com/article/1167-umloginformbuttontwo | |
* | |
* @package um\core | |
* @see um_add_submit_button_to_login() | |
* @since 2.0 | |
* @deprecated since version 3.0 | |
* | |
* @param string $secondary_btn_word Button text. | |
* @param array $args Login Form arguments. | |
*/ | |
function my_login_form_button_two( $secondary_btn_word, $args ) { | |
// your code here. | |
return $secondary_btn_word; | |
} | |
add_filter( 'um_login_form_button_two', 'my_login_form_button_two', 10, 2 ); | |
/** | |
* Hook: um_login_form_button_two_url | |
* | |
* Type: filter | |
* | |
* Description: Change the Login Form secondary button URL. | |
* | |
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/um-actions-login.php#L415 | |
* @link https://docs.ultimatemember.com/article/1168-umloginformbuttontwourl | |
* | |
* @package um\core | |
* @see um_add_submit_button_to_login() | |
* @since 2.0 | |
* @deprecated since version 3.0 | |
* | |
* @param string $secondary_btn_url Button URL. | |
* @param array $args Login Form arguments. | |
*/ | |
function my_login_form_button_two_url( $secondary_btn_url, $args ) { | |
// your code here. | |
return $secondary_btn_url; | |
} | |
add_filter( 'um_login_form_button_two_url', 'my_login_form_button_two_url', 10, 2 ); | |
/** | |
* Hook: um_main_{$mode}_fields | |
* | |
* Type: action | |
* | |
* Description: Fires before rendering main form fields. | |
* | |
* @example https://github.com/ultimatemember/ultimatemember/blob/master/templates/login.php#L71 | |
* @link https://docs.ultimatemember.com/article/1171-ummainmodefields | |
* | |
* @package um\templates | |
* @see templates/login.php | |
* @since 2.0 | |
* @version 3.0 | |
* | |
* @param array $args The form shortcode arguments. | |
*/ | |
function my_before_main_fields( $args ) { | |
// your code here. | |
} | |
$mode = 'login'; | |
add_action( "um_main_{$mode}_fields", 'my_before_main_fields', 10, 1 ); | |
/** | |
* Hook: um_submit_form_errors_hook_login | |
* | |
* Type: action | |
* | |
* Description: Fires on the Login Form submit validation. | |
* | |
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/um-actions-form.php#L222 | |
* @link https://docs.ultimatemember.com/article/1279-umsubmitformerrorshooklogin | |
* | |
* @package um\core | |
* @see um_submit_form_errors_hook() | |
* @since 2.0 | |
* @version 3.0 | |
* | |
* @param array $args Form arguments. | |
*/ | |
function my_submit_form_errors_hook_login( $args ) { | |
// your code here. | |
} | |
add_action( 'um_submit_form_errors_hook_login', 'my_submit_form_errors_hook_login', 10, 1 ); | |
/** | |
* Hook: um_user_login | |
* | |
* Type: action | |
* | |
* Description: Fires after the Login Form successful submit. | |
* Used in the core for login and redirect after the Login Form validation. | |
* | |
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/um-actions-login.php#L303 | |
* @link https://docs.ultimatemember.com/article/1298-umuserlogin | |
* | |
* @package um\core | |
* @see um_submit_form_login() | |
* @see um_user_login() | |
* @since 2.0 | |
* @deprecated since version 3.0 | |
* | |
* @param array $args Form data. | |
*/ | |
function my_user_login( $args ) { | |
// your code here. | |
} | |
add_action( 'um_user_login', 'my_user_login', 10, 1 ); | |
/** | |
* Hook: um_admin_custom_login_metaboxes | |
* | |
* Type: action | |
* | |
* Description: Add custom metaboxes for the Login Form type. | |
* | |
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/admin/core/class-admin-metabox.php#L1040 | |
* @link https://docs.ultimatemember.com/article/983-umadmincustomloginmetaboxes | |
* | |
* @package um\admin\core | |
* @see um\admin\core\Admin_Metabox::add_metabox_form() | |
* @since 2.0 | |
* @deprecated since version 3.0 | |
*/ | |
function my_admin_custom_login_metaboxes() { | |
// your code here. | |
} | |
add_action( 'um_admin_custom_login_metaboxes', 'my_admin_custom_login_metaboxes', 10 ); | |
/** | |
* Hook: um_user_login_extra_hook | |
* | |
* Type: action | |
* | |
* Description: Fires after the Login Form successful submit. | |
* | |
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/um-actions-login.php#L325 | |
* @link https://docs.ultimatemember.com/article/1299-umuserloginextrahook | |
* | |
* @package um\core | |
* @see um_submit_form_login() | |
* @since 2.0 | |
* @version 3.0 | |
* | |
* @param array $args Form data. | |
*/ | |
function my_user_login_extra( $args ) { | |
// your code here. | |
} | |
add_action( 'um_user_login_extra_hook', 'my_user_login_extra', 10, 1 ); | |
/** | |
* Hook: um_submit_form_errors_hook_logincheck | |
* | |
* Type: action | |
* | |
* Description: Fires on the Login Form validation. | |
* Used in the core to verify members by their 'account_status' before login. | |
* | |
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/um-actions-form.php#L244 | |
* @link https://docs.ultimatemember.com/article/1280-umsubmitformerrorshooklogincheck | |
* | |
* @package um\core | |
* @see um_submit_form_errors_hook() | |
* @see um_submit_form_errors_hook_logincheck() | |
* @since 2.0 | |
* @version 3.0 | |
* | |
* @param array $args Form arguments. | |
*/ | |
function my_submit_form_errors_hook_logincheck( $args ) { | |
// your code here. | |
} | |
add_action( 'um_submit_form_errors_hook_logincheck', 'my_submit_form_errors_hook_logincheck', 10, 1 ); | |
/** | |
* Hook: um_on_login_before_redirect | |
* | |
* Type: action | |
* | |
* Description: Fires after successful login and before user is redirected. | |
* Used in the core to store the last login timestamp. | |
* May be used to customize cookies before login redirect or log logins. | |
* | |
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/um-actions-login.php#L216 | |
* @link https://docs.ultimatemember.com/article/1188-umonloginbeforeredirect | |
* | |
* @package um\core | |
* @see um_user_login() | |
* @see um_store_lastlogin_timestamp() | |
* @since 2.0 | |
* @version 3.0 | |
* | |
* @param int $user_id User ID. | |
*/ | |
function my_on_login_before_redirect( $user_id ) { | |
// your code here. | |
} | |
add_action( 'um_on_login_before_redirect', 'my_on_login_before_redirect', 10, 1 ); | |
/** | |
* Hook: um_submit_form_errors_hook__blockedemails | |
* | |
* Type: action | |
* | |
* Description: Fires on the form validation. | |
* Used in the core to verify members by their Email before login. | |
* | |
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/um-actions-form.php#L150 | |
* @link https://docs.ultimatemember.com/article/1275-umsubmitformerrorshookblockedemails | |
* | |
* @package um\core | |
* @see um_submit_form_errors_hook() | |
* @see um_submit_form_errors_hook__blockedemails() | |
* @see um_wp_form_errors_hook_ip_test() | |
* @since 2.0 | |
* @version 3.0 | |
* | |
* @param array $args Form arguments. | |
*/ | |
function my_submit_form_errors_hook__blockedemails( $args ) { | |
// your code here. | |
} | |
add_action( 'um_submit_form_errors_hook__blockedemails', 'my_submit_form_errors_hook__blockedemails', 10, 1 ); | |
/** | |
* Hook: um_submit_form_errors_hook__blockedips | |
* | |
* Type: action | |
* | |
* Description: Fires on the form validation. | |
* Used in the core to verify members by their IP before login. | |
* | |
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/um-actions-form.php#L128 | |
* @link https://docs.ultimatemember.com/article/1276-umsubmitformerrorshookblockedips | |
* | |
* @package um\core | |
* @see um_submit_form_errors_hook() | |
* @see um_submit_form_errors_hook__blockedips() | |
* @see um_wp_form_errors_hook_ip_test() | |
* @since 2.0 | |
* @version 3.0 | |
* | |
* @param array $args Form arguments. | |
*/ | |
function my_submit_form_errors_hook__blockedips( $args ) { | |
// your code here. | |
} | |
add_action( 'um_submit_form_errors_hook__blockedips', 'my_submit_form_errors_hook__blockedips', 10, 1 ); | |
/** | |
* Hook: um_submit_form_data | |
* | |
* Type: filter | |
* | |
* Description: Change submitted data on form submit. | |
* Used in the core to prepare role fields data and trim input string values. | |
* | |
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-form.php#L546 | |
* @link https://docs.ultimatemember.com/article/1271-umsubmitformdata | |
* | |
* @package um\core | |
* @see um\core\Form::form_init() | |
* @see um_submit_form_data_role_fields() | |
* @see um_submit_form_data_trim_fields() | |
* @since 2.0 | |
* @version 3.0 | |
* | |
* @param array $data Submitted data. | |
* @param string $mode Form mode. | |
* | |
* @return array Submitted data. | |
*/ | |
function my_submit_form_data( $data, $mode ) { | |
if ( 'login' === $mode ) { | |
// your code here. | |
} | |
return $data; | |
} | |
add_filter( 'um_submit_form_data', 'my_submit_form_data', 10, 2 ); | |
/** | |
* Hook: um_submit_post_form | |
* | |
* Type: filter | |
* | |
* Description: Change submitted data on form submit. | |
* May be used to modify raw input data before the data sanitize. | |
* | |
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-form.php#L448 | |
* @link https://docs.ultimatemember.com/article/1282-umsubmitpostform | |
* | |
* @package um\core | |
* @see um\core\Form::form_init() | |
* @since 2.0 | |
* @version 3.0 | |
* | |
* @param array $data Submitted data. | |
* | |
* @return array Submitted data. | |
*/ | |
function my_submit_post_form( $data ) { | |
// your code here. | |
return $data; | |
} | |
add_filter( 'um_submit_post_form', 'my_submit_post_form', 10, 1 ); | |
/** | |
* Hook: um_submit_form_error | |
* | |
* Type: filter | |
* | |
* Description: Change error text on the form submit. | |
* | |
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-form.php#L289 | |
* @link https://docs.ultimatemember.com/article/1272-umsubmitformerror | |
* | |
* @package um\core | |
* @see um\core\Form::add_error() | |
* @since 2.0 | |
* @version 3.0 | |
* | |
* @param string $error Error string. | |
* @param string $key Error key. | |
* | |
* @return string Error string. | |
*/ | |
function my_submit_form_error( $error, $key ) { | |
// your code here. | |
return $error; | |
} | |
add_filter( 'um_submit_form_error', 'my_submit_form_error', 10, 2 ); | |
/** | |
* Hook: um_get_form_fields | |
* | |
* Type: filter | |
* | |
* Description: Extend form fields. | |
* Used in the core to prepare form fields. | |
* | |
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-fields.php#L1524 | |
* @link https://docs.ultimatemember.com/article/1143-umgetformfields | |
* | |
* @package um\core | |
* @see um\core\Fields::get_fields() | |
* @see um_get_form_fields() | |
* @since 2.0 | |
* @version 3.0 | |
* | |
* @param array $fields Form fields. | |
* | |
* @return array|string An array of fields or empty string if the form is not set. | |
*/ | |
function my_get_form_fields( $fields ) { | |
// your code here. | |
return $fields; | |
} | |
add_filter( 'um_get_form_fields', 'my_get_form_fields', 100, 1 ); | |
/** | |
* Hook: um_submit_form_{$mode} | |
* | |
* Type: action | |
* | |
* Description: Fires on the form submit. | |
* | |
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-form.php#L589 | |
* @link https://docs.ultimatemember.com/article/1281-umsubmitformmode | |
* | |
* @package um\core | |
* @see um\core\Form::form_init() | |
* @since 2.0 | |
* @version 3.0 | |
* | |
* @param array $post Post data. | |
*/ | |
function my_submit_form( $post ) { | |
// your code here. | |
} | |
$mode = 'login'; | |
add_action( "um_submit_form_{$mode}", 'my_submit_form', 10, 1 ); | |
/** | |
* Hook: um_submit_form_errors_hook | |
* | |
* Type: action | |
* | |
* Description: Fires on the form submit. | |
* Used in the core to manage a form verification by the form type. | |
* | |
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-form.php#L569 | |
* @link https://docs.ultimatemember.com/article/1273-umsubmitformerrorshook | |
* | |
* @package um\core | |
* @see um\core\Form::form_init() | |
* @see um_submit_form_errors_hook() | |
* @since 2.0 | |
* @version 3.0 | |
* | |
* @param array $post Post data. | |
*/ | |
function my_submit_form_errors( $post ) { | |
// your code here. | |
} | |
add_action( 'um_submit_form_errors_hook', 'my_submit_form_errors', 10, 1 ); | |
/** | |
* Hook: um_submit_form_errors_hook_ | |
* | |
* Type: action | |
* | |
* Description: Fires on the form validation. | |
* Used in the core to process form errors. | |
* | |
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/um-actions-form.php#L293 | |
* @link https://docs.ultimatemember.com/article/1274-umsubmitformerrorshook | |
* | |
* @package um\core | |
* @see um_submit_form_errors_hook() | |
* @see um_submit_form_errors_hook_() | |
* @since 2.0 | |
* @version 3.0 | |
* | |
* @param array $args Form arguments. | |
*/ | |
function my_submit_form_errors_hook( $args ) { | |
// your code here. | |
} | |
add_action( 'um_submit_form_errors_hook_', 'my_submit_form_errors_hook', 10, 1 ); | |
/** | |
* Hook: um_before_form_is_loaded | |
* | |
* Type: action | |
* | |
* Description: Fires before the form shortcode is loaded. | |
* | |
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-shortcodes.php#L772 | |
* @link https://docs.ultimatemember.com/article/1060-umbeforeformisloaded | |
* | |
* @package um\core | |
* @see um\core\Shortcodes::load() | |
* @since 2.0 | |
* @version 3.0 | |
* | |
* @param array $args Form shortcode arguments. | |
*/ | |
function my_before_form_is_loaded( $args ) { | |
// your code here. | |
} | |
add_action( 'um_before_form_is_loaded', 'my_before_form_is_loaded', 10, 1 ); | |
/** | |
* Hook: um_form_fields_textarea_settings | |
* | |
* Type: filter | |
* | |
* Description: Change WP Editor options for textarea init. | |
* | |
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-fields.php#L2737 | |
* @link https://docs.ultimatemember.com/article/1134-umformfieldstextareasettings | |
* | |
* @package um\core | |
* @see um\core\Fields::edit_field() | |
* @since 2.0 | |
* @version 3.0 | |
* | |
* @param array $textarea_settings WP Editor settings. | |
* | |
* @return array WP Editor settings. | |
*/ | |
function my_textarea_settings( $textarea_settings ) { | |
// your code here. | |
return $textarea_settings; | |
} | |
add_filter( 'um_form_fields_textarea_settings', 'my_textarea_settings', 10, 1 ); | |
/** | |
* Hook: um_{$key}_form_edit_field | |
* | |
* Type: filter | |
* | |
* Description: Change field HTML by field $key. | |
* | |
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-fields.php#L3882 | |
* @link https://docs.ultimatemember.com/article/1321-umkeyformeditfield | |
* | |
* @package um\core | |
* @see um\core\Fields::edit_field() | |
* @since 2.0 | |
* @version 3.0 | |
* | |
* @param string $output Field HTML. | |
* @param string $mode Form mode. | |
* | |
* @return string Field HTML. | |
*/ | |
function my_form_edit_field( $output, $mode ) { | |
if ( 'login' === $mode ) { | |
// your code here. | |
} | |
return $output; | |
} | |
$key = 'user_email'; | |
add_filter( "um_{$key}_form_edit_field", 'my_form_edit_field', 10, 2 ); | |
/** | |
* Hook: um_{$key}_form_show_field | |
* | |
* Type: filter | |
* | |
* Description: Change field HTML by field $key. | |
* | |
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-fields.php#L4468 | |
* @link https://docs.ultimatemember.com/article/1322-umkeyformshowfield | |
* | |
* @package um\core | |
* @see um\core\Fields::view_field() | |
* @since 2.0 | |
* @version 3.0 | |
* | |
* @param string $output Field HTML. | |
* @param string $mode Form mode. | |
* | |
* @return string Field HTML. | |
*/ | |
function my_key_form_show_field( $output, $mode ) { | |
if ( 'login' === $mode ) { | |
// your code here. | |
} | |
return $output; | |
} | |
$key = 'user_email'; | |
add_filter( "um_{$key}_form_show_field", 'my_key_form_show_field', 10, 2 ); | |
/** | |
* Hook: um_{$type}_form_show_field | |
* | |
* Type: filter | |
* | |
* Description: Change field HTML by field $type. | |
* | |
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-fields.php#L4490 | |
* @link https://docs.ultimatemember.com/article/1323-umtypeformshowfield | |
* | |
* @package um\core | |
* @see um\core\Fields::view_field() | |
* @since 2.0 | |
* @version 3.0 | |
* | |
* @param string $output Field HTML. | |
* @param string $mode Form mode. | |
* | |
* @return string Field HTML. | |
*/ | |
function my_type_form_show_field( $output, $mode ) { | |
if ( 'login' === $mode ) { | |
// your code here. | |
} | |
return $output; | |
} | |
$type = 'text'; | |
add_filter( "um_{$type}_form_show_field", 'my_type_form_show_field', 10, 2 ); | |
/** | |
* Hook: um_form_official_classes__hook | |
* | |
* Type: filter | |
* | |
* Description: Change official form classes. | |
* | |
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-shortcodes.php#L349 | |
* @link https://docs.ultimatemember.com/article/1135-umformofficialclasseshook | |
* | |
* @package um\core | |
* @see um\core\Shortcodes::get_class() | |
* @since 2.0 | |
* @version 3.0 | |
* | |
* @param string $classes Classes string. | |
* | |
* @return string Classes string. | |
*/ | |
function my_form_official_classes( $classes ) { | |
// your code here. | |
return $classes; | |
} | |
add_filter( 'um_form_official_classes__hook', 'my_form_official_classes', 10, 1 ); | |
/** | |
* Hook: um_core_form_meta_all | |
* | |
* Type: filter | |
* | |
* Description: Extend UM forms meta keys. | |
* | |
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/class-config.php#L230 | |
* @link https://docs.ultimatemember.com/article/1087-umcoreformmetaall | |
* | |
* @package um | |
* @see um\Config::__construct() | |
* @since 2.0 | |
* @version 3.0 | |
* | |
* @param array $meta UM forms meta. | |
* | |
* @return array UM forms meta. | |
*/ | |
function my_core_form_meta( $meta ) { | |
// your code here. | |
return $meta; | |
} | |
add_filter( 'um_core_form_meta_all', 'my_core_form_meta', 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment