WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Cannot log into WP from own site - invalid_username error (2 posts)

  1. xPSFT
    Member
    Posted 4 years ago #

    Unable to log in to WP (via wp_signon) when I log into custom site, however able to log into WP directly.

    Environment
    Main site:
    http://localhost/mysite

    WP Site:
    http://localhost/mysite/blog

    Code
    Custom sign on page:

    define('WP_USE_THEMES', false);
    require('./familynews/wp-blog-header.php');
    ...
    ...
    $secure_cookie = false;
    $credentials = array('user_login' => $tngusername, 'user_password' => $tngpassword,'remember'=>false);
    $user = wp_signon($credentials, $secure_cookie);
    
    var_dump($user);
    exit;

    Output
    object(WP_Error)#101 (2) { ["errors"]=> array(1) { ["invalid_username"]=> array(1) { [0]=> string(177) "ERROR: Invalid username. Lost your password?" } } ["error_data"]=> array(0) { } }

    Debug
    Used the same id and able to successfully log into WP directly.

    Failure seems starting in the get_userdata() function (in pluggable.php). _fill_user function is only called if I log into the blog directly, whereas it does not reach that line if logged in through wp_signon function call. Looks like the $wpdb->get_row call is returning null, however when I debugged the get_row call (echo $query).

    output response:
    SELECT option_value FROM wp_options WHERE option_name = 'ngg_widget' LIMIT 1SELECT * FROM wp_users WHERE user_login = 'admin'object
    (WP_Error)#101 (2) { ["errors"]=> array(1) { ["invalid_username"]=> array(1) { [0]=> string(177) "ERROR: Invalid username. Lost your password?" } } ["error_data"]=> array(0) { } }
    SELECT * FROM wp_users WHERE user_login = 'admin'

    // did a var_dump ($user);
    object(WP_Error)#101 (2) { ["errors"]=> array(1) { ["invalid_username"]=> array(1) { [0]=> string(177) "ERROR: Invalid username. Lost your password?" } } ["error_data"]=> array(0) { } }

    Am i missing something?

  2. xPSFT
    Member
    Posted 4 years ago #

    Issue resolved.

    problem was my main site was connecting to the db on the same host. added "next flag" (true) to mysql_connect() function call on my mainsite.

Topic Closed

This topic has been closed to new replies.

About this Topic