Skip to content

Instantly share code, notes, and snippets.

@eighty20results
Last active October 23, 2017 14:42
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/af63a45de4a16a7af3e575683b999fae to your computer and use it in GitHub Desktop.
Save eighty20results/af63a45de4a16a7af3e575683b999fae to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: PMPro Customizations: Register Helper Fields
Plugin URI: https://eighty20results.com/paid-memberships-pro/do-it-for-me/
Description: Customizations - Register Helper Fields
Version: 1.0
Author: Eighty / 20 Results by Wicked Strong Chicks, LLC <thomas@eighty20results.com>
Author URI: https://eighty20results.com/thomas-sjolshagen/
License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
License: GPLv2 or later
* Copyright (c) 2017 - Eighty / 20 Results by Wicked Strong Chicks.
* ALL RIGHTS RESERVED
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Define Register Helper fields
*/
function wr_custom_fields() {
// Not installed
if ( ! function_exists( 'pmprorh_add_checkout_box' ) ) {
return;
}
$fields = array();
$fields[] = new PMProRH_Field(
'pmprh_spouse',
'text',
array(
'label' => __("Spouse/Significant Other's Name" ),
'class' => 'pmprorh_textfield',
'size' => 30,
'hint' => null,
'required' => true,
'memberslistcsv' => true,
'profile' => true,
)
);
$fields[] = new PMProRH_Field(
'pmpro_bphone',
'text',
array(
'label' => __("Phone Number" ),
'class' => 'pmprorh_textfield',
'size' => 30,
'hint' => null,
'required' => true,
'memberslistcsv' => true,
'profile' => true,
)
);
$fields[] = new PMProRH_Field(
'pmprh_where_heard',
'select',
array(
'id' => 'wr_where_heard',
'label' => __("Where did you hear about SLREIA" ),
'class' => 'pmprorh_select',
'hint' => null,
'required' => true,
'memberslistcsv' => true,
'profile' => true,
'options' => array(
'Internet Search' => __( 'Internet Search' ),
'member_referral' => __( 'Current Member Referral' ),
'facebook' => __( 'Facebook' ),
'another_reia' => __( 'Another REIA'),
'other' => __( 'Other' ),
)
)
);
$fields[] = new PMProRH_Field(
'pmprh_other_where',
'text',
array(
'depends' => array( array( 'id' => 'wr_where_heard', 'value' => 'member_referral' ) ),
'label' => __( "Name of Member" ),
'class' => 'pmprorh_textfield',
'size' => 30,
'hint' => null,
'required' => false,
'memberslistcsv' => true,
'profile' => true,
)
);
$fields[] = new PMProRH_Field(
'pmprh_meeting_date',
'date',
array(
'label' => __( "Date of the meeting will you attend?" ),
'class' => 'pmprorh_datefield',
'hint' => null,
'required' => true,
'memberslistcsv' => true,
'profile' => true,
)
);
$fields[] = new PMProRH_Field(
'pmprh_service_disclaimer',
'checkbox',
array(
'label' => __( "Select/Click to agree" ),
'class' => 'pmprorh_textfield',
'hint' => __("This text and email club are a free service for our customers. If you have an Unlimited Text Message Plan, there are no additional charges. If you DO NOT have an unlimited plan, message and data rates may be applied by your carrier. To end text messages reply STOP. For help reply HELP. You may received 8-16 messages per month. Consent is not a condition of purchase an any good or service. See our terms and conditions at http://textmymarket.com/about/terms"),
'required' => true,
'memberslistcsv' => true,
'profile' => true,
)
);
$fields[] = new PMProRH_Field(
'pmpro_bemail',
'text',
array(
'label' => __("Email Address" ),
'class' => 'pmprorh_textfield',
'size' => 30,
'hint' => null,
'required' => true,
'memberslistcsv' => true,
'profile' => true,
)
);
foreach( $fields as $field ) {
pmprorh_add_registration_field( 'checkout_boxes', $field );
}
}
add_action('init', 'wr_custom_fields', 10 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment