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

Add filter to change expiration dates on the membership card #55

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
18 changes: 13 additions & 5 deletions pmpro-membership-card.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ function pmpro_membership_card_return_end_date( $pmpro_membership_card_user ){

// Make sure the user exists.
if ( empty( $pmpro_membership_card_user ) ) {
return __( 'Never', 'pmpro-membership-card' );
return esc_html__( 'Never', 'pmpro-membership-card' );
}

$furthest_enddate = null;
Expand All @@ -338,11 +338,19 @@ function pmpro_membership_card_return_end_date( $pmpro_membership_card_user ){
}
}

if( ! empty( $furthest_enddate ) )
return date_i18n( get_option('date_format'), $furthest_enddate );
else
return __('Never', 'pmpro-membership-card');
if ( ! empty( $furthest_enddate ) ) {
$date = date_i18n( get_option( 'date_format' ), $furthest_enddate );
} else {
$date = esc_html__( 'Never', 'pmpro-membership-card' );
}

/**
* Filter the end date for the membership card.
* @param $date The date to display.
* @param $pmpro_membership_card_user The membership user.
* @since TBD
*/
return apply_filters( 'pmpro_membership_card_member_end_date', $date, $pmpro_membership_card_user );
}

/**
Expand Down