custom plugin - need help with code

Discussion in 'aMember Pro v.4' started by ges33, Apr 26, 2012.

  1. ges33

    ges33 Member

    Joined:
    Jan 20, 2012
    Messages:
    41
    I'm trying to created a plugin that will notify me by email when a user:
    1. signs up
    2. unsubscribes

    I found some code in the forums that worked for the new user sign up, but when I try and add in the unsubscribe that doesn't seem to be functioning. Here's what I have:

    PHP:
    class Am_Plugin_Newmember extends Am_Plugin
    {
        const 
    PLUGIN_STATUS self::STATUS_PRODUCTION;
        const 
    PLUGIN_REVISION '1.0.0';
     
        function 
    onSignupUserAdded(Am_Event $event)
        {
            
    $user $event->getUser();
     
            @
    mail('user@example.com '' aMember4 new user 'print_r($user->toRow(), TRUE));
        }
     
        function 
    userUnsubscribedChanged(Am_Event $event)
        {
            
    $user $event->getUser();
     
            @
    mail('user@example.com''aMember4 user unsub'print_r($user->toRow(), TRUE));
        }
    What am I doing wrong? Thanks!
  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Correct function name for this hook must be:

    function onUserUnsubscribedChanged(Am_Event $event)

Share This Page