Created
June 5, 2018 08:49
-
-
Save andrewlimaza/e17a82948542e0a036446ee15b1bf014 to your computer and use it in GitHub Desktop.
Add billing fields to Add Member Settings
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 this code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* This will add billing fields to Add Member and the user's profile page. | |
*/ | |
function add_billing_fields_to_add_member_profile() { | |
//check for register helper | |
if(!function_exists("pmprorh_add_registration_field")) | |
return; | |
//define the fields | |
$fields = array(); | |
$fields[] = new PMProRH_Field("pmpro_baddress1", "text", array("label"=>"Billing Address 1", "size"=>40, "profile"=>true, "required"=>false, "addmember" => true)); | |
$fields[] = new PMProRH_Field("pmpro_baddress2", "text", array("label"=>"Billing Address 2", "size"=>40, "profile"=>true, "required"=>false, "addmember" => true)); | |
$fields[] = new PMProRH_Field("pmpro_bcity", "text", array("label"=>"Billing City", "size"=>40, "profile"=>true, "required"=>false, "addmember" => true)); | |
$fields[] = new PMProRH_Field("pmpro_bstate", "text", array("label"=>"Billing State", "size"=>10, "profile"=>true, "required"=>false, "addmember" => true)); | |
$fields[] = new PMProRH_Field("pmpro_bzipcode", "text", array("label"=>"Billing Postal Code", "size"=>10, "profile"=>true, "required"=>false, "addmember" => true)); | |
$fields[] = new PMProRH_Field("pmpro_bcountry", "text", array("label"=>"Billing Country", "profile"=>true, "required"=>false, "addmember" => true)); | |
$fields[] = new PMProRH_Field("pmpro_bphone", "text", array("label"=>"Billing Phone", "size"=>40, "profile"=>true, "required"=>false, "addmember" => true)); | |
//add the fields into a new checkout_boxes are of the checkout page | |
foreach($fields as $field) | |
pmprorh_add_registration_field("profile", $field); | |
} | |
add_action("init", "add_billing_fields_to_add_member_profile"); |
To include billing First and last names - https://gist.github.com/ipokkel/08cc6d914947ca2d37d86acb4f599c79
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To show the country as a dropdown, use this modified version - https://gist.github.com/gausam/04e4b02eb239bd94e68a4718de2c85dc.