Skip to content

Instantly share code, notes, and snippets.

View travislima's full-sized avatar

Travis Lima travislima

View GitHub Profile
@travislima
travislima / pmpro_format_my_phone.php
Last active April 8, 2021 18:35
Format the Phone number of Paid Memberships Pro
<?php
/**
* This code gist illustrates a way to customize the format of your members phone number.
*
* In this example, we will change the PMPro phone number from
*
* (123)456-7890
* to 1234567890
*
* Adjust this code gist to suit your needs for phone number.
@travislima
travislima / pmpro_remove_register_redirect.php
Created November 30, 2018 09:21
Remove the redirect to PMPro Membership Levels page when trying to perform default WP register
<?php
//Disables the pmpro redirect to levels page when user tries to register
add_filter("pmpro_login_redirect", "__return_false");
@travislima
travislima / add_textarea_pmpro_checkout.php
Created December 3, 2018 08:48
Add a textarea input field to the PMPro Checkout Page.
<?php
/*
*
* This code recipe will add an textare field to a PMPro Checkout. The field is labelled "Additional Information" and is located after the default billing fields.
*
* This code recipe requires Paid Memberships Pro and the PMPro - Register Helper Add On to be installed and activated.
* Register Helper - https://www.paidmembershipspro.com/add-ons/pmpro-register-helper-add-checkout-and-profile-fields/
*
* After Register Helper is installed and activated. Add this code recipe to a PMPro Customizations Add On - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
@travislima
travislima / pmpro-add-post-type-to-series.php
Created December 3, 2018 11:41 — forked from andrewlimaza/pmpro-add-post-type-to-series.php
Add a Custom Post Type for PMPro Series Add On
<?php
/**
* This allows PMPro Series to take new post types, such as a Custom Post Type.
* Add the code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_add_post_type_to_series( $post_types ) {
$post_types[] = 'my_cpt_name';
return $post_types;
@travislima
travislima / pmpro_rh_customizations_private.php
Last active December 5, 2018 08:16
Register Helper Customer Customization.
<?php // NB* - Do not copy this tag over.
/*
* Register Helper Example for Specific Use case - not for general use.
* Copy code after this comment. */
function my_pmprorh_init()
{
@travislima
travislima / pmpro_rh_custom_example_2.php
Last active December 5, 2018 09:25
PMPro RH example - Private (not for general use) - Example 2
<?php // NB* - Do not copy this tag over.
/*
* Register Helper Example for Specific Use case - not for general use.
* Copy code after this comment. */
function my_pmprorh_init()
{
@travislima
travislima / rh_example_customer.php
Created December 5, 2018 10:56
Register Helper Example - Group Checkbox - Customer Use Case.
<?php // Do NOT copy this tag to your PMPro customization plugin
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
@travislima
travislima / pmpro_rh_placeholder_example.php
Created December 5, 2018 15:59
PMPro Register Helper Example: Add Place Holder Text to fields. Hide the Label.
<?php
/* Example code to add a placeholder to your field and remove the label(Title) from the field */
function my_pmprorh_init()
{
//don't break if Register Helper is not loaded
if(!function_exists( 'pmprorh_add_registration_field' )) {
return false;
}
@travislima
travislima / pmpro_rhex_placeholder.php
Last active December 5, 2018 16:16
PMPro Register Helper Example - Placeholder Text
<?php
/*
* Example of how to add Placeholder text to a field AND remove the label from the field
* To keep both replace the label value "false" with desired label name, example: "Company"
*/
$fields[] = new PMProRH_Field(
'text_example', // input name, will also be used as meta key
'text', // type of field
@travislima
travislima / pmpro_rh_step1.php
Last active July 13, 2020 13:15
Step 1 - Register Helper: A step-by-step guide on creating custom fields.
<?php //Do not copy this tag to your PMPro Customizations Plugin.
/**
* Adds custom fields to Paid Memberships Pro checkout page.
* Requires Paid Memberships Pro and the PMPro Register Helper Add On.
* Add this code to a PMPro Customizations Plugin or the Code Snippets plugin.
*/
function pmpro_add_fields_to_checkout(){
//don't break if Register Helper is not loaded