WordPress.org

Ready to get started?Download WordPress

Forums

wp_signon auto login fails (2 posts)

  1. martin11ph
    Member
    Posted 2 years ago #

    I'm having a tough time getting wp_signon to work. My code is pretty straightforward at the moment and yet some header issues arise. This code actually worked before but abruptly stopped working all of a sudden.

    <?php
    session_start();
    ?>
    <iframe src="" width="100%" scrolling="no" height="130px" frameborder="0"></iframe>
    <?php
    define('WP_USE_THEMES', true);
    require_once ('./wp-blog-header.php');
    $creds = array();
    $creds['user_login'] = "theusername" ;
    $creds['user_password'] = "thepassword";
    $creds['remember'] = true;
    $user = wp_signon( $creds, false );
    if ( is_wp_error($user) )
       echo $user->get_error_message();
    ?>

    This results in

    Warning: Cannot modify header information - headers already sent by (output started at /home/***/public_html/blog/index.php:4) in /home/cityofba/public_html/blog/wp-includes/pluggable.php on line 669

    Warning: Cannot modify header information - headers already sent by (output started at /home/***/public_html/blog/index.php:4) in /home/cityofba/public_html/blog/wp-includes/pluggable.php on line 670

    Warning: Cannot modify header information - headers already sent by (output started at /home/***/public_html/blog/index.php:4) in /home/cityofba/public_html/blog/wp-includes/pluggable.php on line 671

    Line 4 is the iframe. I tried removing it and I get this:

    Warning: Cannot modify header information - headers already sent by (output started at /home/***/public_html/blog/wp-content/themes/big-city/header.php:2) in /home/cityofba/public_html/blog/wp-includes/pluggable.php on line 669

    Warning: Cannot modify header information - headers already sent by (output started at /home/***/public_html/blog/wp-content/themes/big-city/header.php:2) in /home/cityofba/public_html/blog/wp-includes/pluggable.php on line 670

    Warning: Cannot modify header information - headers already sent by (output started at /home/***/public_html/blog/wp-content/themes/big-city/header.php:2) in /home/cityofba/public_html/blog/wp-includes/pluggable.php on line 671

    Line 2 in header.php of my theme is this
    <html <?php language_attributes(); ?>>

    I don't see how this could possibly be the cause. What do you think is wrong? I know about empty spaces and know there aren't any in my pages.

  2. martin11ph
    Member
    Posted 2 years ago #

    Any reference to working auto login scripts here? It would be appreciated greatly. I don't know why this code abruptly stopped working.

Topic Closed

This topic has been closed to new replies.

About this Topic