External Wordpress Login

Discussion in 'PHP' started by RiptideSolutions, Nov 28, 2013.

  1. #1
    Hello all. I did this about 2 or 3 years ago on an older version of Wordpress, but doesn't seem to work anymore. Maybe some of you more savvy people out there can help me figure out this troubling problem I have ran into. I have an external PHP page (index2.php) that I am having all end-users land on before they can access the actual Wordpress blog. On this external page, I have buttons that entail Login and Register. Each with their respective forms from Wordpress linked to them. Now, my problem. When a user logs into his/her account, there seems to be a problem with carrying over the session or what not to Wordpress so they remain logged in when they get to the Wordpress. Is there anyone out there with experience in this that can shed some light on this situation?

    Many thanks and appreciation in advanced!
     
    RiptideSolutions, Nov 28, 2013 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    How are your sessions assigned? Show us some code, mate. But, basically, I would assume there are some sort of subfolder/subdomain-issue, and that the sessions are assigned to the wrong path. /subpath/ instead of / for instance.
     
    PoPSiCLe, Nov 28, 2013 IP
  3. RiptideSolutions

    RiptideSolutions Active Member

    Messages:
    142
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    65
    #3
    Well, I have the index2.php file in the same directory as the Wordpress install is.
     
    RiptideSolutions, Nov 28, 2013 IP
  4. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #4
    So, post the code from the index2.php-file then
     
    PoPSiCLe, Nov 28, 2013 IP
  5. RiptideSolutions

    RiptideSolutions Active Member

    Messages:
    142
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    65
    #5
    <?php
    session_start();
    define('WP_USE_THEMES', false);
    
    include_once("wp-load.php");//change with the path of wp-load.php if they do not reside together
    get_userdata($wp_user_id);
    $wp_user = wp_set_current_user($wp_user_id);
    wp_set_auth_cookie($wp_user_id);
    ?>
    PHP:
    That's what I have right now.
     
    RiptideSolutions, Nov 28, 2013 IP
  6. RiptideSolutions

    RiptideSolutions Active Member

    Messages:
    142
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    65
    #6
    Anyone else?
     
    RiptideSolutions, Nov 29, 2013 IP