MemberPress: Display Current User’s Memberships Statuses And Renewal Dates
This code snippet adds the new [mp_membership_info] shortcode.
Adding this shortcode anywhere on the website displays a list of active MemberPress memberships and their details (such as status and renewal date) for the current (logged-in) user.
To display transaction status only in specific cases (e.g. only failed transactions), remove statuses you don’t want to be displayed on this line:
AND txn.status IN ('complete', 'failed', 'pending', 'refunded')",
To update the error message displayed when a logged-out user tries to access this data, adjust the "You need to be logged in to view this information" Error text on this line:
return 'You need to be logged in to view this information.';
To update the error message displayed when the logged-in user has no active memberships, adjust the "No active memberships found" error text on this line:
Comments