Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Firstly I want to say what a great module this is. I have tried all of the FB connect modules and this is by far the easiest to set up and includes great functionality. Well done!
The one thing I cannot figure out is how to assign the role of the the new user created.
Any help would be appreciated.
Thanks
Comment | File | Size | Author |
---|---|---|---|
#21 | 1335856-21.patch | 6.1 KB | jrb |
#10 | 1335856-10.patch | 5.99 KB | jrb |
#11 | 1335856-11.patch | 6.4 KB | jrb |
Comments
Comment #1
quicksketchThis module does not currently have this functionality, so I'm moving this to a feature request.
Comment #2
flosuter CreditAttribution: flosuter commentedYou could probably us LoginToboggan to achieve this, if you can bear yet another module. I use both Facebook OAuth and LoginToboggan together without issues so far.
Comment #3
Louis Bob CreditAttribution: Louis Bob commentedHello flosuter,
I am very interested in understanding how you use Facebook OAuth and LoginToboggan together?
I would like to give users the ability to either register "normally" with my website, or with their FB account, in both cases using LT functionalities :
- temporary non-authenticated role
- redirect path on registration and on confirmation
Is it possible ?
Comment #4
flosuter CreditAttribution: flosuter commentedI think assigning a role does work, but at the moment the redirection seems to be kinda broken, since facebook just redirects you to http://www.yourdomain.com/#_=_
We just changed everything around so the facebook login happens in a popup window, which we monitor through javascript and redirect when the window is closed.
This is the JS we use, we also changed the login form and submit actions.
This is still quite quick and dirty and has lots of room for improvement.
Comment #5
guy_schneerson CreditAttribution: guy_schneerson commentedI use the hook_user_insert() to add a role as this gets called for all new users
replace n by your role id and newrole with its name, you can add conditional code for this to happen only for the facebook connect if you need to as all the info you need gets pathed into the hook.
you can probably also use rules to do the same.
Comment #6
grasmash CreditAttribution: grasmash commentedThe above example will apply the specified role to all users, regardless of how they register.
If you're interested in granting a new role to a user only when the register via fboauth, try this:
Comment #7
Prancz_Adam CreditAttribution: Prancz_Adam commentedHow can we implement a manualy choosen way to select user's role?
Without that the user haven't got too much help and the administrator has to be work more...
Comment #8
imoreno CreditAttribution: imoreno commentedWhere do i implement this code snipest?
with rules?
BR
Itzhak
Comment #9
imoreno CreditAttribution: imoreno commentedAlso,
what do i need to change in this code (applied by rule) to work when a regular authenticated user is now connected via fbOAuth? i would like to set a rule to do so when any user is logged in.
Comment #10
jrbHere is a patch to do this. It will allow you to select role(s) to be automatically assigned to users when they connect with Facebook. It also gives the option to remove the role(s) if they deauthorize.
This could be done with a separate module if there were a hook that got called in fboauth_action_connect() when the user already exists. If that's a better option, I can add that hook instead and create this as a separate module.
*** Don't use this patch-- see the one in the comment below ***
Comment #11
jrbBetter patch attached. I forgot the calls to variable_del() in the .install file-- they're added now.
Comment #12
imoreno CreditAttribution: imoreno commentedHi,
Thank you JRB.
I can confirm this patch is working as expected. i have a "connected via facebook" role which is automatically assign by FBAuth. very useful, especially for rules integration.
I think this patch can be committed.
BR
Itzhak
Comment #13
imoreno CreditAttribution: imoreno commentedSoory,
this patch is not working for me, it breaks FBAuth Module on line 117.
Itzhak
Comment #14
jrbimoreno,
Can you give some more details? Are you seeing any error messages? When?
Comment #15
pinkonomy CreditAttribution: pinkonomy commentedIs this possible with this patch to assign roles based on the Path (with profile2 path reg module)?
E.g. if path is : user/simple-account/register ,assign the simple account role to user.
If path is user/admin-account/register ,assign to admin account role to user.
thanks
Comment #16
idealform01 CreditAttribution: idealform01 commentedsubscribing, this feature would be really useful to me
Comment #17
lalosg CreditAttribution: lalosg commentedpinkonomy CreditAttribution: pinkonomy commented 2 years ago:
Is this possible with this patch to assign roles based on the Path (with profile2 path reg module)?
E.g. if path is : user/simple-account/register ,assign the simple account role to user.
If path is user/admin-account/register ,assign to admin account role to user.
thanks
____________________________
Anyone can solve this???
Comment #18
anil1591 CreditAttribution: anil1591 as a volunteer commentedThis issue can resolve by going to some basic step with code
1. Where you are using this facebook connect button :
replace this with
2. Then go to /sites/all/modules/fboauth/fboauth.module
and edit it and go to function
function fboauth_user_insert(&$edit, &$account, $category) {
if (isset($edit['fboauth_fbid'])) {
fboauth_save($account->uid, $edit['fboauth_fbid']);
}
And replace with this function :
function fboauth_user_insert(&$edit, &$account, $category) {
if (isset($edit['fboauth_fbid'])) {
fboauth_save($account->uid, $edit['fboauth_fbid']);
user_multiple_role_edit(array($account->uid), 'add_role', $_GET['state']);
}
and now you are ready to rock and role :)
Comment #19
tunedin CreditAttribution: tunedin commentedHas anyone been able to assign roles to FB Oauth with profile2 regpath? I have two paths, regular/register and advanced/register and want to also assign roles per Facebook login. I am using custom register template form and I am using version 7.x-2 of this module and not sure if adding patch above is good enough.
Comment #20
nadiTime CreditAttribution: nadiTime commentedtunedin, have you found a solution?
Comment #21
jrbPatch in #11 re-rolled for 7.x-2.0-rc3.