Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8955229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:30:12+00:00 2026-06-15T14:30:12+00:00

I referer to this code which I’m trying to use to log a facebook

  • 0

I referer to this code which I’m trying to use to log a facebook user as a wordpress user. However the while the user is registered the is_user_logged_in() would repeatedly state false. Can anyone give me some insight as to what I might be doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:30:13+00:00Added an answer on June 15, 2026 at 2:30 pm

    I wrote a wordpress loginas.php page, hence, a really big security hole 🙂 :

    require_once(dirname(__FILE__) . '/wp-load.php');
    
    function auto_login( $username ) {
        // log in automatically
        $user = get_userdatabylogin( $username );
        $user_id = $user->ID;
        wp_set_current_user( $user_id, $user_login );
        wp_set_auth_cookie( $user_id );
    }
    
    if (!is_user_logged_in()) {
        echo "Logging in as: ".$_GET['username'];
        auto_login($_GET['username']);
    }
    else
        echo "You are already logged in.";
    

    And, after I delete all cookies, it is working very well. So, I suppose you could have a problem with something that is executed before your code.
    Actually I’m still unable to figure out what’s happening in your code, could you try to change priority of execution of your init hook and move at very first position.

    Please pay attention, in order to execute your correctly your programmatically authentication, WordPress requests should be always done on same domain where the cookie is created.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use Mechanize to capture a POST request which is not possible
this is my code. which works fine for 10 records. but whe it will
This February 14 my website got attacked by some malware code which comes to
I'm trying to redirect users to another page, however, I need the Referer header
I am trying to add data into excel file which is extracted from wordpress
I'm trying to get this piece of code working a little better. I suspect
I'm trying to use url_for(:back) to create a redirect leading back to a previous
I'm running this application on a server that has assigned 5 IPs. I use
I am trying to integrate some third party tracking code into one of my
I'm trying to add a referer to an http post in Apache HttpClient (httpclient-4.0-beta2).

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.