Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working remotely 😈

Mary Job MaryOJob

🏠
Working remotely 😈
View GitHub Profile
@strangerstudios
strangerstudios / gist:3100680
Created Jul 12, 2012
Hidden Levels for Paid Memberships Pro
View gist:3100680
<?php
/*
Plugin Name: PMPro Hidden Levels
Plugin URI: http://www.paidmembershipspro.com/pmpro-hidden-levels/
Description: With this plugin, select levels are removed from the levels page but still available for checkout if you visit the checkout URL directly.
Version: .1
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
@strangerstudios
strangerstudios / update_currency_per_level.php
Created Feb 4, 2014
Change currencies depending on Paid Memberships Pro level. Add this code to your active theme's functions.php or a custom plugin. This is just an example that will need to be tweaked for your needs.
View update_currency_per_level.php
/*
Change currencies depending on Paid Memberships Pro level.
Add this code to your active theme's functions.php or a custom plugin.
This is just an example that will need to be tweaked for your needs.
Other places to look into swapping currencies:
* Levels page.
* Invoices page.
* In emails.
* In membership levels table in admin.
@strangerstudios
strangerstudios / my_pmpro_email_recipient.php
Created Sep 24, 2014
Disable PMPro Checkout Confirmation Emails
View my_pmpro_email_recipient.php
/*
Disable PMPro Checkout Confirmation Emails
Add this code to your active theme's fucntions.php
or a custom plugin.
*/
function my_pmpro_email_recipient($recipient, $email)
{
if(strpos($email->template, "checkout_") !== false)
$recipient = NULL;
@strangerstudios
strangerstudios / is_user_logged_in_required.php
Last active Apr 3, 2020
Make PMPro Register Helper fields required for logged out users only.
View is_user_logged_in_required.php
if(is_user_logged_in())
$required = false;
else
$required = true;
$fields[] = new PMProRH_Field(
"company", // input name, will also be used as meta key
"text", // type of field
array(
"size"=>40, // input size
@greathmaster
greathmaster / pmpro-prorate-initial-payment.php
Created Dec 22, 2015
Prorate the initial payment. Useful for subscriptions that occur on the first of every month.
View pmpro-prorate-initial-payment.php
function my_pmpro_checkout_level($level)
{
$current_day = date('j');
$days_in_month = date('t');
$level->initial_payment = $level->initial_payment*(($days_in_month - $current_day)/$days_in_month);
return $level;
}
@andrewlimaza
andrewlimaza / my_logout_go_home.php
Created Aug 9, 2016
Redirect users to home page when logging out of WordPress
View my_logout_go_home.php
<?php
//copy lines 5 onwards into your active theme's function.php or custom plugin for code snippets.
function my_logout_go_home(){
wp_redirect( home_url() );
exit();
}
add_action( 'wp_logout', 'my_logout_go_home' );
@eighty20results
eighty20results / pmpro-append-to-end.php
Created Oct 10, 2016
When user renews membership we append the duration to their current enddate
View pmpro-append-to-end.php
<?php
/*
Plugin Name: Paid Memberships Pro: Extend membership by new level duration
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: On change of level, modify the end date to add the new level's time
Version: 1.0
Requires: 4.5.3
Author: Thomas Sjolshagen <thomas@eighty20results.com>
Author URI: http://www.eighty20results.com/thomas-sjolshagen/
License: GPL2
View pmpro-user-pages-enable-comments.php
//Enables comments for User Pages
function enable_comments_for_user_pages($postdata, $user, $level)
{
$postdata['comment_status'] = 'open';
return $postdata;
}
add_filter('pmpro_user_page_postdata', 'enable_comments_for_user_pages', 10, 3);
View gist:b2d8e5b8f5fec5b0ed946b24fa288a91
# Install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install composer
brew install homebrew/php/composer
### PHPCS
composer global require "squizlabs/php_codesniffer=*"
# Add to your .bash_profile
View caldera_forms_phone_js_options-preferred.php
<?php
/**
* Set preffered countries for Caldera Forms phone fields
*/
add_filter( 'caldera_forms_phone_js_options', function( $options){
//Use ISO_3166-1_alpha-2 formatted country code
$options[ 'preferredCountries' ] = array( 'MX' );
return $options;
});
You can’t perform that action at this time.