Topic-icon Does JFBConnect have any event triggers?

Active Subscriptions:

None
3 years 11 months ago - 3 years 11 months ago #66271 by skyiron
Does JFBConnect have any event triggers? Specifically, is there any event trigger that can be used from within JFBConnect to allow 3rd party plugins to do a redirect when the user clicks on the social login button?

This question has come about from a discussion I had with one of the EasySocial Developers.

I originally asked-
Is there any way to get an unregistered user who logs in using social login (JFBConnect) to be redirected to a payplans subscription? I would like them to select a plan.
At the moment, when an unregistered user logs in using JFBConnect their account is created with no way for them to choose a profile type. I know that I can set a default profile type, but I was hoping there might be a way for PayPlans to show subscription options before completing the account creation process (or show it to them afterwards).
Last edit: 3 years 11 months ago by skyiron.
The topic has been locked.
Support Specialist
3 years 11 months ago #66277 by alzander
There is no current way to bring a user to a specific page before they create their account. The reasoning behind that is if we send the user to another component, there's no guarantee that the other component would ever send them back to actually have the account created. So, the only way to have a user select a plan is after their registration is completed.

With that said, we do have multiple triggers for different actions, but not one for 'post login redirect'. There is a setting in JFBConnect for "New User Redirection" which is where a user would be brought after they create an account. Is there a reason using that redirection wouldn't work for you? We know of multiple sites with subscription/profile plan type features that use the new user redirection to let a user select a plan after registering with a social network.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
3 years 11 months ago - 3 years 11 months ago #66279 by skyiron
Hi Alex,
I've not tested it yet, but in my case, it might not work, the reason being is that there are (unintentionally) 2 ways a new user can register on the site.

The first way is on the EasySocial login page. If an unregistered user tries logging in then a new account is created. It is this pathway that is the issue.

File Attachment:


The second way is when the user clicks on the register button on the EasySocial login page. This takes the user to the Payplans subscription options and then to the register page where they can create an account using JFBConnect. This way is not a problem.

File Attachment:



I haven't tested this yet, but if I use the redirect option that you mentioned I believe that the new user registering via the PayPlans would then be redirected to the PayPlans option page again (does this sound right? The assumption is that the payplans option page is where I would put the redirect to).
Last edit: 3 years 11 months ago by skyiron.
The topic has been locked.
Active Subscriptions:

None
3 years 11 months ago - 3 years 11 months ago #66281 by skyiron
I just tested this and it fixes the issue with the unregistered user signing in, but it causes an issue with the payplans registration flow.

The user selects a PayPlans subscription option/profile then registers via JFBConnect, the account gets created and the user redirected to the PayPlans option page but the PayPlans subscription option that was chosen is lost(not recorded in their account info) and they have to choose again. I imagine seeing the PayPlans subscription options a second time would be confusing.

If you have any other ideas, please let me know. I'm happy to test them out.
Last edit: 3 years 11 months ago by skyiron.
The topic has been locked.
Support Specialist
3 years 11 months ago #66290 by alzander
From the 2 paths you mention above, I'm not really sure of the difference. You mention underneath that the user selects a PayPlans option and then registers.. but you also said the first path starts on the EasySocial registration page.. so not sure how they're going from PayPlans to register through JFBConnect.

With that said, I'm not sure how PayPlans stores your selection and then tries to recall it later, but it's not something the JFBConnect registration should interfere with. It sounds like that recall does work when you register through Joomla or EasySocial... but unsure if that's special integration with those registration flows or something that's a conflict with JFBConnect. Normally, a selection like that would be stored in a session value and then retrieved once you return to the selection page to have it already selected or skipped altogether.

The flow you mention above of registration -> plan selection is our best recommendation. If there's a way to show the plans, but not let the user select while showing the social registration icons, they can see the options, register and then select the one that fits them best. That's my best immediate suggestion.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
3 years 11 months ago - 3 years 11 months ago #66291 by skyiron
Let me simplify it a little.

The problem arises when a user who is not registered on my site, clicks log in.

If we could eliminate automatic account creation when an unregistered user tries to login with JFBConnect, the problem would be solved. Is it possible to stop this?

***********************************************************************************************************************************************************************************
The menu for the EasySocial page that this is occurring on is configured as EasySocial » Dashboard » (User) Dashboard Layout
using JFBConnect buttons for the social login side of things.

File Attachment:


You were wondering how I got from EasySocial Registration to PayPlans- I have customized the Registration part to link directly to the PayPlans subscription page. So registration doesn't really start until that PayPlans page.
Last edit: 3 years 11 months ago by skyiron.
The topic has been locked.
Support Specialist
3 years 11 months ago #66298 by alzander

If we could eliminate automatic account creation when an unregistered user tries to login with JFBConnect, the problem would be solved. Is it possible to stop this?

