I am using Drupal for facebook module. I want to redirect user to specific URL, if he login from facebook ? Note: I am using Login destination for normal users and works fine for this.

  • any updates...?
    – Srinu
    Aug 7, 2012 at 11:21

3 Answers 3


Drupal for facebook module has a sub module called "FB Rules Integration" Enable it.

Then create a new rule: give it a name, something like "after connecting facebook account".

add an action: page redirect then enter where do you want to redirect to, something like ""

Here is an export of the rule which you can just import.

{ "rules_after_connecting_facebook_account" : {
    "LABEL" : "after connecting facebook account",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "rules", "Drupal for Facebook" ],
    "ON" : [ "fb_user_connected", "fb_user_login" ],
    "DO" : [ { "redirect" : { "url" : "\u003Cfront\u003E" } } ]

You can also use hook_fb, provided by drupal for facebook module like this:

function fb_example_fb($op, $data, &$return) {
  $fb_app = isset($data['fb_app']) ? $data['fb_app'] : NULL;
  $fb = isset($data['fb']) ? $data['fb'] : NULL;
  if ($op == FB_OP_AJAX_EVENT) {
    // We get FB_OP_AJAX_EVENT when fb.js calls us in reponse to a javascript event.

    if ($data['event_type'] == 'session_change') {
      // The user has clicked the connect button, or logged into/out-of
      // facebook in another browser window, then refreshed.
      if ($fbu = fb_facebook_user()) {
        // The user has connected (as opposed to logged out).  Let's redirect
        // them to our 'welcome' page.  Replace 'welcome' with the path you
        // really want.
        $url = url('welcome',
                   array('absolute' => TRUE, 'fb_canvas' => fb_is_canvas()));
        // We return javascript to be evaluated by fb.js.
        $return[] = 'FB_JS.reload("'. $url .'");';

This one worked for me.

Also you can check this link for more informations.

Hope it helps someone. Cheers.


An easy option would be to use simple fb connect module. It has this feature out of the box. On the configuration page there is a form where you can add the (dynamic) path. The user will be redirected to this path when logging in with fb.

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.