• Resolved Jack

    (@jack1132132)


    Hello,

    I’m searching for a hook for when a plan is activated and another for when it’s deactivated. I found these hooks helpful for that:

    arm_user_plan_status_action_failed_payment
    arm_user_plan_status_action_cancel_payment
    arm_user_plan_status_action_eot
    arm_deleted_subscription_plan
    arm_after_user_plan_change

    However, these are all very badly explained. I simply want to know when a member gets an active membership and when that membership is deactivate regardless if it expired, deleted, payment was canceled or failed.

    Let’s say a user gets on a new membership, I can detect that with the arm_after_user_plan_change hook, and checking to see if arm_subscription_plan_status is true. Now to know when a membership is deactivated, I don’t know which hooks to use.

    Does the hook arm_user_plan_status_action_failed_payment mean the membership was activated but the payment failed? What if the user just failed a renewal but still time for the membership to expire? What does the arm_user_plan_status_action_cancel_payment hook capture, the conditions are unclear.

    Is there a way to simple know when a user gets an active membership, and when the user no longer has an active membership?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Jack

    (@jack1132132)

    Do arm_user_plan_status_action_failed_payment or arm_user_plan_status_action_cancel_payment ever activate the membership?

    The arm_user_plan_status_action_eot is called when the plan expires, together with the arm_deleted_subscription_plan plan I think these two hooks cover every case where the membership is no longer active correct?

    Thank you.

    Plugin Author reputeinfosystems

    (@reputeinfosystems)

    Hello,

    As I understood from your request you want to use the action hook for the ARMember plugin when the paid membership plan is assigned and removed the plan hook. If so then you can use the “arm_after_add_transaction” hook which array parameter provided you status for success, failed, cancel, etc which will consider you to perform your custom action according to your requirements.

    You can use “arm_user_plan_status_action_eot” while expiring the membership plan time period (end of plan).
    “arm_deleted_subscription_plan” will not execute when the member’s membership plan is canceled you can use “arm_cancel_subscription” hook for the member’s plan canceled.

    Thanks

    Thread Starter Jack

    (@jack1132132)

    I’m now using the member role added on subscription to determine when the user has an active membership, and with the update_user_metadata filter I determine when the user acquires or loses the role to do what I need to.

    I suggest for the plugin to always use WP_User::add_role() instead of WP_User::set_role() when adding a membership role. This is because I have other plugins that add different roles, and set_role removes those roles. I also used update_user_metadata to change this set_role behaviour to work like add_role, to fix this issue with other plugins.

    Thank you.

    • This reply was modified 3 years, 7 months ago by Jack.
    Plugin Author reputeinfosystems

    (@reputeinfosystems)

    Hello,

    Glad to know that I could help you. 

    BTW If you like the ARMember Lite plugin then, kindly add the review with the 5 stars that will encourage us to add more features and improve plugin.
    https://ww.wp.xz.cn/support/plugin/armember-membership/reviews/#new-post

    Thanks

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

The topic ‘When plan activate and deactivate’ is closed to new replies.