Affiliate autoresponder sequence

Discussion in 'Templates customization' started by sharpend, Apr 10, 2020.

  1. sharpend

    sharpend aMember Pro Customer

    Joined:
    Jan 8, 2008
    Messages:
    28
    I want to put affiliates on an email sequence but I don't see anyway to do this other than setting up a product, queuing up the emails, disabling the product on the dashboard and granting access when I approve them as an affiliate.

    So the product is nothing but an email sequence.

    Any other way?

    Thanks
  2. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    Hello,

    I am afraid there is not other way but I can suggest code that automatically add your product to user account if you approve him for affiliate. Here is code that you can put to site.php:
    (1 within code is ID of product that you want to add):
    https://docs.amember.com/docs/Site_php_file

    PHP:
    Am_Di::getInstance()->hook->add(Am_Event::USER_AFTER_UPDATE, function(Am_Event $e) {

        
    $old $e->getOldUser();
        
    $user $e->getUser();

        if (
    $user->is_affiliate
            
    && $user->is_approved
            
    && ($user->is_approved != $old->is_approved || $user->is_affiliate != $old->is_affiliate)
        ) {
            
    $access $e->getDi()->accessRecord;
            
    $access->user_id $user->pk();
            
    $access->begin_date sqlDate('now');
            
    $access->expire_date Am_Period::MAX_SQL_DATE;
            
    $access->product_id 1;
            
    $access->save();
        }

    });
    sharpend likes this.

Share This Page