This hook is triggered during a very small edge case where membership checkout fails for users with an existing membership and we reinstate membership for a 3 day grace period.
apply_filters( 'pmpro_stripe_days_grace_when_canceling_existing_subscriptions_at_checkout', $days_grace, $memberships_users_row );
Some notes on this edge case:
- For sites that aren’t using our Multiple Memberships Per User Add On: when someone checks out for a level, we cancel their old level.
- There are very edge cases where checkout for the new level fails mid-process. When this happens, the plugin code tries to undo the prior cancellation by voiding what was done.
- In some setups, the user may have to complete checkout for their old level again to reinstate membership. If you are using a restricted checkout flow (like our Approvals Add On), this code reinstates their old membership for a 3 day grace period so checkout or access to members-only content isn’t restricted.
- TLDR: You’ll probably never see this grace period triggered or need to use this filter.
Parameters
- $days_grace
- integer; The number of grace period days to give the member. Default is 3 days
- $memberships_users_row
- object; The row data from the
pmpro_memberships_users
table including membership_id, user_id, and enddate
Source
View in Source CodeAbout Actions and Filters in PMPro
Hooks allow you to extend Paid Memberships Pro without editing any core plugin files. You can use a hook to program custom code that interacts with or modifies code in our plugin, Add Ons, your theme, and even WordPress itself.
There are two kinds of hooks: actions and filters.
- Action hooks allow you to run new custom code at pre-defined locations.
- Filter hooks allow you to change or extend existing code by modifying the data and returning it back to the software.
Click here to browse the full database of action and filter hooks available in Paid Memberships Pro. For help extending our Add Ons, refer to the individual Add On's documentation page for a list of available hooks.
For more developer-focused information about Paid Memberships Pro, check out the advanced developer topics documentation.