Skip to content

Instantly share code, notes, and snippets.

View nikitasinelnikov's full-sized avatar

Mykyta Synelnikov nikitasinelnikov

  • ultimatemember.com
  • Kharkiv, Ukraine
View GitHub Profile
@nikitasinelnikov
nikitasinelnikov / functions.php
Created September 7, 2022 22:14
Ultimate Member v3: Password Reset 'shortcode_atts_ultimatemember_password' hook
// 'um_reset_password_shortcode_args_filter' - use 'shortcode_atts_ultimatemember_password' filter's hook
/**
* 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.
* Legacy v2.x hooks: 'um_reset_password_shortcode_args_filter'
*
* Hook: shortcode_atts_ultimatemember_password
* Type: filter
*
@nikitasinelnikov
nikitasinelnikov / functions.php
Created September 7, 2022 22:24
Ultimate Member v3: Password Reset 'um_lostpassword_errors_hook' hook
// 'um_reset_password_errors_hook' - use action hook 'um_lostpassword_errors_hook' instead
/**
* Fires after Ultimate Member native Lost Password form validations are completed.
*
* Note: Use this hook for adding custom validations to your Lost Password form.
*
* Hook: um_lostpassword_errors_hook
*
* Type: action
@nikitasinelnikov
nikitasinelnikov / functions.php
Created September 7, 2022 22:48
Ultimate Member v3: Password Reset 'um_lostpassword_form_args' hook
// 'um_reset_password_page_hidden_fields' - use filter's hook `um_lostpassword_form_args` instead and add the hiddens to it
// 'um_after_password_reset_fields' - use filter's hook `um_lostpassword_form_args` instead and add the fields to it
/**
* Description: Fires before rendering the lost password form and filters the lost password arguments.
* This hook may be used to add custom hidden fields or display custom content in the password reset form header.
*
* Hook: um_lostpassword_form_args
*
* Type: filter
@nikitasinelnikov
nikitasinelnikov / functions.php
Created September 7, 2022 22:54
Ultimate Member v3: Password Reset 'um_resetpass_form_args' hook
// 'um_change_password_page_hidden_fields' - use filter's hook `um_resetpass_form_args` instead and add the hiddens to it
/**
* Description: Fires before rendering the lost password form and filters the lost password arguments.
* This hook may be used to add custom hidden fields or display custom content in the password reset form header.
*
* Hook: um_resetpass_form_args
*
* Type: filter
*
@nikitasinelnikov
nikitasinelnikov / functions.php
Created September 8, 2022 12:07
Ultimate Member v3: Password Reset 'um_resetpass_errors_hook' hook
// 'um_change_password_errors_hook' - use action hook 'um_resetpass_errors_hook' instead
/**
* Fires after Ultimate Member native Reset Password form validations are completed.
*
* Note: Use this hook for adding custom validations to your Reset Password form.
*
* Hook: um_resetpass_errors_hook
*
* Type: action
@nikitasinelnikov
nikitasinelnikov / functions.php
Created September 8, 2022 12:31
Ultimate Member v3: Password Reset 'um_before_send_lostpassword_link' hook
// 'um_reset_password_process_hook' - use action hook 'um_before_send_lostpassword_link' instead
/**
* Fires just before the Lost Password process when Ultimate Member Lost Password form data is validated.
*
* Note: Use this hook for adding custom actions before lost user's password form. It's the first hook after the validating form data.
*
* Hook: um_before_send_lostpassword_link
*
* Type: action
@nikitasinelnikov
nikitasinelnikov / functions.php
Created September 8, 2022 12:35
Ultimate Member v3: Password Reset 'um_before_changing_user_password' hook
// 'um_change_password_process_hook' - use action hook 'um_before_changing_user_password' instead
/**
* Fires just before the Reset Password process when Ultimate Member Reset Password form data is validated.
*
* Note: Use this hook for adding custom actions before reset user's password form. It's the first hook after the validating form data.
*
* Hook: um_before_changing_user_password
*
* Type: action
@nikitasinelnikov
nikitasinelnikov / functions.php
Created September 8, 2022 13:16
Ultimate Member v3: Password Reset migration hooks from 'um_after_form_fields', 'um_change_password_form', 'um_reset_password_form' to new 'um_form_footer'
<?php
/**
* Description: Fires in the form footer before closing tag in the form.
* This hook may be used to display custom content in the form footer.
*
* Hook: um_form_footer
*
* Type: action
* @package um\core
@nikitasinelnikov
nikitasinelnikov / functions.php
Created September 9, 2022 13:00
Ultimate Member v3: Custom redirect after Lost Password form submission
/**
* Use real URLs instead of {user_exists_url}, {user_doesnot_exist_url} placeholders.
*/
function um_012722_redirect_after_sending_password_reset( $user_id = null ) {
if ( is_numeric( $user_id ) ) {
// user exists
wp_redirect( '{user_exists_url}' );
} else {
wp_redirect( '{user_doesnot_exist_url}' );
}
@nikitasinelnikov
nikitasinelnikov / functions.php
Created September 9, 2022 13:46
Ultimate Member v3: Password Reset. Lost Password form validation using Email Address only
function um_021522_form_notice( $text, $key ) {
if ( 'lostpassword-info' === $key ) {
$text = __( 'Please enter your email address. You will receive an email message with instructions on how to reset your password.', 'ultimate-member' );
}
return $text;
}
add_filter( 'um_form_notice', 'um_021522_form_notice', 10, 2 );
function um_021522_lostpassword_form_args( $lostpassword_args ) {