Topic-icon Disable new user registration via JFBConnect 4.2 (in Joomla 2.5)

Support Specialist
Parr,
Sorry to hear that didn't work for you and sorry for the delayed response. We're looking into reasons why the code in both examples may not have worked. We did test it first before sending it, so it may just be a configuration setting we didn't account for.

Can you try enabling the "Always import profile" setting in the "Profiles" area of JFBConnect and try using either feature and let us know if that works? If so, we'll just need to figure out how to make those work without having that setting enabled.

Thanks again, and keep us posted. If that doesn't change the behavior, we'll test some more, and may access your site to see if there's anything else of note on there that may be preventing the profile import.

Alex
The topic has been locked.
Active Subscriptions:

None
Hi Alex,

Thanks for getting back to me.

I've just tried setting the 'Always Import Profile' setting to 'Yes' and it did import the Facebook avatar & profile information again. However, if I then changed the Avatar on my website - logged out and back in again using FJBConnect - it pulled my Avatar from Facebook again (overwriting the site choice), which is what I wanted to prevent i.e. I only wanted it to import once (unless the pull button is used)...

Cheers.

Regards,

Parr
The topic has been locked.
Support Specialist
That's fine, like I said, "test". That's exactly what I wanted to know. Now we know the settings to test with better and can hopefully make a small code change to make it so you don't need that setting enabled.

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

None
Cool, cheers Alex. Appreciate all this extra help - hopefully it'll come in use for someone else too! :-)
The topic has been locked.
Support Specialist
Parr,
Alright, got a really minor change to both snippets of code that will hopefully work as well for you as it did for us. In both sections of code that I provided in the loginregister.php and controller.php file, there is the following line:
$jfbcLibrary = JFBConnectFacebookLibrary::getInstance();
After that line in each block, simply put the following line:
[code]            $jfbcLibrary->setInitialRegistration();

That will effectively 'trick' the profile plugins into thinking the user is registering for the first time and import the profile as such. Should work just fine, but obviously test, test, test and let us know how it goes!

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

None
Hi Alex,

Thanks for this - unfortunately the minor code edit doesn't seem to have had the desired affect just yet.

I wasn't sure whether I was meant to be reverting the "Always Import Profile Data" setting back to 'No', that you asked me to change in our last tests - so I tried it on both settings. Also it became apparent that having the "Skip Joomla User Activation" set to 'No' (which is what I originally had it set to) meant that the user wouldn't be able to login after the last modifications. I ended up trying it in four different configurations which I thought I'd list below just in case it has any bearing. Each time I deleted the user completely from Joomla, cleared all cache, changed the option in Joomla admin and then tried again. I tried each option at least twice.

1st Test Settings:
"Always Import Profile Data": Yes
"Skip Joomla User Activation:" No (this is how it was originally set)

Results:
Takes them to my "FB Thank You Registration page" set by the "New User Redirection" JFBConnect option. Gives them a system message telling them that they'll be sent a link to activate their account.

Sends them an activation email link, which when clicked gives them an Error 403 (Access forbidden) page.
Then doesn't allow them to login in using Facebook.
Checked in JFBConnect and it had a mapping between the new Joomla user and their Facebook account

2nd Test Settings:
"Always Import Profile Data": Yes
"Skip Joomla User Activation:" Yes

Results: Pulls in FB avatar upon first login. Changed avatar on my website, logged back and it automatically re-imported Facebook photo.

AND sends an email to the user every single time they log-back into the website using JFBConnect telling them that "You may now log in to www.mywebsite.com/ using your Facebook credentials!"

Checked in JFBConnect and it had a mapping between the new Joomla user and their Facebook account

3rd Test Settings:

"Always Import Profile Data": No
"Skip Joomla User Activation:" No

Results: Takes them to my "FB Thank You Registration page" set by the "New User Redirection" JFBConnect option. Gives them a system message telling them that they'll be sent a link to activate their account.

Sends them an activation email link, which when clicked gives them an Error 403 (Access forbidden) page.
Then doesn't allow them to login in using Facebook.
Checked in JFBConnect and it had a mapping between the new Joomla user and their Facebook account

4th Test Settings:
"Always Import Profile Data": No
"Skip Joomla User Activation:" Yes

Results: Pulls in FB avatar upon first login. Changed avatar on my website, logged back and it automatically re-imported Facebook photo.
AND sends an email to the user every single time they log-back in the website using JFBConnect telling them that "You may now log in to www.mywebsite.com/ using your Facebook credentials.
Checked in JFBConnect and it had a mapping between the new Joomla user and their Facebook account

I hope you've got a few more 'tricks' up your sleeve :-) I've currently disabled the user account details that I sent you previously, but let me know if it helps to reactivate them

Cheers Alex.

Regards,

