.

CreateaccountConfirmationHandler Class Reference
[Usermanagement]

Confirm account creation. More...

Inheritance diagram for CreateaccountConfirmationHandler:
ConfirmationHandlerBase IConfirmationHandler

List of all members.

Protected Member Functions

  do_confirm ($confirmation, $success)
  Template method to be overloaded by subclasses to do what should be done on successfull confirmation.
  do_created ($confirmation)
  Template method to be overloaded by subclasses to do what should be done on creation.

Detailed Description

Confirm account creation.

Author:
Gerd Riesselmann

Definition at line 8 of file createaccount.confirmationhandler.php.


Member Function Documentation

CreateaccountConfirmationHandler::do_confirm ( confirmation,
success  
) [protected]

Template method to be overloaded by subclasses to do what should be done on successfull confirmation.

Parameters:
DAOConfirmations  Data of confirmation, not necessarily up to date, depending on status
enum  Indicates success or failure

Reimplemented from ConfirmationHandlerBase.

Definition at line 17 of file createaccount.confirmationhandler.php.

00017                                                                {
00018                 if ($success == self::SUCCESS) {
00019                         $user = Users::get($confirmation->id_item);
00020                         if ($user) {
00021                                 $cmd = CommandsFactory::create_command($user, 'status', Users::STATUS_ACTIVE);
00022                                 $ret = $cmd->execute();
00023                                 $ret->merge(Users::confirm_email($user));
00024                                 if ($ret->is_ok()) {
00025                                         return new Message(tr('Your registration has been confirmed', 'users'));
00026                                 }
00027                                 else {
00028                                         return $ret;
00029                                 }
00030                         }
00031                         else {
00032                                 return new Status(tr('No matching user account was found', 'users'));
00033                         }                       
00034                 }
00035                 else {
00036                         return parent::do_confirm($confirmation, $success);
00037                 }
00038         }
CreateaccountConfirmationHandler::do_created ( confirmation  )  [protected]

Template method to be overloaded by subclasses to do what should be done on creation.

Parameters:
DAOConfirmations  Data of confirmation
Returns:
Status

Reimplemented from ConfirmationHandlerBase.

Definition at line 48 of file createaccount.confirmationhandler.php.

00048                                                      {
00049                 $ret = new Status();
00050                 
00051                 $user = Users::get($confirmation->id_item);
00052                 if ($user) {
00053                         Load::commands('generics/mail');
00054                         $cmd = new MailCommand(
00055                                 tr('Your registration', 'users'),
00056                                 $user->email,
00057                                 'users/mail/register',
00058                                 array(
00059                                         'confirmation' => $confirmation,
00060                                         'user' => $user
00061                                 )
00062                         );
00063                         $ret->merge($cmd->execute());
00064                 }
00065                 else {
00066                         $ret->append(tr('Unkown User set on register confirmation', 'users'));  
00067                 }
00068                 
00069                 return $ret;
00070         }               

The documentation for this class was generated from the following file: