• Resolved philtrash

    (@philtrash)


    Hi everyone,

    Little issue when I try to create a registration page, I create a new user and then try to log him directly and redirect to the last page, here’s the code I use:

    $creds = array();
    $creds['user_login'] = $user_login;
    $creds['user_password'] = $user_pass;
    $creds['remember'] = true;
    
    $user = wp_signon( $creds, false);

    I get this error:
    PHP Catchable fatal error: Object of class WP_User could not be converted to string in /wp-content/themes/mytheme/register_data.php on line 40
    (Line 40 being the $user = wp_signon( $creds, false);

    Thanks!

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

    (@philtrash)

    My bad, I didn’t add the “wp-blog-header.php” file..

    require('./wp-blog-header.php');
    
    require_once( ABSPATH . WPINC . '/registration.php');
    require_once( ABSPATH . WPINC . '/user.php');

Viewing 1 replies (of 1 total)
  • The topic ‘Object of class WP_User could not be converted to string’ is closed to new replies.