• Resolved kabengwa

    (@kabengwa)


    is this plugin also meant to send emails to the admin of a multi-vendor site to show that there is a new subscription? if yes, then mine is not doing it. how can i remedy this? thx for the help in advance

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,

    Thank you for reaching out to us.

    Unfortunately the Admin is not notified about the new subscription. You should be notified by PayPal when a new purchase is completed. A solution would be to use custom code:

    1. Create an empty plugin like this: https://gist.github.com/sareiodata/76f701e01db6685829db

    2. Add the following code to the end of it:

    /*
     * Sends an e-mail to multiple e-mail addresses when a subscription plan is purchased
     */
    
    function pms_send_emails_on_active_subscriptions ( $insert_result, $user_id, $subscription_plan_id, $start_date, $expiration_date, $status = '' ) {
    
        if( !$insert_result )
            return;
    
        if( $status != 'active' )
            return;
    
        // Admin e-mails
        $send_to = array( "[email protected]" );
    
        // You can use this to pass further data to the e-mail content variable
        $user = get_user_by('id', $user_id);
    
        // E-mail content
        $email_subject = 'New Active Subscription';
        $email_content = "User $user->user_login has purchased the subscription.";
    
        //we add this filter to enable html encoding
        add_filter( 'wp_mail_content_type', create_function('', 'return "text/html"; ') );
    
        wp_mail( $send_to, $email_subject, $email_content );
    
    }
    add_action( 'pms_member_update_subscription', 'pms_send_emails_on_active_subscriptions', 10, 6 );

    3. Replace admin@domain with a valid email address

    4. Install this plugin via FTP (copy it inside wp-content/plugins) or create a zip archive with it and install it via the WordPress plugin upload functionality

    Let me know if the custom code works.

    Best regards,

    Thread Starter kabengwa

    (@kabengwa)

    i have done everything needed but it is not sending the emails to my account. I added the account and subscribed but no email was sent. did it work in ur test? are there conflicts i may need to know about?

    Hi,

    I tested the custom code logged out as Admin. I registered/subscribed as a test user in PMS Test Mode. The email is sent only when the payment is marked as completed. You can check if the payment is marked as completed in PMS if you go to PMS -> Payments.

    Check if you can send emails from your domain. Register, logged out as Admin, using the Default WordPress Registration form (wp-login.php?action=register) and let me know if you receive the Default WordPress Notification. Also check the spam folder.

    Best regards,

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Cannot send email to admin telling him of a new subscription’ is closed to new replies.