Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kimwhite/02a08d3d3031996d1f886d3f471bcc4f to your computer and use it in GitHub Desktop.
Save kimwhite/02a08d3d3031996d1f886d3f471bcc4f to your computer and use it in GitHub Desktop.
Show user's email address in place of the login name in the "Your are logged in as" message on the PMPro checkout page.
<?php
/**
* Replace user's login displayed to email address in the "You are logged in as"
* on the PMPro checkout page.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_gettext_checkout_email_in_logged_in_message( $translated_text, $original_text, $domain ) {
global $current_user;
if ( 'paid-memberships-pro' === $domain ) {
if ( 'You are logged in as <strong>%s</strong>. If you would like to use a different account for this membership, <a href="%s">log out now</a>.' === $original_text ) {
$translated_text = ' your text here ';
}
if ( 'change' === $original_text ) {
$translated_text = 'change here';
}
if ( 'You have selected the <strong>%s</strong> membership level.' === $original_text ) {
$translated_text = 'new message';
}
}
return $translated_text;
}
add_filter( 'gettext', 'my_pmpro_gettext_checkout_email_in_logged_in_message', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment