Last active
February 19, 2019 15:11
-
-
Save andrewlimaza/80d92da7b9ba5136d0b9a39ca558f490 to your computer and use it in GitHub Desktop.
Replace spaces with underscore "_" for usernames.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* 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