Topic-icon Javascript post processing callback in jfbc.login.provider

I was wondering if you could add a JS callback to jfbc.login.facebook method.

Something like
        facebook: function (callback){
            FB.login(function (response){
                if (!jfbc.login.logged_in)
                    jfbc.login.facebook_onlogin();

                     if (typeof callback == function) {
                          callback(response);}
                else
                    jfbc.permissions.fetch();}, {
                scope: jfbc.login.scope});
        }

Thanks in advance =^D
The topic has been locked.
Support Specialist
Can you let us know what you're looking to accomplish? That may help answer more.

Some issues that can crop up are that the jfbc.login.facebook_onlogin() call can redirect the user to authenticate on the site. If that happens, the page will reload and any callbacks will be ignored.

That onlogin call is already a callback that occurs when Facebook changes to the 'logged in' state for the user. We use that to redirect the user to actually log them into the site with their Joomla account.

If you need a separate callback to validate something or do some prechecks for the user before they login to their Joomla account, there are other ways that is likely possible and ways that would work for all social networks, not just Facebook.

Thanks,
Alex
The topic has been locked.
Hey Alex,

Thank you for the quick response and sorry for not following up sooner. I'll try to explain what I'm trying to accomplish.

I have a form
File Attachment:


changetheworld.com/the1000/browse/nominees (click add vote to see the form)

I need to submit the accompanied form after the user has been authenticated in Joomla. Currently it logs in and then reloads the page, so we lose any data they have in there.

Any advice you can give me on how to make this happen is very much appreciated.
The topic has been locked.
Support Specialist
Doing it in JFBConnect is likely not the way. There's quite a few different ways to login there. You'd have to edit a lot of files to make it work in each of those ways.

I'm not sure how you're collecting the vote, but the simplest suggestions I'd have would be to:
* Store the vote data in a cookie (can be done with simple javascript)
* Create a user plugin (which would trigger on login or registration via social network or joomla) to capture that Cookie value and associate with the just-authenticated user

That doesn't mean the above is 'easy', but it makes the vote capture work outside of the method of authentication/registration and would avoid a lot of corner case/complex scenarios.

I hope that helps with some ideas, but if you need anything else or have any questions, just let me know!

Thanks,
Alex
The topic has been locked.
Thanks Alex appreciate the input. I'll keep brain working this. =^D
The topic has been locked.
Support Specialist
No problem for the advice. As noted, if you need anything else or have any questions, just let us know!

Thanks,
Alex
The topic has been locked.