Skip to content

Instantly share code, notes, and snippets.

View andrewlimaza's full-sized avatar

Andrew Lima andrewlimaza

View GitHub Profile
@andrewlimaza
andrewlimaza / pmpro-recurring-donations.php
Last active February 19, 2019 23:24
Recurring Donation for PMPRO
//set price
function pmprodon_pmpro_donation_recurring($level)
{
if(isset($_REQUEST['donation']))
$donation = preg_replace("[^0-9\.]", "", $_REQUEST['donation']);
else
return $level;
if(!empty($donation))
{
@andrewlimaza
andrewlimaza / add-custom-checkout-fields.php
Last active February 19, 2019 23:24
Adding custom fields for Register Helper Pro (PMPRO)
/*
Plugin Name: Register Helper Customizations
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Register Helper Customizations
Version: 1.0.0
Author: StrangerStudios
Author URI: http://www.paidmembershipspro.com/
*/
//we have to put everything in a function called on init, so we are sure Register Helper is loaded
@andrewlimaza
andrewlimaza / rh-three-fields
Created March 29, 2016 13:55
Add three custom fields using Register Helper Addon
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
$fields = array();
$fields[] = new PMProRH_Field(
@andrewlimaza
andrewlimaza / function_to_change_pmpro_donation_text.php
Last active April 8, 2022 19:35
Function that changes 'Make a Gift' text - PMPRO Donations Add on
<?php
/*
This function simply edits the text 'Make a Gift' for PMPRO Donations Add-On
Please paste this function in your functions.php or custom plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function pmpro_donations_change_text( $change_text, $text, $domain ) {
switch ( $change_text ) {
case 'Make a Gift' :
$change_text = __( 'This will change Make A Gift', 'pmpro-donations' ); //edit 'This will change Make A Gift' to edit the text output of 'Make a Gift'
@andrewlimaza
andrewlimaza / mailing-information.php
Last active April 5, 2016 19:04
PMPro Register Helper - Mailing information fields
function my_pmprorh_init()
{
//create a checkout box
pmprorh_add_checkout_box("mailing_info", "Mailing Details", "This description is optional");
//don't break if Register Helper is not loaded
if(!function_exists("pmprorh_add_registration_field"))
{
return false;
}
@andrewlimaza
andrewlimaza / three-custom-fields.php
Created April 6, 2016 13:49
PMPRO Register Helper - 3 Custom fields
<?php
/*
Paste this code into active theme's functions.php or custom plugin.
*/
function my_pmprorh_init()
{
//don't break if Register Helper is not loaded
if(!function_exists("pmprorh_add_registration_field"))
{
return false;
@andrewlimaza
andrewlimaza / pmpro-admin-only.php
Created April 8, 2016 13:49
PMPRO Register Helper Add on - Hide a field for admins only.
<?php
//paste lines 5-39 in your functions.php or custom PMPRO plugin
function my_pmprorh_init()
{
//don't break if Register Helper is not loaded
if(!function_exists("pmprorh_add_registration_field"))
{
return false;
@andrewlimaza
andrewlimaza / pmpro-customfields-level.php
Last active April 13, 2016 17:06
PMPRO - Only show custom fields to specific membership level for checkout.
<?php
// Copy Lines 5 - 32 to your functions.php of your theme or custom plugin
function my_pmprorh_init()
{
//don't break if Register Helper is not loaded
if(!function_exists("pmprorh_add_registration_field"))
{
return false;
@andrewlimaza
andrewlimaza / billing-fields-optional.php
Last active October 9, 2023 11:27
Make billing details optional for Paid Memberships Pro
<?php
//add lines 4-15 to your custom plugin or functions.php of your active theme
function pmpro_remove_bfields( $pmpro_required_billing_fields ){
//remove field ID's from array to make fields required
$remove_field = array('bfirstname', 'blastname', 'baddress1', 'bcity', 'bstate', 'bcountry', 'bzipcode', 'bphone', 'bemail', 'bconfirmemail');
//loop through the $remove_field array and unset each billing field to make it optional.
foreach($remove_field as $field){
@andrewlimaza
andrewlimaza / shortcode_membership_name.php
Last active September 4, 2018 11:51
Membership level name shortcode for Paid Memberships Pro
<?php
// Copy the function below into your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
// Use the shortcode [membership_level] to display the user's current membership level.
function pmpro_membership_level_shortcode( $atts ){
if(is_user_logged_in() && function_exists('pmpro_hasMembershipLevel') && pmpro_hasMembershipLevel()){
global $current_user;
$current_user->membership_level = pmpro_getMembershipLevelForUser($current_user->ID);