Created
August 3, 2026 10:29
-
-
Save andrewlimaza/2e41478c03e95e7c66c464fecf12850f to your computer and use it in GitHub Desktop.
Show "Renew" on Account page for any member expiring (regardless of days remaining).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Show renew link on all levels that have an expiration date on the PMPro account page. | |
| function my_pmpro_expiring_soon_if_member_has_enddate( $expiring_soon, $level ) { | |
| if ( empty( $level->id ) || ! is_user_logged_in() ) { | |
| return $expiring_soon; | |
| } | |
| // Get the current user's membership for this level ID, including its assigned enddate. | |
| $member_level = pmpro_getSpecificMembershipLevelForUser( get_current_user_id(), (int) $level->id ); | |
| if ( ! empty( $member_level->enddate ) ) { | |
| $expiring_soon = true; | |
| } | |
| return $expiring_soon; | |
| } | |
| add_filter( 'pmpro_is_level_expiring_soon', 'my_pmpro_expiring_soon_if_member_has_enddate', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment