Created
March 22, 2022 20:09
-
-
Save kerijacoby/aeb4bf83c1a1fa4379df1de4efcd3f01 to your computer and use it in GitHub Desktop.
PMPro Register Helper Add Multiple File Uploads
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 | |
/* | |
* Add Additional Register Helper fields for: 1-3 File Uploads | |
* Save All To User Profile Page | |
* Applies To All Levels | |
*/ | |
// We have to put everything in a function called on init, so we are sure Register Helper is loaded. | |
function pmpro_register_helper_add_upload_fields() { | |
// Don't break if Register Helper is not loaded. | |
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) { | |
return false; | |
} | |
// Define the default fields array. | |
$fields = array(); | |
// File upload fields. | |
$fields[] = new PMProRH_Field( | |
'image-one', | |
'file', | |
array( | |
'label' => 'Please upload 1-3 photos of your rig', | |
'class' => 'user', | |
'profile' => true, | |
'required' => false, | |
'addmember' => true, | |
'allow_delete' => true, | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
'image-two', | |
'file', | |
array( | |
'label' => ' ', | |
'class' => 'user', | |
'profile' => true, | |
'required' => false, | |
'addmember' => true, | |
'allow_delete' => true, | |
) | |
); | |
$fields[] = new PMProRH_Field( | |
'image-three', | |
'file', | |
array( | |
'label' => ' ', | |
'class' => 'user', | |
'profile' => true, | |
'required' => false, | |
'addmember' => true, | |
'allow_delete' => true, | |
) | |
); | |
foreach ( $fields as $field ) { | |
pmprorh_add_registration_field( | |
'checkout_boxes', | |
$field | |
); | |
} | |
// That's it. See the PMPro Register Helper readme for more information and examples. | |
} | |
add_action( 'init', 'pmpro_register_helper_add_upload_fields' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment