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

  • SEARCH
  • Home
  • 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 9151935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:55:20+00:00 2026-06-17T11:55:20+00:00

This is a really frustrating problem (bug?) that I’ve been trying to figure out.

  • 0

This is a really frustrating problem (bug?) that I’ve been trying to figure out. Seems like alot of people complain about the same exact issue, but there’s no definite solution or tutorial fixing this issue.

Anyways, my problem is that I can get the SDK to log the user in just fine, however when they click on LogOut. It redirects them to facebook.com/home.php (even though the ‘next’ parameter is set to my site) and the User is still not logged out when I visit my site again…

Here is the code…(Facebook library is autoloaded thru the Codeigniter Configuration)

public function DestroySession()
{
        $this->load->helper('url');

if($this->facebook->getUser())
{
    $this->facebook->destroySession();


    $logout = $this->facebook->getLogoutUrl(array("next" => "http://mysite.com/"));


    redirect($logout, 'location', 301);
}
 }

So I got this to finally work. You can see the new function below. For some reasons that I am not entirely sure about you have to do these steps.

public function DestroySession()
{
    $this->load->helper('url');



//Get User ID
$user = $this->facebook->getUser();

if ($user)
{
    try
    {
        // Proceed knowing you have a logged in user who's authenticated.
       $user_profile = $this->facebook->api('/me');

   //   print_r($user_profile);
    } catch (FacebookApiException $e)
    {

        log_message('eror', $e);

        $user = null;
    }
}

// Login or logout url will be needed depending on current user state.
if ($user)
{
if( session_id() ){} else { session_start() ; }

    $logoutUrl = $this->facebook->getLogoutUrl($params = array('next' => base_url()));
    //echo 'Logout; '.($logoutUrl);
    $this->facebook->destroySession();
    redirect($logoutUrl, 'refresh');



}
}
  • 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-17T11:55:21+00:00Added an answer on June 17, 2026 at 11:55 am

    See my orignal question for more context.

    public function DestroySession()
    {
        $this->load->helper('url');
    
    
    
    //Get User ID
    $user = $this->facebook->getUser();
    
    if ($user)
    {
        try
        {
            // Proceed knowing you have a logged in user who's authenticated.
           $user_profile = $this->facebook->api('/me');
    
       //   print_r($user_profile);
        } catch (FacebookApiException $e)
        {
    
            log_message('eror', $e);
    
            $user = null;
        }
    }
    
    // Login or logout url will be needed depending on current user state.
    if ($user)
    {
    if( session_id() ){} else { session_start() ; }
    
        $logoutUrl = $this->facebook->getLogoutUrl($params = array('next' => base_url()));
        //echo 'Logout; '.($logoutUrl);
        $this->facebook->destroySession();
        redirect($logoutUrl, 'refresh');
    
    
    
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This really seems like a bug to me, but perhaps some databinding gurus can
hey guys having this really simple problem but cant seem to figure out have
i've been trying to figure this out and i have absolutely no clue why
Got a really frustrating problem that doesn't seem to make any sense. I'm trying
This really shouldn't be hard, I just can't figure out how to do it.
I've been having this really annoying thing happen the past few days, that has
I've been wasting quite a bit of time trying to figure out why I
I've got this really frustrating problem. I want to submit a form with Javascript
This is getting really frustrating now! I've created a script that appends some content
I'm new to boost and I've been trying out boost::asio. The problem is I

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.