Skip to content

Instantly share code, notes, and snippets.

@strangerstudios
Created March 31, 2014 21:45
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save strangerstudios/9903069 to your computer and use it in GitHub Desktop.
Save strangerstudios/9903069 to your computer and use it in GitHub Desktop.
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
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');
?>
@inzamamabbasi
Copy link

where i need to use this code in which page or template?

@greathmaster
Copy link

@inzamamabbasi

You will need to add this to a customization plugin.

@ideadude
Copy link

Forked here: https://gist.github.com/travislima/4d599cc0b6169ef7ee7514442f289123

We can't update gists added by the strangerstudios user anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment