This simple code recipe creates a [pmpro_expiration_date] shortcode you can use in a page, post, widget, or pretty much anywhere on your site.

It shows the current logged in member’s expiration date or the expiration date for the user specified by the “user” attribute. The date is formatted per your site’s Settings > General > Date Format field. If there is no expiration or user, the shortcode displays “—“.


The Code Recipe

This code recipe requires a PMPro Plus Account or higher.

View Membership Options


How to Use

The shortcode [pmpro_expiration_date] can be used anywhere you would like to display the date. If you would like to add it to a widget area but it isn’t working, add this line of code to a helper PMPro Customizations plugin

// Enable the use of shortcodes in text widgets.
add_filter( 'widget_text', 'do_shortcode' );

I think a useful application of this shortcode would be to display a member’s expiration date on the bbPress Profile page. This recipe relies on our bbPress Add On setting to add the “Membership Level” section to the bbPress Profile, like this…

my_pmpro_bbpress_profile_expiration

This code recipe requires a PMPro Plus Account or higher.

View Membership Options