Automatic Helpdesk ticket on signup

Discussion in 'Customization & add-ons' started by woostar, May 21, 2012.

  1. woostar

    woostar New Member

    Joined:
    May 15, 2012
    Messages:
    2
    Hi there.

    Is there anyway I can start a welcome ticket (from admin) in the Helpdesk on creation of a new account?

    Regards,
    W.>
  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Add this to /amember/application/configs/site.php:
    PHP:
            Am_Di::getInstance()->hook->add(Am_Event::USER_AFTER_INSERT'onUserAfterInsert');
            function 
    onUserAfterInsert(Am_Event $event){
                
    $user $event->getUser();
                
    $di Am_Di::getInstance();
                
    $ticket $di->helpdeskTicketRecord;
                
    $ticket->user_id $user->user_id;
                
    $ticket->status HelpdeskTicket::STATUS_AWAITING_USER_RESPONSE;
                
    $ticket->subject 'Welcome user '.$user->name_f.' '.$user->name_l;
                
    $ticket->insert();
                
    $message $di->helpdeskMessageRecord;
                
    $message->admin_id $di->authAdmin->getUserId();
                
    $message->content =  'Welcome to helpdesk. Simple content';
                
    $message->ticket_id $ticket->ticket_id;
                
    $message->insert();
                
            }
    woostar likes this.

Share This Page