Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix recursion conflict with RCP rcp_set_customer_trialing_flag (#26). #27

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,15 @@ public function plugins_loaded() {

\add_filter( 'rcp_payment_gateways', [ $this, 'register_pronamic_gateways' ] );
\add_action( 'rcp_payments_settings', [ $this, 'payments_settings' ] );
\add_action( 'rcp_transition_membership_status', [ $this, 'rcp_transition_membership_status' ], 10, 3 );

/**
* We hook into membership status transitions with priority `9` as the default priority results in a conflicting
* infinite loop by `rcp_set_customer_trialing_flag` of RCP membership and Pronamic subscription status updates.
*
* @link https://github.com/pronamic/wp-pronamic-pay-restrict-content-pro/issues/26
* @link https://github.com/stellarwp/restrict-content/blob/1b7914806e9703b6820d9073f0e6d965ebee7337/core/includes/customers/customer-actions.php#L15-L37
*/
\add_action( 'rcp_transition_membership_status', [ $this, 'rcp_transition_membership_status' ], 9, 3 );

\add_filter( 'rcp_membership_can_cancel', [ $this, 'rcp_membership_can_cancel' ], 10, 3 );
\add_filter( 'rcp_membership_payment_profile_cancelled', [ $this, 'rcp_membership_payment_profile_cancelled' ], 10, 5 );
Expand Down