PW 3.0.69 plus PW Login for Facebook

Recommended Posts

Thanks for this module!!!


You can choose to have all Facebook logins map to the same user account, but the default behavior is to have it automatically create new ProcessWire user accounts for each Facebook user.

I am wondering, because "mapping to the same user account" is always disabled. Creating a new user account for each Facebook login user will lead to problems in my case, because I dont allow to register an email address twice. (fe. same email address on Facebook Login and default login). This is because I have a "forgot password" link on my frontend where you have to enter the email address only to get an email with a new password. If there are two equal email addresses in the DB this leads to problems.

I dont want to rewrite it to enter the username in addition to the email address, because sometimes people forget username and password.

So how can I map all FB Logins to one user account?

It will also be a great addition if it would be possible to connect facebook logins to the default user account.

Fe. if someone is logging in with FB and the same email address is also stored in the user DB, then the user will be asked if he wants to connect his FB Account with the default account.

If "yes" then the user will be asked to enter his password to verify this is his own default account. If the password is entered correctly than the FB Login Account will be connected to the default account.

Best regards Jürgen


Share this post

Link to post
Share on other sites

I found this line of code in config.php line 131:

$f->addOption(0, $this->_('Make all Facebook users point to the same ProcessWire user'), array('disabled' => 'disabled'));

Should I remove the disabled array to make it work or is there another possibility without changing the code?

Best regards

Share this post

Link to post
Share on other sites

Is anyone else getting this error?

This error occurs in two scenarios.

1. Currently logged into facebook. Selecting to login using facebook from web site. Immediately displays this error.
2. Not logged into facebook. Selecting to login using facebook displays the facebook login form. This error is displayed after logging into facebook.


Share this post

Link to post
Share on other sites

@rick What has been logged to /site/assets/logs/errors.txt (also exceptions.txt)? It can help you pinpoint the origin of the error.


Hmm. I think after authorization with FB, it redirects back to your public endpoint with a token code, but it seems like something about that page or FB module causes error to be thrown

  • Like 1

Share this post

Link to post
Share on other sites

I removed the login code on the site and the 500 error is no longer present. However, the only log entries are similar to that included below.

I changed the mapping of facebook picture field to pw image field in module settings.

The error and exceptions logs continue showing this error...



Error: Exception: Item added to ProcessWire\Pageimages is not an allowed type (in /.../wire/core/WireArray.php line 259)

#0 /.../wire/core/Pagefiles.php(326): ProcessWire\WireArray->add(Array)
#1 /.../wire/core/Pageimages.php(54): ProcessWire\Pagefiles->add(Array)
#2 /.../wire/modules/Fieldtype/FieldtypeFile.module(256): ProcessWire\Pageimages->add(Array)
#3 /.../wire/core/Page.php(942): ProcessWire\FieldtypeFile->sanitizeValue(Object(ProcessWire\User), Object(ProcessWire\Field), Array)
#4 /.../wire/core/Page.php(809): ProcessWire\Page->setFieldValue('avatar', Array, true)
#5 /.../site/modules/LoginFacebook/LoginFacebook.module(587): ProcessWire\Page->set('avatar', Array)
#6 /.../wire/core/Wire.php(386): ProcessWire\LoginFacebook->___updateUser(Object(ProcessWire\User), Array)
#7 /.../wire/core/WireHooks.php(698): ProcessWire\Wire->_callMethod('___updateUser', Arra

This error message was shown because: you are logged in as a Superuser. Error has been logged.


Attempting to save the user's facebook picture to an image field fails with the above error.

Creating and adding a text field to the user template, and mapping the facebook picture to that field does not display an error (log in is successful), but no data is stored in the text field. There is no picture_url field as shown in the blog post., only picture is available in settings.

Attempts to dump the $facebook variable to a log file or echo'd results in a 500 error.

The server is running other PW (3.0.62) sites (no facebook login module) without issues.

I'll get it sorted eventually. I was just curious if anyone else had experienced this problem so I can tell where i am pulling another newbie stunt.


Share this post

Link to post
Share on other sites

Facebook doesn't let you pull images if you aren't logged in. Meaning, only the client side can pull images, the server side cannot (meaning, ProcessWire cannot since Facebook blocks it). So if you are going to use picture or picture_url (or other images), you have to refer to it directly in an <img> tag using the URL facebook provides, rather than trying to pull a copy and store it in PW. 

  • Like 2

Share this post

Link to post
Share on other sites

Hi @ryan,

Figured this is a better place to post this question;

Im using your facebook login module, works as a charm.
But, when I have a link provided on my facebook account, and try to login within the facebook web-view (clicking link on the facebook page on mobile).

Im getting a 'Invalid request (no Facebook state)' error.

Any idea how to solve this?

Thanks in advance.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.