Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter debugger777

    (@debugger777)

    Hi
    I have fixed it,with help from other users in this wordpress blog.

    Here it is

    <?php ob_start();
    require($_SERVER[‘DOCUMENT_ROOT’].”/index.php”); // Include wordpress main index file,we get access to “all wp-function(not tested)” in our external file.
    define(‘WP_USE_THEMES’, false); // Do not show themes
    header(“HTTP/1.1 200 OK”); //Sometimes error occurs,so to fix we set headers

    $email = ‘someuser@somewhere.com’; //Get username or password from

    if (!email_exists($email))
    {
    echo ‘That E-mail doesn\’t belong to any registered users on this site,So registering….
    ‘;
    wp_create_user( ‘someuser’, ‘passme’, ‘someuser@somewhere.com’); // Creating WP User
    echo ‘This email id is now registered thanks—>’.$email;

    }
    else
    {
    echo “That E-mail id is already registered !! So, automatically signing in…”;
    $creds = array();
    $creds[‘user_login’] = ‘someuser’;
    $creds[‘user_password’] = ‘passme’;
    $creds[‘remember’] = true;
    $user = wp_signon( $creds, false ); // Sigining in a WP User

    if( is_wp_error($user))
    {
    echo ‘oops!! we got some error in sigining in ‘.$user->get_error_message();
    }
    else
    {
    echo ‘
    User is now logged in !!
    ‘;
    }

    }
    ob_end_flush();
    ?>

    Hi elbeomar,
    Fixed the script !! If anyone is facing any problem with this script.Just put a message at the bottom

    Thanks
    Debugger

    Hi elbeomar,
    I am on that issue,can you send me the files.Your timely help is much appreciated at this point of urgency.

    Thanks

    debugphp[at]gmail[dot]com

Viewing 3 replies - 1 through 3 (of 3 total)