Skip to content

Instantly share code, notes, and snippets.

@michaelbeil
Forked from kimwhite/my_pmpro_shorten_reg_info.php
Last active September 15, 2023 22:23
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 michaelbeil/e2da475047cde46f60fe135ef4da9ed3 to your computer and use it in GitHub Desktop.
Save michaelbeil/e2da475047cde46f60fe135ef4da9ed3 to your computer and use it in GitHub Desktop.
Shorten registration
<?php
/*
* Plugin Name: Shorten registration
*
* This snippet will remove username, email confirmation.
*
* 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/
*/
//Now start placing your customization code below this line
/**
* Hide the Account Information Section
*/
function simple_checkout_hide_account_information_section( $skip_account_fields, $current_user ) {
if ( empty( $current_user->ID ) ) {
$skip_account_fields = 1;
}
return $skip_account_fields;
}
add_filter( 'pmpro_skip_account_fields', 'simple_checkout_hide_account_information_section', 10, 2 );
/**
* Unset required account fields
*/
function my_required_user_fields( $pmpro_required_user_fields ) {
unset( $pmpro_required_user_fields['username'] );
unset( $pmpro_required_user_fields['password'] );
unset( $pmpro_required_user_fields['password2'] );
unset( $pmpro_required_user_fields['bconfirmemail'] );
return $pmpro_required_user_fields;
}
add_filter( 'pmpro_required_user_fields', 'my_required_user_fields', 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment