Active
Project:
Facebook OAuth (FBOAuth)
Version:
6.x-1.3
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
19 Oct 2011 at 19:45 UTC
Updated:
6 Feb 2013 at 00:54 UTC
Jump to comment: Most recent file
Comments
Comment #1
quicksketchActually right now you can't set a landing page at all. The code is partially set up to allow redirects though. We have this code already in place:
But right now our fboauth_action_connect() function is not actually returning any value, so there isn't any way to specify a redirect URL (and certainly not different redirect URLs based on login or registration).
As an aside, Facebook OAuth module isn't actually setting this value, it's currently being added somehow due to a bug in the Facebook API, there are multiple reports of this around the web:
http://stackoverflow.com/questions/7131909/facebook-callback-appends-to-...
https://developers.facebook.com/blog/post/552/ (lots of posts in the comments)
http://bugs.developers.facebook.net/show_bug.cgi?id=20504
I can confirm that when I first wrote the module, it would just redirect you to the homepage without any extra symbols attached like that. A change in the API affected the module somehow.
In any case, I'm moving this issue to a feature request, as I think options for specifying login and registration paths would be a good option to include.
Comment #2
adamharms commented+1
Comment #3
CydeWeys commentedI'm currently making some changes to ensure that the user is redirected to whatever page they came from. So if the user is viewing, for instance, site/node/1450, and they click a "Login with Facebook" button on there, they'll end up back at site/node/1450, instead of the main page.
Comment #4
CydeWeys commentedHere's a simple way to create an FB Connect button that takes you back to the page you were last browsing after the login action completes. I've implemented this as a footer for simplicity, but it could easily work as a block, as part of a page template, etc. (Left as an exercise for the reader.)
Comment #5
fenda commentedWas this implemented?
Comment #6
d.holmen@gmail.com commentedThank you!
I added this to my custom module, in my form_alter and added it as a markup:
Comment #7
jonmcl commentedIncase it helps anyone, I managed to make the connect button come back to the originating page (instead of front page) by creating an overriding theme function:
It took me a few minutes to realize the ?destination= parameter needed to go into the redirect_uri parameter and not get added to the end of the original Facebook URL.
I should mention that this is for Drupal 7, but I think for Drupal 6 you just need to replace drupal_encode_path with drupal_urlencode.
You will need to rename function to be placed in your theme's template.php or use hook_theme_registry_alter() to place it in a custom module.
Comment #8
merzikain commented#4 solved my problem. In my specific case I used most of that code in a template function instead of a module.
Comment #9
jphelan commented#4 solved my problem as well. Thanks CydeWeys
Comment #10
milesw commentedNice tip, #4, thanks. Just note that sometimes FBOauth will include ?destination it's part of the page URL, so it could be there already.
You can also do this in a preprocess...
Comment #11
hachreak commentedHi guys,
I have patched the module to add in the configuration of the block a url where drupal can redirect the user after login.
I added this configuration:
[-] textfield: url where redirect user
[-] checkbox: if I want redirect user in the same page where he made clicks on fbconnect button
It's possible to insert the patch in the module? :)
Someone can review the code if all it's ok?
Best,
hachreak
Comment #12
dmegatool commented#7 works like a charm ! I just implemented this on my D7 install. Can't thank you enough JonMcL :D
Comment #13
Frederic wbase commented@JonMcL
Thank you for you code, just tested it on a D7 install and it works wunderfull!
grts
frederic
Comment #14
rosborn commentedCan I ask for the status of this fix? I tried modifying the code of my Drupal 7.x-1.5 version of fboauth.module using the JonMcL version, and it seemed to work well on some pages for a while, but it has now reverted to landing on a random page. I haven't managed to find any systematics to this behavior, so I can't add much to this issue. Also, it's not entirely clear what is being patched, since this is labelled a 6.x issue although it affects Drupal 7 equally.
I think this feature is essential to the module. If it's been fixed, it would be great if it were included in a stable release soon. Is that possible?
Comment #15
timofey commentedThis would be a great commit!
Comment #16
klucid commented@hachreak, thanks for the patch. Any chance you could write one up for Drupal 7? Thanks in advance!
Comment #17
hachreak commentedwhen I start to use drupal 7.. XD
But I don't understand... the module is still under development? :)
Comment #18
cayerdis commented#7 works great, thank JonMcL!
Comment #19
quicksketchSorry I maintain a lot of modules and maintain them in sort of a haphazard manner. Once a module gets enough issues (especially with patches) then I'll go through and clear out the queue all at once. It's tough to find time to watch all of them at once.
Regarding this issue, I think we could take a cue from core's login behavior and always redirect to the same page the user was on when using the user login block. It's completely dumb that you'd be taken to any other page at all when logging in, unless its the first time they've logged in at all. Then you might want to take them to some welcome page or form to complete their registration (though you should probably use http://drupal.org/project/complete_profile for that situation).
So the options that remain are where you would like the user directed when they log in from /user/login (not using the login block). And potentially an option similar to logintoboggan to redirect the user *upon registration*, that will override the normal redirect location.
I don't think these options should live on the block configuration form, instead these should be set on the FBOAuth settings page, since the first option would apply to the normal login form only.
Comment #20
quicksketchTo make this feature request less of an issue, I filed a patch at #1873750: Login/Connect/Deauthorize links all need $redirect variables set, which solves the immediate problem of the login block redirecting back to the same page, rather than going to the homepage.
Comment #21
charlesjc commentedFacebook somewhat document the behaviour of adding #_=_ to the uri at https://developers.facebook.com/blog/post/552/
However, while there are several complaints that the documentation is wrong or inadequate, there has not been a response from FB that I can find.
Comment #21.0
charlesjc commentedEdited for clarity only.