Parr
The topic has been locked.
Support Specialist
Parr,
I'm a bit confused... the beginning of this thread was how to disable registration through Facebook. The first 3 or so posts in this thread were how to disable JFBConnect from registering users. If you implemented the code in the 2nd post which disables JFBConnect's ability to register users, then the Skip Joomla Activation setting shouldn't do anything... we shouldn't be registering users at all.

My code change above was to allow you to keep the "Always Import Profile Data" setting as "No". Then, when a user registers with Joomla (since they can't with JFBConnect), then they can later click the "Connect Profile" or "Update Profile" links and import their Facebook information into Joomla.

So.. with that said, can you explain more of what you're trying to do? Is new user registration with JFBConnect enabled or not? Are you trying to get the user's profile information when they register, when they log back in later, when they 'connect' their accounts, or when they explicitly click a link to import their information?

Also, please let me know what code you've implemented above: Disabling New Users Registration (post 2), the import profile on login/link (from June 12) and the 'fix' for that from 6/17.

The threads gotten a bit off-track, so if you can let me know your goals, again, and what code you've implemented, that will help narrow down where the issues really lie.

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

None
Hi Alex,

Apologies for the confusion - I think I caused it when I said:

Each time I deleted the user completely from Joomla, cleared all cache, changed the option in Joomla admin and then tried again. I tried each option at least twice.

I failed to mention in the sentence above that after deleting the user in Joomla, I then recreated the account (from the Joomla back-end admin) - in order to attempt testing what an existing (*fresh*) user would get when connecting their Joomla login to Facebook.

To summarize what I'm hoping to achieve:

  • I don't want users to be able to register for a Joomla account via Facebook - this part currently works, as if a Facebook user with an email address not listed in any of my current Joomla users accounts clicks on JFBConnect Login button - it redirects them correctly to a page saying "Facebook registration not enabled" (where I've got a 'contact us' link etc and an explanation it's just for current users)

  • I want existing users with Joomla accounts to be able to connect their account to Facebook. This is currently via the 'Connect with Facebook' button from the SC Login Module - but eventually I was hoping to have a button/link that appears in one of my own articles/modules as per the other support forum thread I've recently updated.

  • Upon the first time they connect their Facebook account, I wanted it to pull down their Avatar/Facebook profile - but not on any subsequent logins (just in case they update their profile/Avatar etc on my site and want it to be different to Facebook).

  • I also wanted the 'Pull from Facebook' button option that you mentioned, so that in the event they do update their Facebook avatar/profile and want to pull the information to my site - they can do so manually on demand.

  • To confirm, I've implemented all the code changes that you advised (in posts 2, 9 & 15).

    Main problems:

  • I realize that the "Skip Joomla Activation" shouldn't do anything - but if I have it set to 'No', it redirects existing Joomla users (without an FB mapping) to a page telling them that they'll be sent an email with an activation link. When the email arrives with the link and is clicked it gives them a '403' error message. Regardless of whether they click the link or not, it doesn't allow them to login with FJBConnect.

  • If I have 'Skip Joomla Activation' set to 'Yes', it does then allow them to login - but every single time they login using FBConnect they get an email telling them that they've successfully connected their account to FB and it imports their FB avatar/profile on every successful login as well.

  • Hopefully this clarifies what I meant... Let me know if not. :)

    I'm now thinking that if it's too complicated to only import the avatar/profile on the first time they connect their Facebook account - that just having a 'Pull from Facebook' button would actually be sufficient - with it not pulling in any information on the first login.

    As per before, if it helps I can re-activate the sourcecoast admin account that I setup. Let me know if you want this access.

    Thanks again and sorry for the confusion.

    Regards,

    Parr
    The topic has been locked.
    Support Specialist
    Parr,
    Your explanation was fantastic! Just from reading it, I know where the problem lies.. basically, when I had you add that extra line of "$jfbcLibrary->setInitialRegistration()" that properly allows the avatar/profile to be imported, but it's inadvertantly kicking off other 'new user' stuff (like emails).

    I'll have to do so some more investigation into the best fix, but will have something soon. An admin account really wouldn't help right now. It's honestly easier for us to try and recreate what you're looking for, test, and send you the code for you to tell us we were wrong :)

    Thanks again for the clarity and for your patience. We have no problem working with you until this is right since we'll likely roll it into the next (v4.3) release.

    Alex
    The topic has been locked.
    Support Specialist
    Parr,
    Very sorry for the delayed response to this. We were trying to recreate the issue you're experiencing today and ran into some troubles. We could see part of the problem, but honestly could create all the problems. One thing we realize we never asked was what profile plugins you have enabled? Can you let us know that so we can test with (as close to) your exact configuration?

    We'll do what we can to get you an answer soon. Your post above was very descript, unfortunately, the fix looks like it will take a little more work than we expected. Still looking for the 'silver bullet' line or 2 of code... I think it's gonna take a lot of little changes in a few different files though.

    Thanks, and sorry again for the delay,
    Alex
    The topic has been locked.