Skip to content

Instantly share code, notes, and snippets.

View travislima's full-sized avatar

Travis Lima travislima

View GitHub Profile
@travislima
travislima / pmpro-customizations.php
Last active August 19, 2021 10:41
PMPro-extra-expiration-warning-emails (Change day email is sent out)
<?php
/*
Plugin Name: PMPro Customizations
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Customizations for Paid Memberships Pro
Version: .1
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
@travislima
travislima / pmpro-grace-period.php
Last active October 12, 2022 16:52
Add a "Grace Period" to a Paid Memberships Pro Membership (After expiration date is met).
<?php
/*
* The Code Recipe will add a 15-day grace period to a members membership once the membership expires.
* Add this Code Recipe to a PMPro Customization Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* For more information on Paid Memberships Pro - www.paidmembershipspro.com
*/
function my_pmpro_membership_post_membership_expiry( $user_id, $level_id ) {
// Make sure we aren't already in a grace period for this level
$grace_level = get_user_meta( $user_id, 'grace_level', true );
@travislima
travislima / pmpro-hide-tos-freelevel.php
Created June 1, 2016 14:34
PMPro - Hide TOS Page for Free Level
<?php
//copy lines 4 - 14 into your theme's functions.php or custom plugin
function my_option_pmpro_tospage( $option ){
global $pmpro_level;
//hide the TOS link if free level
if( pmpro_isLevelFree($pmpro_level) ){
$option = false;
}
@travislima
travislima / account.php
Created June 8, 2016 13:31
pmpro account page change invoices to orders
<?php
/*
custom page template for account.php add entire document to your custom account.php template
*/
function pmpro_shortcode_account_custom($atts, $content=null, $code="")
{
global $wpdb, $pmpro_msg, $pmpro_msgt, $pmpro_levels, $current_user, $levels;
// $atts ::= array of attributes
// $content ::= text within enclosing form of shortcode element
@travislima
travislima / remove-expire-membership-text.php
Created June 23, 2016 14:06
pmpro-set-description-addon-remove-membership-expires-on-text
<?php
/*
Plugin Name: Paid Memberships Pro - Set Expiration Dates Add On
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-set-expiration-dates/
Description: Set a specific expiration date (e.g. 2013-12-31) for a PMPro membership level or discount code.
Version: .2
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
@travislima
travislima / rh-telephone.php
Created August 2, 2016 16:54
Adding telephone field using Register Helper
<?php
//copy from line 5 downwards into your customization plugin
function my_pmprorh_init()
{
//don't break if Register Helper is not loaded
if(!function_exists("pmprorh_add_registration_field"))
{
return false;
@travislima
travislima / rh-bill-to-company.php
Last active August 5, 2016 07:53
PMPRo register helper add a Bill To Company Field
<?php
//copy from line 5 downwards into your customization plugin
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_jpn_yen_move_left.php
Created August 8, 2016 13:58
Move the JPN Yen currency to the left in PMPro
<?php
/* Move the Japanese Yen currency to the left
Add to your PMPro Customizations plugin */
function custom_yen($pmpro_currencies) {
$pmpro_currencies['JPY']['position'] = 'left';
return $pmpro_currencies;
}
add_filter( 'pmpro_currencies', 'custom_yen' );
@travislima
travislima / wpgm-radius-distance-default-change.php
Created October 20, 2016 09:14
WP Google Maps - Change default radius distance
<?php
/*This is the original piece of code that you will need to change. You can find this code in the wp-google-maps-pro.php file (Approx line: 7193)
$ret_msg .= " <option class=\"wpgmza_sl_select_option\" value=\"1\">".__("1km","wp-google-maps")."</option>";
$ret_msg .= " <option class=\"wpgmza_sl_select_option\" value=\"5\">".__("5km","wp-google-maps")."</option>";
$ret_msg .= " <option class=\"wpgmza_sl_select_option\" value=\"10\" selected>".__("10km","wp-google-maps")."</option>";
$ret_msg .= " <option class=\"wpgmza_sl_select_option\" value=\"25\">".__("25km","wp-google-maps")."</option>";
$ret_msg .= " <option class=\"wpgmza_sl_select_option\" value=\"50\">".__("50km","wp-google-maps")."</option>";
$ret_msg .= " <option class=\"wpgmza_sl_select_option\" value=\"75\">".__("75km","wp-google-maps")."</option>";
@travislima
travislima / charge_members_all_access.php
Created November 19, 2016 10:45
Charge All access members for Packages if specific category is found even if their membership has access
/*
This gist is a modification of the "All Access" gist found here:
https://www.paidmembershipspro.com/allow-specific-membership-levels-to-view-addon-packages-and-require-others-to-pay/
This gist will allow you to add a specific category to any post.
This will in turn require users to pay for the post even if they have all access permissions.
Set levels as "all access levels" so members of these levels will be able to view all Addon Packages.
Requires Paid Memberships Pro and the pmpro-addon-packages plugin.
*/