Skip to content

Instantly share code, notes, and snippets.

@MaryOJob
Forked from femiyb/pmpro_move_name_fields.php
Last active December 2, 2021 17:05
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 MaryOJob/0bf2ccdcb327f764a22321c78f5436f5 to your computer and use it in GitHub Desktop.
Save MaryOJob/0bf2ccdcb327f764a22321c78f5436f5 to your computer and use it in GitHub Desktop.
This Code Gist Will Move the Fields in this order, First Name, Last Name, Email Address and Password When using the Code to Generate a username at PMPro checkout from email for users and hiding the username field with CSS - Links for this below
<?php // Do not Copy This Line
/**
* Add the following code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function pmpro_move_name_fields() {
global $pmpro_pages;
if(is_page($pmpro_pages['checkout'])) {
?>
<script>
jQuery( '.pmpro_checkout-field-bemail' ).prependTo( '.pmpro_checkout-field-password' );
jQuery( '.pmpro_checkout-field-firstname' ).prependTo( '.pmpro_checkout-field-password' );
jQuery( '.pmpro_checkout-field-lastname' ).appendTo( '.pmpro_checkout-field-firstname' );
</script>
<?php
}
}
add_action( 'wp_footer', 'pmpro_move_name_fields' );
@MaryOJob
Copy link
Author

MaryOJob commented Mar 2, 2021

@MaryOJob
Copy link
Author

MaryOJob commented Mar 2, 2021

@MaryOJob
Copy link
Author

MaryOJob commented Dec 2, 2021

This code recipe would move the Email address to the top of the checkout page before other fields

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