Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save travislima/b3bc0b06ac0058b66067726bdb2edefe to your computer and use it in GitHub Desktop.
Save travislima/b3bc0b06ac0058b66067726bdb2edefe to your computer and use it in GitHub Desktop.
Replace spaces with underscore "_" for usernames.
<?php // Do not copy this tag.
/**
* Replace all spaces with an underscore when new users register for Paid Memberships Pro.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_custom_user_registration_changes( $userdata ) {
$userdata['user_login'] = str_replace(' ', '_', $userdata['user_login'] );
return $userdata;
}
add_filter( 'pmpro_checkout_new_user_array', 'my_custom_user_registration_changes', 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment