Forked from strangerstudios/my_default_wp_user_checkout_fields.php
Last active
April 13, 2021 03:01
-
-
Save kimcoleman/5ce163cf8270b5abc5e1c4e56d48aeab to your computer and use it in GitHub Desktop.
Capture default user profile fields at Membership Checkout using Register Helper
This file contains hidden or 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 | |
/** | |
* Add Website and Biographical Info to Membership Checkout | |
*/ | |
function my_default_wp_user_checkout_fields() { | |
if ( class_exists( 'PMProRH_Field') ) { | |
pmprorh_add_checkout_box( 'additional', 'Additional Information' ); | |
$fields = array(); | |
//user_url field | |
$fields[] = new PMProRH_Field( | |
'url', | |
'text', | |
array( | |
'label'=>'Website', | |
'size'=>40, | |
'profile'=>true, | |
'required'=>false, | |
) | |
); | |
//user_description field | |
$fields[] = new PMProRH_Field( | |
'description', | |
'textarea', | |
array( | |
'label'=>'Biographical Info', | |
'size'=>40, | |
'profile'=>true, | |
'required'=>false, | |
) | |
); | |
foreach( $fields as $field ) { | |
pmprorh_add_registration_field( 'additional', $field ); | |
} | |
} | |
} | |
add_action( 'init', 'my_default_wp_user_checkout_fields' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This recipe is included in the blog post on "Capture Default WP User Profile Fields at Membership Checkout using Register Helper" at Paid Memberships Pro here: https://www.paidmembershipspro.com/capture-default-user-profile-fields-membership-checkout-using-register-helper/