0

I need to specify a url that i will use after the user has logged out from facebook because i need to do some extra-cleaning and he is correctly logged out from our app.

For this i need a url that when invoked will call a function i define, but i don't know how i should do this, what action i should use. In Drupal i could define a "callback menu" which is exactly what i'm looking for, i don't know how to do this in wordpress.

EDIT - to clarify more, the user is connected to my plugin with facebook connect. The standard

$logout_url = $facebook->getLogoutUrl();

isn't enough because when the user comes back from facebook i have to clear the session and invalidate the token and so i nee do specify a url

$logout_url = $facebook->getLogoutUrl('edit.php?post_type=my_custom&page=logout-from-fb');

i just need that when the user comes back from facebook automatically and the page edit.php?post_type=my_custom&page=logout-from-fb a function i want is called and it will handle everything.

2
  • To clarify: Is the person logging out from Facebook's site and being redirected back to your site? Commented May 8, 2012 at 13:11
  • @Joseph i edited my answer Commented May 8, 2012 at 13:29

1 Answer 1

1

A Web site that I recently worked on for a client involved tying WordPress together with another CMS including tight login integration. Because of clashes with internal functions, I could not call the WordPress logout function directly from the CMS. Intead, I created a special logout page in the WordPress root which I redirected to from the CMS. Following is the code for that page (logout.php):

<?php

require './wp-load.php';

$current_user = wp_get_current_user();

if ($current_user->ID != 0)
    wp_logout();

wp_redirect('/');

exit;

You'll need to somehow secure this, of course. I did so by checking the referrer to make sure the request was coming from the CMS but this might not always be reliable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.