Hi having a problem with the Login Toboggan module when a user tries to register.

Anybody with ideas or a solution would be much appreciated

•Notice: Undefined variable: mailkey in logintoboggan_user_register_submit() (line 524 of /usr/www/users/shonghjazq/sites/all/modules/logintoboggan/logintoboggan.module).
•Notice: Undefined variable: text in _user_mail_text() (line 2770 of /usr/www/users/shonghjazq/modules/user/user.module).
•Notice: Undefined variable: text in _user_mail_text() (line 2770 of /usr/www/users/shonghjazq/modules/user/user.module).
•Unable to send e-mail. Contact the site administrator if the problem persists.

Notice: Undefined variable: mailkey in logintoboggan_user_register_submit() (line 525 of /usr/www/users/shonghjazq/sites/all/modules/logintoboggan/logintoboggan.module).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Road Kill’s picture

Bryan Cordrey’s picture

I installed LoginToboggan 7.X-1.3 with Drupal 7.21. I was able to register and received an email. Did you configure logintoboggan in any way? Do you have any update to this issue?

Road Kill’s picture

Hi Bryan I did not make any changes to module just installed and selected the email confirmation field.
Is there any information or testing I can do to help with this issue.

Road Kill’s picture

I am using fancy login. I am going to disable it and see if it might be the cause.

Bryan Cordrey’s picture

This sounds like it could be a problem. These two modules seem to have compatibility issues (http://drupal.org/node/857450).

Road Kill’s picture

Okay tried Login Toboggan with fancy login disabled but I am still getting the same error. I think I will have to setup a copy of the site on a test domain and start disabling modules as it can only be another module that is causing this problem. I will give you feed back once I have done the above.

Thank you again for your reply and assistance with this.

seanenroute’s picture

Hi, I ran into the same problem from a spam bot. The disturbing thing is that I had "Who can register accounts?" set to Administrators only and the site set to maintenance mode.

Somehow the bot was not only able to create an account it managed to activate the account as well.

I've attached the screen shots from the reports pages.

Road Kill’s picture

Hi Bryan I tried with fancy login disabled but the problem remains. I have some other modules that I think could be the problem I will try test this week and give feedback.

calso000’s picture

Anyone have any solutions to this one? Thanks!

JustinCase76’s picture

Subscribe

JustinCase76’s picture

I was able to figure this out, but my SMTP server does NOT require authentication. If you have the same scenario, simply remove both the username (email) and the password from the SMTP authentication section.

Worked for me!

challer’s picture

I had the same issue, same error messages and the email was sent empty. Changing Drupal settings to allow Visitors to create accounts instead of Administrators only fixed the issue for me

aken.niels@gmail.com’s picture

Issue summary: View changes

@challer Same here. Simply enabling the guests to allow registration fixed the errors for me.

dsdeiz’s picture

Status: Active » Needs review
FileSize
1.41 KB

It looks like $mailkey is not set when user creation is for "Admin only". Added the necessary fix.

There is also a case wherein if "Present a unified login/registration page" is checked, the user is still displayed with the "User Registration" ("I want to create an account") in the /user page. Added a fix here as well.

Patch attached.

dsdeiz’s picture

Oh, my bad. Didn't see the "Unified login" already being worked at #1017106: Enabling the Unified registration page breaks the 'administrators only' account creation setting and #1883170: Does not respect "administrator only registration" when "unified login" activated. I've updated them patch and I'll try to work on the Unified Login" issue.

rbayliss’s picture

This issue can also pop up if you're doing funny things on user registration. I'm supporting a registration workflow where approval is required for certain users, but not required for others, depending on the Profile2 that they register with. To do this, we're changing the value of user_register on the fly, which means you can end up in this function with no mailkey set. In this case, a blank email goes out to the user. Attached patch is a reroll of #15, along with a check to only attempt sending a notification e-mail if the mailkey has been set.

quantos’s picture

#12 worked for me - thanks. Fully tested afterwards too.

Q.

dpliscoff’s picture

#16 worked ok on 7.x-1.5. Using invite and prlp to allow registering users only through invitations. Kudos!
D.

ShaunDychko’s picture

Status: Needs review » Reviewed & tested by the community

#16 is super.

ShaunDychko’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
1.3 KB

Actually, #16 didn't respect the "Notify user of new account" checkbox on the admin user create form at /admin/people/create. An email was always sent. The attached patch borrows from #16, but sends a notification for admin created users only if that checkbox is selected.

markpape’s picture

I have a solution that may help others here and it ensures the email is delivered after an invite is accepted.

I include part of patch from #16 but not the removal of the $mailkey, if $mailkey isn't set it prevents an email from being sent. The primary issue here is that there is no email template ($mailkey) option to select in the "people" config settings (/admin/config/people/accounts), this is a failure of the invite module i assume and a hook could include the "invite only" email template ($mailkey) there. For now i use the 'register_no_approval_required' email template ($mailkey).

I have added 2 conditions, one for "invite only" (new) and one for "admin created" (seen in #16 and #20), both are missing.

It may be worth mentioning that i have "Immediate Login" set on logintoboggan, /admin/config/system/logintoboggan, so message is set based on that.

Add this code after line 520 of the logintoboggan module 7.x-1.5 :


} elseif(variable_get('user_register', 1) === 'invite_only'){
    // Allow for invite module here
      $mailkey = 'register_no_approval_required'; // No mailkey for invite as yet, use existing and edit that, see /admin/config/people/accounts

      $message = t('Congratulations! Invite Registration Complete.');

  } elseif (variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL) == USER_REGISTER_ADMINISTRATORS_ONLY) {

      $mailkey = 'register_admin_created';

Note:

  • Some of the insight came from looking at the Registration Invite Module (7.x-1.0+3-dev)
  • I'm using Profile 2 (7.x-1.3), Invite (&.x-4.0-beta5), Registration Invite (7.x-1.0+3-dev) & Logintoggan (7.x-1.5) modules

:)