Skip to content

Instantly share code, notes, and snippets.

@pbrocks
Created September 19, 2018 01:26
Show Gist options
  • Save pbrocks/d0e5ba61e0582bddc95c2a8018c79d24 to your computer and use it in GitHub Desktop.
Save pbrocks/d0e5ba61e0582bddc95c2a8018c79d24 to your computer and use it in GitHub Desktop.
Add second name and email to PMPro Checkout page and/or Profile
<?php
/**
* Plugin Name: PMPro Register Helper Examples
* Description: Add this to your PMPro Customizations folder and then activate the plugin from your dashboard.
* Author: pbrocks
* Version: 1.3
* Author URI: https://github.com/pbrocks
* Add this to a Customizations Plugin and customize to suit your needs
*/
function initialize_pmprorh_fields1() {
// don't break if Register Helper is not loaded
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) {
return false;
}
// define the fields
$fields = array();
// TEXT FIELD
$fields[] = new PMProRH_Field(
'spouse_name',
'text',
array(
'label' => 'Spouse\'s Name',
'profile' => true,
'size' => 40, // size attribute of text field
)
);
// TEXT FIELD
$fields[] = new PMProRH_Field(
'spouse_email',
'text',
array(
'label' => 'Spouse\'s Email',
'profile' => true,
'size' => 60, // size attribute of text field
)
);
foreach ( $fields as $field ) {
pmprorh_add_registration_field(
'checkout_boxes', // location on checkout page
$field
);
}
// that's it. see the PMPro Register Helper readme for more information and examples.
}
add_action( 'init', 'initialize_pmprorh_fields1' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment