Skip to content

Instantly share code, notes, and snippets.

@eighty20results
Created May 23, 2017 23:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eighty20results/f1901286b9aac5d772d4326268a32fa5 to your computer and use it in GitHub Desktop.
Save eighty20results/f1901286b9aac5d772d4326268a32fa5 to your computer and use it in GitHub Desktop.
Custom Fields (Register Helper)
<?php
/*
Plugin Name: PMPro: Custom Registration/WordPress Profile Fields
Description: Custom fields, using the PMPro Register Helper add-on
Plugin URI: https://eighty20results.com/paid-memberships-pro/do-it-for-me/
Author: Thomas Sjolshagen @ Paid Memberships Pro <thomas@eighty20results.com>
Author URI: https://eighty20results.com/thomas-sjolshagen/
Version: 1.0
License: GPL2
Text Domain: sn-customizations
Domain Path: /languages
*/
if ( ! function_exists( 'sn_rh_loader' ) ) {
function sn_rh_loader() {
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) {
return;
}
$fields = array();
$fields[] = new PMProRH_Field(
'bitcoin_address',
'text',
array(
'label' => __( 'Your Bitcoin Address for Referral Commission', 'sn-customizations' ),
"class" => "rh-field", // custom field label
"profile" => true, // show in user profile
"memberslistcsv" => true, // Include in Member List CSV Export
"required" => true, // make this field required
)
);
$fields[] = new PMProRH_Field(
'referred_by',
'text',
array(
'label' => __( 'Referred By', 'sn-customizations' ),
"class" => "rh-field", // custom field label
"profile" => true, // show in user profile
"memberslistcsv" => true, // Include in Member List CSV Export
"required" => true, // make this field required
)
);
foreach ( $fields as $field ) {
pmprorh_add_registration_field(
'checkout_boxes',
$field
);
}
}
add_action( 'init', 'sn_rh_loader', 10 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment