Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




check_password_reset_key [ WordPress Function ]

check_password_reset_key ( $key, $login )
Parameters:
  • (string) $key Hash to validate sending user's password
  • (string) $login The user login
Uses:
  • $wpdb
Returns:
  • (object|WP_Error) User's database row on success, error object for invalid keys
Defined at:



Retrieves a user row based on password reset key and login

Source


<?php
function check_password_reset_key($key$login) {
    global 
$wpdb;

    
$key preg_replace('/[^a-z0-9]/i'''$key);

    if ( empty( 
$key ) || !is_string$key ) )
        return new 
WP_Error('invalid_key'__('Invalid key'));

    if ( empty(
$login) || !is_string($login) )
        return new 
WP_Error('invalid_key'__('Invalid key'));

    
$user $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->users WHERE user_activation_key = %s AND user_login = %s"$key$login));

    if ( empty( 
$user ) )
        return new 
WP_Error('invalid_key'__('Invalid key'));

    return 
$user;
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

Kullanýcý Tartýþmalarý [ wordpress.org ]

- Bulunamadý -

Yeni bir konu yaz ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics