Plugin method triggered by new subscription only

  • Christoff
  • Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 9 months ago #139661 by Christoff
Hi Tuan.

I've read your documentation for Membership Pro plugins and I've done a few tests myself, but I can't confidently identify a method that I can use to reliably trigger an action for a new subscription.

I thought the onAfterStoreSubscription method would be the one I needed, but in tests it's triggered for renewals as well as new subscriptions. Please could you advise of a way to identify new subscriptions only using the plugin methods? My intention is to trigger a series of events for new subscribers only.

Any assistance you can offer is greatly appreciated.

Thanks.

Please Log in or Create an account to join the conversation.

More
4 years 9 months ago #139663 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Plugin method triggered by new subscription only
Hello

You can still use onAfterStoreSubscription . In that method, you can use $row->act parameter:

- if $row->act == 'renew' , it's a renewal
- if $row->act == 'upgrade', it's a subscription upgrade
- Otherwise, it is new subscription

Tuan

Please Log in or Create an account to join the conversation.

  • Christoff
  • Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 9 months ago #139882 by Christoff
Replied by Christoff on topic Plugin method triggered by new subscription only
Hi Tuan.

Thanks for getting back to me. That seems to be working well - thanks. For the future perhaps the onAfterStoreSubscription method could have an $isNew property (like onAfterSaveSubscriptionPlan) so that it's clearer.

I do appreciate your ongoing efforts with this extension.

Please Log in or Create an account to join the conversation.

More
4 years 9 months ago #139892 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Plugin method triggered by new subscription only
I will have to check it again but I think onAfterStoreSubscription is only triggered for new subscription (I might be wrong, need to check the code again)

Tuan

Please Log in or Create an account to join the conversation.