WordPress.org

Ready to get started?Download WordPress

Forums

How to do an auto login with WP 2.5? (5 posts)

  1. DDT
    Member
    Posted 6 years ago #

    Hi all,

    I am trying to integrate wp 2.5 in an existing website. Now for the admin part i don't want to let the user login twice. As this is only for one user i even tried the stored user_pass with user_login but it doesn't seem to work.

    i have tried to compare stored user_pass with a hardcoded password but the hardcoded password is not read right
    [php]
    $storedPass = "....RWwVEO2EP13.lL";
    $passwd= "....RWwVEO2EP13.lL";

    WP_Integration::wp_login( $username, $passwd, true );

    but now Hard password: gives just .1L??

    class WP_Integration {

    function wp_login( $userid, $pass, $already_md5 = false)
    {
    print $pass;

    }
    [/php]

    How can i auto login, it can even be hardcoded?

    regards

  2. DDT
    Member
    Posted 6 years ago #

    ok, i think the $ signs in user_pass are causing the problems. How can i escape this chars?

  3. lxg
    Member
    Posted 6 years ago #

    Use single quotes, elsewise "$foo" will output the value of the variable $foo.

  4. DDT
    Member
    Posted 6 years ago #

    @mastermind, tx

    now
    $passwd = '$P$BWf7et......O2EP13.lL/';
    WP_Integration::wp_login( $username, $passwd, true );

    doesn't give me an error anymore.

    But it doesn't work as i thought it would be

    [code]

    <?php if($uid == 'test') {
    ob_start();
    include_once ("incs/wp_functions.php");
    $username = "test";
    $passwd = '$P$BWf7...O2EP13.lL/';
    WP_Integration::wp_login( $username, $passwd, true );
    ob_get_contents();
    ob_end_clean();

    ?>

  5. News items
  6. <?php }?>
    [/code]

    When you click News items it still shows the login screen??

    Any tips

  • DDT
    Member
    Posted 6 years ago #

    hmm,
    WP_Integration::wp_login( $username, $passwd, true );

    should set a user/password cookie, right?

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags