Hi @osisis , I’m just a regular user or PM Pro and not from support. But I believe I’m able to answer your query.
If you just want the field to appear on the user’s profile page, you can add 'profile' => true,
in the field array.
You have a few options though if you want to restrict the visibility of the field. If you use 'profile' => 'admin'
, it will only be visible to the admin and not to the user after they’ve submitted it. A good example would be for affiliate codes.
If you use 'profile => 'only'
, it won’t be shown to the user during checkout, and only on the profile page.
Here is the documentation if you would like to know more: https://www.paidmembershipspro.com/documentation/register-helper-documentation/adding-fields/
Here is the video demonstrating it by the PMPro team: https://www.youtube.com/watch?v=VVTHYPQpfZ4
Here is the full code example:
<?php
/*
* Example Register Helper fields for Company, Referral Code, and Budget.
*
*/
// We have to put everything in a function called on init, so we are sure Register Helper is loaded.
function my_pmprorh_init() {
// Don't break if Register Helper is not loaded.
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) {
return false;
}
// Define the fields.
$fields = array();
$fields[] = new PMProRH_Field(
'company', // input name, will also be used as meta key
'text', // type of field
array(
'label' => 'Company', // custom field label
'size' => 40, // input size
'class' => 'company', // custom class
'profile' => true, // show in user profile
'required' => true, // make this field required
'levels' => array(1,2) // only levels 1 and 2 should have the company field
)
);
// Add the fields into a new checkout_boxes are of the checkout page.
foreach ( $fields as $field ) {
pmprorh_add_registration_field(
'checkout_boxes', // location on checkout page
$field // PMProRH_Field object
);
}
// That's it. See the PMPro Register Helper readme for more information and examples.
}
add_action( 'init', 'my_pmprorh_init' );
I hope that it was helpful. ??
-
This reply was modified 4 years, 3 months ago by
yewzy.