Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Use the email address as username with PMPro checkout. You'll also have to hide the username fields at checkout using CSS or a custom checkout page template.
<?php // Do not copy this tag
// Use the email address as username with PMPro checkout. You'll also have to hide the username fields at checkout using CSS or a custom checkout page template.
// Paste the code below into a PMPro Customization Plugin: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
function my_init_email_as_username()
{
//check for level as well to make sure we're on checkout page
if(empty($_REQUEST['level']))
return;
if(!empty($_REQUEST['bemail']))
$_REQUEST['username'] = $_REQUEST['bemail'];
if(!empty($_POST['bemail']))
$_POST['username'] = $_POST['bemail'];
if(!empty($_GET['bemail']))
$_GET['username'] = $_GET['bemail'];
}
add_action('init', 'my_init_email_as_username');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.