Skip to content

Instantly share code, notes, and snippets.

@yuriinalivaiko
Last active September 7, 2022 12:07
Show Gist options
  • Save yuriinalivaiko/528a8049d7ee99912fb9cbc7a14a5fdf to your computer and use it in GitHub Desktop.
Save yuriinalivaiko/528a8049d7ee99912fb9cbc7a14a5fdf to your computer and use it in GitHub Desktop.
This gist provides examples and description for hooks used by the Ultimate Member plugin on password reset process.
<?php
/**
* Description: Fires before the password reset form shortcode is loaded.
*
* Hook: um_before_password_form_is_loaded
*
* Type: action
*
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-password.php#LC239
* @tutorial https://docs.ultimatemember.com/article/1072-umbeforemodeformisloaded
* @package um\core
* @since 2.0
*
* @param array $args Password reset form shortcode arguments.
*/
function my_before_password_form_is_loaded( $args ) {
// your code here.
}
add_action( 'um_before_password_form_is_loaded', 'my_before_password_form_is_loaded', 10, 1 );
<?php
/**
* Description: Fires after user change the password.
* This hook may be used to add cookies or customize redirect.
*
* Hook: um_after_changing_user_password
*
* Type: action
*
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-password.php#LC644
* @tutorial https://docs.ultimatemember.com/article/1013-umafterchanginguserpassword
* @package um\core
* @since 2.0
*
* @param int $user_id User ID.
*/
function my_after_changing_user_password( $user_id ) {
// your code here.
}
add_action( 'um_after_changing_user_password', 'my_after_changing_user_password', 10, 1 );
<?php
/**
* Description: Fires before closing tag in the form.
* This hook may be used to display custom content in the form footer.
*
* Hook: um_after_form_fields
*
* Type: action
*
* @example https://github.com/ultimatemember/ultimatemember/blob/master/templates/password-change.php#LC96
* @example https://github.com/ultimatemember/ultimatemember/blob/master/templates/password-reset.php#LC152
* @tutorial https://docs.ultimatemember.com/article/1018-umafterformfields
* @package um\core
* @since 2.0
*
* @param array $args The form shortcode arguments.
*/
function my_after_form_fields( $args ) {
// your code here.
}
add_action( 'um_after_form_fields', 'my_after_form_fields', 10, 1 );
<?php
/**
* Description: Fires after rendering fields in the password reset form.
* This hook may be used to add custom fields or display custom content before the password reset form buttons.
*
* Hook: um_after_password_reset_fields
*
* Type: action
*
* @example https://github.com/ultimatemember/ultimatemember/blob/master/templates/password-reset.php#LC99
* @tutorial https://docs.ultimatemember.com/article/1022-umafterpasswordresetfields
* @package um\core
* @since 2.0
*
* @param array $args Password reset form shortcode arguments.
*/
function my_after_password_reset_fields( $args ) {
// your code here.
}
add_action( 'um_after_password_reset_fields', 'my_after_password_reset_fields', 10, 1 );
<?php
/**
* Description: Fires before the password reset form shortcode is loaded.
*
* Hook: um_before_form_is_loaded
*
* Type: action
*
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-password.php#LC219
* @tutorial https://docs.ultimatemember.com/article/1060-umbeforeformisloaded
* @package um\core
* @since 2.0
*
* @param array $args Password reset 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 );
<?php
/**
* Description: Fires on the change password form submit.
* This hook may be used to add custom validation for the change password form.
*
* Hook: um_change_password_errors_hook
*
* Type: action
*
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-password.php#LC406
* @tutorial https://docs.ultimatemember.com/article/1077-umchangepassworderrorshook
* @package um\core
* @since 2.0
*
* @param array $post Submitted form data.
*/
function my_change_password_errors( $post ) {
// your code here.
}
add_action( 'um_change_password_errors_hook', 'my_change_password_errors', 10, 1 );
<?php
/**
* Description: Fires after rendering fields and buttons in the change password form.
* This hook may be used to display custom content in the change password form footer.
*
* Hook: um_change_password_form
*
* Type: action
*
* @example https://github.com/ultimatemember/ultimatemember/blob/master/templates/password-change.php#LC75
* @tutorial https://docs.ultimatemember.com/article/1078-umchangepasswordform
* @package um\core
* @since 2.0
*
* @param array $args Change password form shortcode arguments.
*/
function my_change_password_form( $args ) {
// your code here.
}
add_action( 'um_change_password_form', 'my_change_password_form', 10, 1 );
<?php
/**
* Description: Fires after rendering hidden fields in the change password form.
* This hook may be used to add custom hidden fields or display custom content in the change password form header.
*
* Hook: um_change_password_page_hidden_fields
*
* Type: action
*
* @example https://github.com/ultimatemember/ultimatemember/blob/master/templates/password-change.php#LC32
* @tutorial https://docs.ultimatemember.com/article/1079-umchangepasswordpagehiddenfields
* @package um\core
* @since 2.0
*
* @param array $args Change password form shortcode arguments.
*/
function my_change_password_page_hidden_fields( $args ) {
// your code here.
}
add_action( 'um_change_password_page_hidden_fields', 'my_change_password_page_hidden_fields', 10, 1 );
<?php
/**
* Description: Fires on the change password form submit if submitted data are valid.
* This hook is used to process a change password request.
*
* Hook: um_change_password_process_hook
*
* Type: action
*
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-password.php#LC428
* @tutorial https://docs.ultimatemember.com/article/1080-umchangepasswordprocesshook
* @package um\core
* @since 2.0
*
* @param array $post Submitted form data.
*/
function my_change_password_process( $post ) {
// your code here.
}
add_action( 'um_change_password_process_hook', 'my_change_password_process', 10, 1 );
<?php
/**
* Description: Fires before the password reset form shortcode is loaded.
*
* Hook: um_pre_password_shortcode
*
* Type: action
*
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-password.php#LC199
* @tutorial https://docs.ultimatemember.com/article/1198-umpremodeshortcode
* @package um\core
* @since 2.0
*
* @param array $args Password reset form shortcode arguments.
*/
function my_pre_password_shortcode( $args ) {
// your code here.
}
add_action( 'um_pre_password_shortcode', 'my_pre_password_shortcode', 10, 1 );
<?php
/**
* Description: Fires on the password reset form submit.
* This hook may be used to add custom validation for the password reset form.
*
* Hook: um_reset_password_errors_hook
*
* Type: action
*
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-password.php#LC358
* @tutorial https://docs.ultimatemember.com/article/1238-umresetpassworderrorshook
* @package um\core
* @since 2.0
*
* @param array $post Submitted form data.
*/
function my_reset_password_errors( $post ) {
// your code here.
}
add_action( 'um_reset_password_errors_hook', 'my_reset_password_errors', 10, 1 );
<?php
/**
* Description: Fires after rendering fields and buttons in the password reset form.
* This hook may be used to display custom content in the password reset form footer.
*
* Hook: um_reset_password_form
*
* Type: action
*
* @example https://github.com/ultimatemember/ultimatemember/blob/master/templates/password-reset.php#LC131
* @tutorial https://docs.ultimatemember.com/article/1239-umresetpasswordform
* @package um\core
* @since 2.0
*
* @param array $args Password reset form shortcode arguments.
*/
function my_reset_password_form( $args ) {
// your code here.
}
add_action( 'um_reset_password_form', 'my_reset_password_form', 10, 1 );
<?php
/**
* Description: Fires after rendering hidden fields in the password reset form.
* This hook may be used to add custom hidden fields or display custom content in the password reset form header.
*
* Hook: um_reset_password_page_hidden_fields
*
* Type: action
*
* @example https://github.com/ultimatemember/ultimatemember/blob/master/templates/password-reset.php#LC48
* @tutorial https://docs.ultimatemember.com/article/1240-umresetpasswordpagehiddenfields
* @package um\core
* @since 2.0
*
* @param array $args Password reset form shortcode arguments.
*/
function my_reset_password_page_hidden_fields( $args ) {
// your code here.
}
add_action( 'um_reset_password_page_hidden_fields', 'my_reset_password_page_hidden_fields', 10, 1 );
<?php
/**
* Description: Fires on the password reset form submit if submitted data are valid.
* This hook is used to process a password reset request.
*
* Hook: um_reset_password_process_hook
*
* Type: action
*
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-password.php#LC380
* @tutorial https://docs.ultimatemember.com/article/1241-umresetpasswordprocesshook
* @package um\core
* @since 2.0
*
* @param array $post Submitted form data.
*/
function my_reset_password_process( $post ) {
// your code here.
}
add_action( 'um_reset_password_process_hook', 'my_reset_password_process', 10, 1 );
<?php
/**
* Description: Extend the password reset form arguments.
* This hook may be used to select custom template file or change the password reset form alignment and width.
*
* Hook: um_reset_password_shortcode_args_filter
*
* Type: filter
*
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-password.php#LC157
* @tutorial https://docs.ultimatemember.com/article/1242-umresetpasswordshortcodeargsfilter
* @package um\core
* @since 2.0
*
* @param array $args Password reset form shortcode arguments.
* - template (string) - Template name. Default 'password-reset'.
* - mode (string) - Mode. Default 'password'.
* - form_id (string) - Form ID. Default 'um_password_id'
* - max_width (string) - Form width. Default '450px'.
* - align (string) - Form alignment. Default 'center'.
*
* @return array Password reset form shortcode arguments.
*/
function my_reset_password_shortcode_args( $args ) {
// How to change the form alignment.
$args['align'] = 'left';
// How to change the form width.
$args['max_width'] = '600px';
return $args;
}
add_filter( 'um_reset_password_shortcode_args_filter', 'my_reset_password_shortcode_args', 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment