• Hi,

    I am trying to make a plugin that overrides the wp_check_password function in pluggable.php. However, I always get a “fatal error” because apparently the function has been created before. I can activate it when I do a check if that function exists, but then it does not override it of course.

    The only other plugin I have installed on the 2.9.2 WordPress is BuddyPress but even when I deactivate that I still have the same problem.

    Strange thing is that when I directly modify the wp_check_password function in pluggable.php it works, so there cant be an other plugin that overrides it ??

    Any ideas about this?

    Cheers,
    Normen

Viewing 1 replies (of 1 total)
  • Thread Starter normen

    (@normen)

    Ok, I am sorry, I solved it myself. I was deluded by the fact that the functions seem “overridable” but they are in fact not (anymore?)

    Proper way to do this in WP is like this (for those running into the same issue):

    add_filter('check_password', 'my_check_password', 9, 4 );
    function my_check_password($check, $password, $hash, $user_id = '') {
    if($check) return true;
    // SMF forum compatible check
    $user_info = get_userdata($user_id);
    $check = ( $hash == sha1( strtolower( $user_info->user_login ) . $password) );
    if ( $check && $user_id ) {
    // Rehash using new hash.
    wp_set_password($password, $user_id);
    $hash = wp_hash_password($password);
    return true;
    }
    return false;
    }

Viewing 1 replies (of 1 total)
  • The topic ‘wp_check_password override fatal error’ is closed to new replies.