data->ID, 'user_status' ) ){ $retMessage = ''. __('ERROR', 'profile-builder') . ': ' . __('Your account has to be confirmed by an administrator before you can use the "Password Reset" feature.', 'profile-builder'); $retMessage = apply_filters('wppb_recover_password_unapporved_user', $retMessage); $messageNo = '6'; } } return array( $retMessage, $messageNo ); } /** * Function that retrieves the unique user key from the database. If we don't have one we generate one and add it to the database * * @param string $requested_user_login the user login * */ function wppb_retrieve_activation_key( $requested_user_login ){ global $wpdb; $key = $wpdb->get_var( $wpdb->prepare( "SELECT user_activation_key FROM $wpdb->users WHERE user_login = %s", $requested_user_login ) ); if ( empty( $key ) ) { // Generate something random for a key... $key = wp_generate_password( 20, false ); do_action('wppb_retrieve_password_key', $requested_user_login, $key); // Now insert the new md5 key into the db $wpdb->update($wpdb->users, array('user_activation_key' => $key), array('user_login' => $requested_user_login)); } return $key; } /** * Function that creates a generate new password form * * @param array $post_data $_POST * */ function wppb_create_recover_password_form( $user, $post_data ){ ?>
get_results( $wpdb->prepare( "SELECT * FROM $wpdb->users WHERE user_login= %s", $postedData ) ); if( !empty( $query[0] ) ){ $postedData = $query[0]->user_email; } } else{ $message = __( 'The username entered wasn\'t found in the database!', 'profile-builder').''.$message2.'
', $message2 ); wppb_create_recover_password_form( $user, $_POST ); }elseif( $messageNo2 == '1' ) echo apply_filters( 'wppb_recover_password_password_changed_message1', ''.$message2.'
', $message2 ); }else{ wppb_create_recover_password_form( $user, $_POST ); } }else{ if( $messageNo2 == '1' ) { // CHECK FOR REDIRECT $redirect_url = wppb_get_redirect_url( 'normal', 'after_success_password_reset', '', sanitize_user( $_GET['loginName'] ) ); $redirect_delay = apply_filters( 'wppb_success_password_reset_redirect_delay', 3, sanitize_user( $_GET['loginName'] ) ); $redirect_message = wppb_build_redirect( $redirect_url, $redirect_delay, 'after_success_password_reset' ); echo apply_filters( 'wppb_recover_password_password_changed_message1', '' . $message2 . '
', $message2 ); if( isset( $redirect_message ) && ! empty( $redirect_message ) ) { echo '' . $redirect_message . '
'; } } elseif( $messageNo2 == '2' ) echo apply_filters( 'wppb_recover_password_password_changed_message2', ''.$message2.'
', $message2 ); else echo apply_filters( 'wppb_recover_password_invalid_key_message', ''.__( 'ERROR:', 'profile-builder' ).''.__( 'Invalid key!', 'profile-builder' ).'
' ); } }else{ //display error message and the form if (($messageNo == '') || ($messageNo == '2') || ($messageNo == '4')){ if( !empty( $message ) ) echo apply_filters( 'wppb_recover_password_displayed_message1', ''.$message.'
' ); wppb_create_generate_password_form( $_POST ); }elseif (($messageNo == '5') || ($messageNo == '6')) echo apply_filters( 'wppb_recover_password_displayed_message1', ''.$message.'
' ); else echo apply_filters( 'wppb_recover_password_displayed_message2', ''.$message.'
' ); //display success message } // use this action hook to add extra content after the password recovery form. do_action( 'wppb_after_recover_password_fields' ); ?>