Forward Expired Users on Login

Discussion in 'Customization & add-ons' started by cpaprotna, Jun 19, 2014.

  1. cpaprotna

    cpaprotna Member

    Joined:
    Dec 23, 2013
    Messages:
    44
    Right now, if a user has expired products and logs in, amember automatically forwards them to the default signup page. I want to forward them to a custom plugin that I am building.

    In the bootstrap.php file for my plugin I added the following function:
    Code:
       
    function onauthAfterLogin(Am_Event $event)
        {
            /* @var $user User */
            $user = $event->getUser();
            if (!$user->getActiveProductIds()) {   
                $this->_redirect('my_plugin_path');
            }
        }
    
    Is bootstrap.php the correct place to put this function? Should be in site.php instead? Is $this->_redirect('path') the correct way to have amember redirect to a new page? I looked in the configuration section of admin and can set where to send a user with active products, but there is no setting on where to go if they do not have any active products.

    Also, I want users to use my custom signup forms (in the plugin and not in your signup) Is there an event that can be used to redirect to my plugin if someone tries to view your standard signup forms?

Share This Page