Email alert after registration, BEFORE any products purchased

Discussion in 'Customization & add-ons' started by richard_fullbrook984, Oct 27, 2015.

  1. ENTS

    ENTS aMember Pro Customer

    Joined:
    Aug 13, 2015
    Messages:
    10
    I am looking to have an email alert to admin, as soon as a new user is created, even before any products are purchased.

    Is there a way to do this without writing a plugin?
  2. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    There is not such option unfortunately. It can be done as plugin. You can use event Am_Event::USER_AFTER_INSERT to do it. Actually it is not too complex to incorporate this feature. You can use the following code in site.php ( http://www.amember.com/docs/Site.php_file )
    PHP:
    Am_Di::getInstance()->hook->add(Am_Event::USER_AFTER_INSERT, function(Am_Event $e){
        
    $user $e->getUser();
        
    $mail $e->getDi()->mail;
        
    $mail->toAdmin();
        
    $mail->setBodyText(<<<CUT
    New User Registration:
    {$user->login}{$user->name_f} {$user->name_l}<{$user->email}>
    CUT
            );
        
    $mail->setSubject('New User Registration');
        
    $mail->send();
    });
    Just customize message content according your requirements.

    You can find more info about aMember event system here
    http://www.amember.com/docs/API/HookManager

Share This Page