thyseus / yii-user-management

a user management module collection for the yii framework
185 stars 122 forks source link

Registration: sendRegistrationMail not working - throwing exception #202

Closed ItsTommyGun closed 2 years ago

ItsTommyGun commented 9 years ago

When trying to register I always get the exception "Email is not set when trying to send Registration Email" see: registration/controllers/YumRegistrationController.php(106) ''if (!isset($user->profile->email)) throw new CException(Yum::t('Email is not set when trying to send Registration Email'));''

Really can't figure it out, anyone has an idea about that?

thyseus commented 9 years ago

It seems like the profile did not get created properly when the user got created/registered. The 'registration' submodule depends on the 'profile' submodule, so i assume you have the module activated. Can you check if the profile is created for the user and supply a stack trace? Thanks.

ItsTommyGun commented 9 years ago

At first, thanks for answering that quick!

How should I deliver the stack trace? /protected/modules/registration/controllers/YumRegistrationController.php(89): YumRegistrationController->sendRegistrationEmail(YumUser) '

'
$user = new YumUser;
$user->register($form->username, $form->password, $profile);

$this->sendRegistrationEmail($user); Yum::setFlash('Thank you for your registration. Please check your email.'); $this->redirect(Yum::module()->loginUrl); } } '

'

[...]

/index.php(13): CApplication->run() '

'
defined('YII_DEBUG') or define('YII_DEBUG',true);
// specify how many levels of call stack should be shown in each log message
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);

require_once($yii); Yii::createWebApplication($config)->run(); '

'

And how to check for profile creation? Tried to look for email being saved; it is saved in $profile, so that should not be the problem?

ItsTommyGun commented 9 years ago

Ok little update: I really can not figure out what changes have been made, but right now the "activationmail" is set to true, and I uncommented the previously commented method call (so I can keep on working with the reg process). Now after restarting my mac, starting up vagrant again and just "trying for fun" it kinda works? Well, I am not getting the activationmail right now, but he stopped throwing the exception.

Just for the record (to clear that up): I am working in a virtual environment using vagrant. Guess that explains the problem why there is no mail being sent? (Guess I have to set kind of an email server somewhere)

But at least no more exception is thrown! Still have no clue how that worked... Thanks for your patience, php/programming noob in general :/