Support » Plugin: Delete Me » Suggested code change

  • I have set up delete me on the front end using the password requirement. This works well except when a user gets their password incorrect as no error message is displayed.

    I have found a workaround by one line of code in delete_user.php to pass an error message back to the page the form submission came from.

    // Confirm Password Required?
    $your_profile_confirmation_page = ( is_admin() && basename( $_SERVER['SCRIPT_NAME'] ) == 'options.php' && $this->GET['page'] == ( $this->info['slug_prefix'] . '_confirmation' ) ) ? true : false;
    if ( ( $your_profile_confirmation_page && $this->option['settings']['your_profile_confirm_password_required'] ) || ( !$your_profile_confirmation_page && $this->option['settings']['shortcode_form_enabled'] ) ) {
    
    	$this->POST = $this->striptrim_deep( $_POST );
    	$password_entered = '';
    	$password_entered = isset( $this->POST[$this->info['trigger'] . '_your_profile_confirm_password'] ) ? $this->POST[$this->info['trigger'] . '_your_profile_confirm_password'] : $password_entered;
    	$password_entered = isset( $this->POST[$this->info['trigger'] . '_shortcode_password'] ) ? $this->POST[$this->info['trigger'] . '_shortcode_password'] : $password_entered;
    
    	if ( empty( $password_entered ) || empty( $user ) || wp_check_password( $password_entered, $user->data->user_pass ) !== true ) {
    		$_POST[ 'error_msg' ] = 'Sorry, your password was incorrect.';
    		return; // stop executing file
    	}
    
    }

    Do you think it would be possible to add that to the main repository so that I don’t need to maintain a forked version?

Viewing 1 replies (of 1 total)
  • Plugin Author cmc3215

    (@cmc3215)

    Hi LABCAT,

    Thanks for your post. I can see the value in having an error message for incorrect passwords. I will consider adding an option in the next release for controlling an error message.

    Kind regards,

    Clint

Viewing 1 replies (of 1 total)
  • The topic ‘Suggested code change’ is closed to new replies.