Skip to content

Instantly share code, notes, and snippets.

@eighty20results
Created May 19, 2018 11:36
Show Gist options
  • Save eighty20results/1fd2859e3d001a4fb0b8e36e75c595a4 to your computer and use it in GitHub Desktop.
Save eighty20results/1fd2859e3d001a4fb0b8e36e75c595a4 to your computer and use it in GitHub Desktop.
Custom fields per support topic
<?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 <[email protected]>
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) 2018 - 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 uj_custom_fields() {
// Not installed
if ( ! function_exists( 'pmprorh_add_checkout_box' ) ) {
return;
}
$fields = array();
$fields[] = new PMProRH_Field(
'Privacy Statement',
'html',
array(
'html' => '<p>Your privacy is important to us. For more details about how we use your personal data, please read our Privacy Statement here (i can set up the link to this when i’ve uploaded it).</p><p>We would like to send you additional information that is relevant to you. By ticking the boxes you consent to receive our newsletter and other communications from us about our services, promotional activities and events</p>',
'required' => false,
'memberslistcsv' => false,
'profile' => true,
'levels' => array(), // TODO: Insert comma separated list of Membership Level ID for the level(s) where this should be included
)
);
$fields[] = new PMProRH_Field(
'consent_type_optin',
'checkbox',
array(
'label' => __("Post, Email, Telephone, Text Message, Recorded call" ),
'class' => 'pmprorh_checkbox',
'required' => false,
'memberslistcsv' => true,
'profile' => true,
'levels' => array(), // TODO: Insert comma separated list of Membership Level ID for the level(s) where this should be included
)
);
$fields[] = new PMProRH_Field(
'3rd Party',
'html',
array(
'html' => '<p>We will not pass your details to third parties. You may opt out of receiving these communications at any time by emailing [email protected] or using the opt-out facility on each email.</p>',
'required' => false,
'memberslistcsv' => false,
'profile' => true,
'levels' => array(), // TODO: Insert comma separated list of Membership Level ID for the level(s) where this should be included
)
);
$fields[] = new PMProRH_Field(
'disclose_optin',
'checkbox',
array(
'label' => __("Please tick here if you are happy for us to disclose your personal data to Dulwich Hamlet Football Club so that they can provide you with information about important matters relating to the club" ),
'class' => 'pmprorh_checkbox',
'required' => false,
'memberslistcsv' => true,
'profile' => true,
'levels' => array(), // TODO: Insert comma separated list of Membership Level ID for the level(s) where this should be included
)
);
$fields[] = new PMProRH_Field(
'parent_name',
'text',
array(
'label' => __("Parent Full Name" ),
'class' => 'pmprorh_text',
'required' => false,
'memberslistcsv' => true,
'profile' => true,
'levels' => array(), // TODO: Insert comma separated list of Membership Level ID for the level(s) where this should be included
)
);
$fields[] = new PMProRH_Field(
'parent_email',
'text',
array(
'label' => __("Parent Email Address" ),
'class' => 'pmprorh_text',
'required' => false,
'memberslistcsv' => true,
'profile' => true,
'levels' => array(), // TODO: Insert comma separated list of Membership Level ID for the level(s) where this should be included
)
);
$fields[] = new PMProRH_Field(
'child_contact_optin',
'checkbox',
array(
'label' => __("Please tick to indicate that you consent to use directly contacting your child " ),
'class' => 'pmprorh_checkbox',
'required' => false,
'memberslistcsv' => true,
'profile' => true,
'levels' => array(), // TODO: Insert comma separated list of Membership Level ID for the level(s) where this should be included
)
);
foreach( $fields as $field ) {
pmprorh_add_registration_field( 'checkout_boxes', $field );
}
}
add_action('init', 'uj_custom_fields', 10 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment