Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
how can i change destination page after fboauth, default it's user profile page
Comments
Comment #1
dmegatool CreditAttribution: dmegatool commentedIt's getting me to the home page. I'll like to redirect the user to the page he was when it clicked the login link... Don't know how to.
Comment #2
b8x CreditAttribution: b8x commentedi tried rules event "after create new account" action "page_redirect" , but it doesn't work. tried action "execute custom php - code" and write there line drupal_goto('http://'.$_SERVER['SERVER_NAME'].'/afterregister'); it redirects, but user not automaticaly logged in. next step is to hack fboauth module.
Comment #3
dmegatool CreditAttribution: dmegatool commentedWith Rules I was able to redirect users to a specified page. I used "User has logged in". But I don't know how to redirect to the page the user was...
If you ever hack the module, could you post how to do it. I looked around but I'm no programmer so I didn't find how to do it :/
Comment #4
b8x CreditAttribution: b8x commentedin your case module "rules" can help . there is event "User has logged in" just choose action 'page redirect' and type your destination page. this rule will work for simple and fboauth login.
Comment #5
b8x CreditAttribution: b8x commentedok, problem was "legal" module. when FBauth works it ignore legal checkbox, and can't login user untill this flag = checked.
Comment #6
dmegatool CreditAttribution: dmegatool commentedBut I can't make it work as I don't know what was the page the user was on. I want to redirect to the page they were when they clicked the login button... Know how to do this ?
Comment #7
dmegatool CreditAttribution: dmegatool commentedFound a solution here : http://drupal.org/node/1314940
Don't know if it works in your case. Here's the template.tlp.php code to add
Comment #8
b8x CreditAttribution: b8x commentedcool, will be second way to solve problem :), thank you. do you have a strange stuff at the end of URL after fboauth? like http://my.site.com/register#_=_
Comment #9
dmegatool CreditAttribution: dmegatool commentedYes I do. But it doesn't bother me. I've seen other thread about it but I won't fight or try to fix this :) Think people were saying it was something on the Facebook side.
Comment #10
b8x CreditAttribution: b8x commentedgood
Comment #11
Alexander Matveev CreditAttribution: Alexander Matveev commentedNice thread. Thank you guys. Subscribing.
UP: ops.. there is "Following" button on Drupal.org, I forgot =D
Comment #12
markusa CreditAttribution: markusa commentedThis is a really great thread....
How about this twist....I have 2 different Profile2 types. I have created 2 different pages with the fboauth connect block on each....I'd like it to redirect to the edit page for the particular profile2 type depending on the page that the user connects from....I've can redirect to the user edit page with rules but how to set a condition based on the page that the fboauth connect button was pushed on?
Comment #13
hanamizuki CreditAttribution: hanamizuki commentedAccording to fboauth.api.php, it's supposed to work using "hook_fboauth_actions_alter", isn't it?
I tried this code:
($user->created == $user->login : means this is the first login)
Sadly it doesn't work, why?
And I found that this code works:
But I'd like to set the destination to user edit page when first login,
but "global $user" in fboauth_action_display() doesn't have uid yet, so can't write if function here.
Is any one has any idea?
Comment #14
hanamizuki CreditAttribution: hanamizuki commentedOkay I figured it out. I think it's better to use fboauth api than changing it in theme.
Step 1, Print the FBCONNECT Button, anywhere you want
Step 2, Add this to your CUSTOM_MODULE
Comment #15
quicksketchLet's consolidate this issue with #1314940: Set Custom Landing Page URL for Login and Register, which is a feature request for the module.
Comment #16
b8x CreditAttribution: b8x commentedthis is typical fboauth link -- href="https://www.facebook.com/dialog/oauth?client_id=232874473477309&redirect..."
so, print it by yourself in with any class, page where this link placed must define destination after fbouauth, maybe you want give that throuh the url like, "/page_with_fb_button/?dest=node/67" in template of page_with_fb_button.tpl.php
this is my way
Comment #17
skchan2 CreditAttribution: skchan2 commentedThanks, #14 works, but not with the popup function from patch #40 in https://drupal.org/node/1364698
Any work arounds?
Comment #18
dunklea CreditAttribution: dunklea commentedI second this request. Ideally I would like to reload the current page after the popup closes, but so far I have not no solutions.
Thanks,
Andrew
Comment #19
SherpaHyde CreditAttribution: SherpaHyde commentedThis works for me in my template file where I want the Facebook button (Drupal 6).
It logs the site visitor in using Facebook then brings her back to the same page (now logged in).
(code from fboauth.module)
Comment #20
bovidiu CreditAttribution: bovidiu commented@dmegatool #7 theme function works just fine. The hook to theme_fboauth_action__connect($variables), it is correct and the snippet which does the correct redirect is: