• Resolved Benny

    (@bvl)


    Hi,

    I just wanted to let you know that there are 2 code errors in wp-reset.php

    At several locations you refer to user_id but you never define that.
    Maybe add $user_id = $user->ID; (before the line with glbal $wpdb) to fix that.

    Next you use $wpdb->prepare without actually providing any args:
    $query = $wpdb->prepare( "UPDATE $wpdb->users SET user_pass = '".$user->user_pass."', user_activation_key = '' WHERE ID = '".$user_id."' ");
    To fix that replace it with this:
    $query = $wpdb->prepare( "UPDATE $wpdb->users SET user_pass = '".$user->user_pass."', user_activation_key = '' WHERE ID = %d'", $user_id );

    Friendly advise, please always develop with WP_DEBUG set to true, than you would have caught those errors yourself.

    Thank you for an otherwise handy tool!

    https://wordpress.org/plugins/wp-reset/

The topic ‘Found 2 coding bugs’ is closed to new replies.