Disabling particular product emails to admin?

Discussion in 'Installation' started by thared33, Mar 26, 2010.

  1. thared33

    thared33 Member

    Joined:
    Dec 11, 2009
    Messages:
    73
    I've got multiple products. Some are paid products, and one isn't (there for free forum registration). How can I disable amember from sending me emails when a user signs up for the free product/forum registration, and only allow emails from the paid products? I only see a global setting for enabling emails for every product, free or not.
  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    What emails you mean?
  3. thared33

    thared33 Member

    Joined:
    Dec 11, 2009
    Messages:
    73
    Amember sends me an email saying, 'new payment completed' every time someone signs up for a free membership. I've got vbulletin integrated with amember. I have a few products - paid, and one that is simply a forum registration. Every time someone signs up for any product, free or not, amember sends the 'new payment completed' email.

    I'd like for amember to ONLY send me an email saying 'new payment completed' if it's a paid product, and not the free option.
  4. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Edit /amember/common.inc.php and change this :
    Code:
    function mail_payment_admin($payment_id, $member_id){
        global $db, $config;
        
        $t = &new_smarty();
        $p = $db->get_payment($payment_id);
        $u = $db->get_user($p['member_id']);
        $pr = $db->get_product($p['product_id']);
        ///////////////////////////////////
        $t->assign('user',    $u);
        $t->assign('payment', $p);
        $t->assign('product', $pr);
        ///////////////////////////////////
        $et = & new aMemberEmailTemplate();
        $et->name = "send_payment_admin";
        mail_template_admin($t, $et);
    }
    
    


    to


    Code:
    function mail_payment_admin($payment_id, $member_id){
        global $db, $config;
        
        $t = &new_smarty();
        $p = $db->get_payment($payment_id);
        if($p['paysys_id'] == 'free') return; 
        $u = $db->get_user($p['member_id']);
        $pr = $db->get_product($p['product_id']);
        ///////////////////////////////////
        $t->assign('user',    $u);
        $t->assign('payment', $p);
        $t->assign('product', $pr);
        ///////////////////////////////////
        $et = & new aMemberEmailTemplate();
        $et->name = "send_payment_admin";
        mail_template_admin($t, $et);
    }
    
    
  5. webalchemist

    webalchemist New Member

    Joined:
    Mar 30, 2011
    Messages:
    6
    How would I disable automatically added products?

    I have a product that automatically adds several products, so I get lots of emails with $0.

    How would I disable these?

    Looking at the admin, they are "manual" pay system.

    Is there a way to code it so only the automatically added products can be excluded?
  6. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Change this line in above code:
    if($p['paysys_id'] == 'free') return;
    to
    if($p['paysys_id'] == 'manual') return;

Share This Page