When clicked on the "Connect" button (on homepage in my case) I'm being redirected to

http://www.sitename.com/fbconnect/register/create

Where I get some notices:

Notice: Undefined index: email in fbconnect_register_page() (line 133 of /home/sitename/public_html/siteurl.com/sites/all/modules/fbconnect/fbconnect.pages.inc).
Notice: Undefined index: email in fbconnect_register_page() (line 157 of /home/sitename/public_html/siteurl.com/sites/all/modules/fbconnect/fbconnect.pages.inc).

Comments

giorgio79’s picture

+1


Notice: Undefined index: email in fbconnect_register_page() (line 133 of sites/all/modules/fbconnect/fbconnect.pages.inc).
Notice: Undefined index: email in fbconnect_register_page() (line 157 of sites/all/modules/fbconnect/fbconnect.pages.inc).
Notice: Undefined index: email in fbconnect_register_page() (line 189 of sites/all/modules/fbconnect/fbconnect.pages.inc).
You must enter an e-mail address.
Recoverable fatal error: Argument 1 passed to drupal_http_build_query() must be an array, string given, called in includes/common.inc on line 2161 and defined in drupal_http_build_query() (line 472 of includes/common.inc).

n20’s picture

same here:

Notice: Undefined index: email in fbconnect_register_page() (line 97 of /usr/www/users/username/sites/all/modules/fbconnect/fbconnect.pages.inc).

Notice: Undefined index: email in fbconnect_register_page() (line 120 of /usr/www/users/username/sites/all/modules/fbconnect/fbconnect.pages.inc).
WhiteX’s picture

After apllying this correction I got the same error as you guys when clicked on the "Connect" button...

    Notice: Undefined index: email in fbconnect_register_page() (line 133 of /srv/www/varadifi/www/sites/all/modules/fbconnect/fbconnect.pages.inc).
    Notice: Undefined index: email in fbconnect_register_page() (line 157 of /srv/www/varadifi/www/sites/all/modules/fbconnect/fbconnect.pages.inc).
euginewm’s picture

StatusFileSize
new683 bytes

My patch solves the problem locally. But if facebook not return email, we will get the error again and again.

cogniven’s picture

I expect that the changing security restrictions of Facebook now prevents dissemination of email addresses. Going to have to change fbconnect to not reference the email address. I've modded my own code to check for the 'email' array key and default it to blank if not present. This forces entry of an email address by the user.

terbs’s picture

Whew!

What an exhausting bug. I finally figured it out though I think. It's a really easy fix

fbconnect.module, line 998, in theme_fbconnect_login_button. You need to add attribute data-scope="email" to the button

Change line:

$button = '<fb:login-button ' . drupal_attributes($attr) . '>' . $text . '</fb:login-button>';

to this:

$attr['data-scope'] = "email";
$button = '<fb:login-button ' . drupal_attributes($attr) . '>' . $text . '</fb:login-button>';

If you need to gather additonal info, use a comma separation after email, for example, you can pull back check-ins too by doing this:

$attr['data-scope'] = "email,user_checkins";
$button = '<fb:login-button ' . drupal_attributes($attr) . '>' . $text . '</fb:login-button>';

Referenced document: http://developers.facebook.com/docs/guides/web/

likewhoa’s picture

#6 doesn't resolve the problem.

    Notice: Undefined index: email in fbconnect_register_page() (line 133 of sites/all/modules/fbconnect/fbconnect.pages.inc).
    Notice: Undefined index: email in fbconnect_register_page() (line 157 of sites/all/modules/fbconnect/fbconnect.pages.inc).
    Notice: Undefined index: email in fbconnect_register_page() (line 189 of sites/all/modules/fbconnect/fbconnect.pages.inc).
    You must enter an e-mail address.
    Recoverable fatal error: Argument 1 passed to drupal_http_build_query() must be an array, string given, called in includes/common.inc on line 2161 and defined in drupal_http_build_query() (line 472 of includes/common.inc).
damien_vancouver’s picture

Status: Active » Needs review
StatusFileSize
new422 bytes

@likewhoa, The patch by aiquandol from #6 does resolve the problem, as it requires e-mail address with new facebook app logins. But... you have to clear out the App from your facebook profile before you will see the change.

The following should stop the error happening:

  1. Apply attached patch (or manually edit as per #6)
  2. Clear your caches on your Drupal site
  3. Go to your facebook account and into your Settings, then Apps, then Delete your site from the listed apps
  4. Logout from Facebook
  5. Logout from Drupal

Now you should be just like a new user coming to your site.

  1. Visit your site and press "Connect", now log in to Facebook.
  2. The Facebook authorization window that opens will require sharing of your name and e-mail address to use the site.
  3. Press the Log In button to proceed to logging into Facebook. You will be returned to your site, and the fbconnect "Connect" button is now a "Login" button.
  4. Press the "Login" button and you will end up at the page that used to have the error. But this time the e-mail address will be filled in and there is no more error

Please try all those steps and see if it goes away for you? I can't make it fail any more (though it did until I did all of the above steps to start over again).

I've rolled Aiquandol's fix from #6 into a proper patch, attached (fbconnect-register_require_email-1324150-8.patch)

arnoldbird’s picture

I followed the instructions in #8, using the patch. I'm still getting the same error messages in the original post. The only thing I didn't do in #8 is log out from Drupal, because I was already logged out.

PS -- I should mention that there is no "Connect" button in my site. I read of a "Connect" button in the fbconnect config, but have not seen that. Instead what I see is a Facebook Connect link in my menu, which leads to a page with "Log in to mysite with Facebook account" and "Click here to connect your existing mysite account with Facebook".

arnoldbird’s picture

I was able to resolve the problem on my site. I think what I had to do was turn on Fast Registration Mode, then register that way, then repeat the steps in #8 (except, of course, the patch). I was then able to turn off Fast Registration Mode and still not see the errors listed in the OP. Everything smooth.

But then the problem happened again, albeit in a scenario that is unlikely in practice. To repro the problem again, I had to delete the app in my test user's FB, log out of FB and drupal, delete the user in drupal (using my admin role), and then try the registration process over again. I was then able to resolve the problem yet again by deleting my browser cache & cookies. It appears to me that a cookie is not being deleted when it needs to be. That said, it is perhaps a rare case when a drupal user will de-authorize the FB app and then be deleted from the drupal site, and then repeat the registration process all over again. Likely by the time the user does that, he/she may have cleared the browser cookies or the cookie may be expired.

This is all pretty confusing so I will try to repro everything again tomorrow to get clarity.

jcisio’s picture

Status: Needs review » Fixed

Committed patch in #8. Thanks all.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

syntax