• Resolved Nik

    (@nikbond)


    Different issue this time. Not a bug but I can’t see a way around it. Scenario is as follows –

    Existing member wants to sign up for an additional paid membership.
    They have the option to pay via PayPal or Manual (ie. via BACS/cheque in which case, we’d register the payment manually).

    If they select Manual, I’d like to be able to send them an email with instructions on what to do next but which email?

    Sign-up user account created won’t work – they’ve already got an account
    Subscription completed with payment won’t work – as they haven’t actually made a payment

    Since an invoice is created when they select “Manual”, I wondered about “Payment before due” or “Payment after due” but neither of these seem to be triggered 🙁

    Any suggestions?
    Warm regards
    Nik

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Laura – WPMU DEV Support

    (@wpmudev-support8)

    Hey @nikbond,

    Hope you’re well.

    I checked the possibilities but looks like it’s not possible to send an email when user select “Manual” payment for the current version of Membership 2. So I am afraid you need to make custom coding to achieve this.

    I asked for actions/hooks that we can use for that. So when I got the answer I can provide that information to you.

    Cheers,
    Oguz

    Thread Starter Nik

    (@nikbond)

    Hi @oguz

    I checked the possibilities but looks like it’s not possible to send an email when user select “Manual” payment for the current version of Membership 2

    I don’t believe this is true. If a user is signing up for the first time and selects “Manual” payment option, they still receive the email “Sign-up user account created” and the email “Subscription completed with payment” when admin marks their payment as paid.

    However, what I need is to be able to send out an email when an existing member signs up for a different membership (and before they’ve actually paid for it). If there’s a filter/hook for that, I’d be grateful to know.

    Regards
    Nik

    Plugin Support Laura – WPMU DEV Support

    (@wpmudev-support8)

    Hey @nikbond,

    Hope you’re well.

    “Subscription completed with payment” email can work for second membership too but like I said there is no option for selected payment method. I got there is “ms_gateway_manual_purchase_info_content_before” action and I have example code for you;

    add_action( 'ms_gateway_manual_purchase_info_content_before', 'my_manual_payment_handler' );
    
    // This function is called, when the Manual Payment instructions are displayed on the front-end.
    // In the payment workflow this happens when the user clicks on the Manual-Payment button on the checkout page.
    function my_manual_payment_handler() {
        $api = ms_api();
        $member = $api->get_current_member();
    
        // Exit, if we could not find a valid user.
        if ( ! $member->is_valid() ) { return false; }
    
        $subscription = MS_Factory::load( 'MS_Model_Relationship', $_REQUEST['ms_relationship_id'] );
        $membership = $subscription->get_membership();
    
        // Exit, if we cannot determine which membership the user signed up to.
        if ( ! $membership ) { return false; }
    
        // Now send an email to the admin.
        $email_to = get_option( 'admin_email' );
        $subject = 'New invoice';
        $message = sprintf(
            'Awesome, a new member :) Please send an invoice to "%s" for membership "%s"!',
            $member->email,
            $membership->name . ' (' . $membership->price . ')'
        );
    
        $sent = wp_mail( $email_to, $subject, $message );
    }

    This example just sending an email when user selects manual payment. Just try and if you need anything about it I can help more.

    I hope it helps!

    Cheers,
    Oguz

    Thread Starter Nik

    (@nikbond)

    Hi @oguz

    Thank you and I think this could work but it looks as if this sends an email to admin whereas I want to send it to the user.

    Presumably I could change the line –

    
    $email_to = get_option( 'admin_email' );

    to

    $email_to = $member->email;

    Or something along those lines?

    Regards
    Nik

    Plugin Support Laura – WPMU DEV Support

    (@wpmudev-support8)

    Hey @nikbond,

    Hope you’re well.

    Yes, that modify should do the trick. Did you try?

    Cheers,
    Oguz

    Plugin Support Dimitris – WPMU DEV Support

    (@wpmudev-support6)

    Hello @nikbond

    it’s been a while since we’ve heard back from you, so I’m marking this topic as resolved. Feel free to post back here any insights you have for us and we can re-open it and continue troubleshooting. 🙂

    Take care,
    Dimitris

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Automated emails again…’ is closed to new replies.