You can set the "Enable Automatic Registration" to 'No'. That won't automatically create the user, but will then bring them to JFBConnect's own registration page where they can set their username, password and other profile fields (or confirm the data imported from the social network they chose).

I don't think that's what you'd want either.

It sounds like you want the social buttons, but you want them to redirect to the PayPlans selection page if a user isn't registered. Then, the user would select their plan and have to click the social login button again to actually create their account? That's not something we support as we wouldn't know the 2nd time if the user really was ready to have their account created.

It really sounds like you just want to hide the SCLogin module (or whatever methods you're using to show the social login buttons) and only show them on the PayPlans selection page (or the page after they select, I'm not sure). To do that, you can disable our module and use the {JFBCLogin} tag in the place that you want the buttons to show. I think that would do what you're looking for.. the user clearly sees buttons for "Register" which they click to select a plan and then will see the social registration options in the correct place. Similarly, you can have a simple "Login" button that goes to the Joomla or EasySocial login pages which let the user login with their choice of account there.

I hope this helps with some ideas, but don't hesitate to ask more questions. Unfortunately, I don't see any magic bullet way with a simple switch to do exactly what you're looking for.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
3 years 11 months ago - 3 years 11 months ago #66303 by skyiron
Does JFBConnect support overrides? And just out of interest, does JFBConnect treat registrations and logins the same? By that I mean, does JFBConnect know if the user tried to register or to login? Can it distinguish between the two? If so, can you point me to the file/code responsible?

I’ve been looking at
html\components\com_jfbconnect\controllers\login.php
and
html\components\com_jfbconnect\controllers\loginregister.php
to see if I can’t come up with something myself.

USER wrote: You can set the "Enable Automatic Registration" to 'No'. That won't automatically create the user but will then bring them to JFBConnect's own registration page where they can set their username, password and other profile fields (or confirm the data imported from the social network they chose).
I don't think that's what you'd want either.


This is not what I am after, unless I can somehow pass the imported data on to EasySocial or PayPlans and continue the registration with them.

USER wrote: It sounds like you want the social buttons, but you want them to redirect to the PayPlans selection page if a user isn't registered.


This is close to what I want, but redirecting isn’t necessary. Telling the user to register before logging in (or something similar) would suffice. I could just put a link to the payplans page in the message.
It really sounds like you just want to hide the SCLogin module (or whatever methods you're using to show the social login buttons) and only show them on the PayPlans selection page (or the page after they select, I'm not sure). To do that, you can disable our module and use the {JFBCLogin} tag in the place that you want the buttons to show. I think that would do what you're looking for.. the user clearly sees buttons for "Register" which they click to select a plan and then will see the social registration options in the correct place. Similarly, you can have a simple "Login" button that goes to the Joomla or EasySocial login pages which let the user login with their choice of account there.

Thank you for the suggestion, but unless I am missing something, I don’t think this is a viable option as I don’t want to hide the JFBConnect social buttons for login. I already clearly show Register and Login, so for most people the issue I’ve described shouldn’t be a problem, but you know there will always be someone who has to do things differently.
The EasySocial login page would need to show the JFBConnect buttons so the same issue could still happen but on a different page.
Last edit: 3 years 11 months ago by skyiron.
The topic has been locked.
Support Specialist
3 years 11 months ago #66321 by alzander
Joomla directly supports template overrides, so we support those as well. We don't have any mechanism to override any file, though you could create a system plugin to do so (that can get ugly fast though, so not necessarily recommending that).

Can it distinguish between the two? If so, can you point me to the file/code responsible?

Yes, JFBConnect knows if the user is 'unknown' (and needs to register, either automatically or through the form) or already has an account (and therefore needs to be logged in). You can find that code in the /controllers/login.php file in the 'login' function.

Specifically, around line 61, you'll see:
$jUserId = $userMapModel->getJoomlaUserId($providerUserId, $provider->systemName);
That checks if the user has already authenticated with a social network. So, at this point, you could check if they are 'new' or not and do something different if you The next statement is an 'if' statement that they'll be sent through which may automatically create them an account or redirect them to the JFBConnect registration page.

If they have an account *or* an account was just created for them automatically, they'll jump down to around line 143 where we'll then log them in.
$jUser = JUser::getInstance($jUserId);
$jUser will be their Joomla user ID that they'll be logged in with. At that line they aren't actually logged in yet though, that happens in the next if block with the comment of 'try to log user'.

You can check the "$provider->initialRegistration" variable to see if an account was created for them from here on out as well.. if true, an account was just created for them. If false, they already had an account.

Hopefully that helps locate the right spot to make some changes. Let us know what you come up with or if you need any further assistance.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
3 years 11 months ago #66322 by skyiron
Thanks a lot Alex!
I will definitely poke around and see what options I have. Thanks :)
The topic has been locked.