s2member upgrade and downgrade notifiaction email

How do I add an action when an upgrade or downgrade happens in s2member. Specifically, I want to automatically send the affiliate an email notification when their referral upgrades or downgrades from level 2.


Comments

3 responses to “s2member upgrade and downgrade notifiaction email”

  1. Thanks for getting back to me. I have learned what I could about your response and created /wp-content/mu-plugins/s2-hacks.php

    I don’t know anything about php or conditionals. What must I include in that php file so that the referrer will receive an email notification?

    I would like the upgrade email subject to read:
    Congratulations, you have a new Premium Membership referral on [sitename]

    I would like to downgrade email subject to read:
    Referred membership downgrade

    I would like the upgrade email body to read:
    Your referral ([referred username] – [referred email]) had just upgraded their membership. You will earn $9.99 every month they maintain their Premium Membership. We distribute payments and conduct a live Affiliate Coach Support webcast the first Wednesday of every month for tips and tricks to increase your referral number and retention. Also, be sure your paypal account information is correct by entering it on [affiliate page url]
    Thanks for being an affiliate coach and helping to spread the message of [site url].

    I would like the downgrade email body to read:
    This is just a notice informing you that your referral ([referred username] – [referred email]) had just downgraded their membership. You will no longer be compensated for their referral unless they decide to upgrade in the future. Please tune into our live Affiliate Coach Support webcast the first Wednesday of every month for tips and tricks to referring more Premium Memberships as well as increasing referral retention.
    Thanks for being an [site name] affiliate coach and helping to spread the message of [site url].

    1. Hi Jerry,

      Thanks for indicating your requirements but what you’re asking for is actually a customization which a developer should take care of. To indicate what you need to do requires knowledge of PHP and usage of the APIs that the plugins offer. I recommend to seek the help of a qualified developer for this (ideally with some knowledge of s2member – the API offered by the Affiliates plugins will allow you to retrieve the information you have indicated easily and I’d be happy to give pointers to how to do that when specific questions on how to integrate it with the appropriate code are posted).

  2. Hi,

    You will need to use the appropriate hooks based on the s2member API (see http://www.s2member.com/codex/stable/overview-summary/#src_doc_overview_description) and access the table wp_aff_subscriptions where you can look up the referring affiliate’s ID based on the subscription ID.

    1. Add an action to the appropriate upgrade/downgrade hook.
    2. Use the wp_aff_subscriptions table to obtain the affiliate_id based on the subscription_id.
    3. If an entry has been found in step 2, email the affiliate with the related info.

Share