Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working remotely 😈

Mary Job MaryOJob

🏠
Working remotely 😈
View GitHub Profile
@andrewlimaza
andrewlimaza / remove_redirect_memberhomepages.php
Created Dec 15, 2017
Remove homepage replacement for Member Home Pages Paid Memberships Pro
View remove_redirect_memberhomepages.php
<?php
/**
* Removes the always redirect to member homepages. Only allows login redirect functionality.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function remove_memberhome_pages_redirect(){
remove_action('template_redirect', 'pmpromh_template_redirect_homepage');
}
@andrewlimaza
andrewlimaza / free-downloadable-members-product.php
Created Jan 8, 2020
Give members a free WooCommerce downloadable Product [Paid Memberships Pro Snippet]
View free-downloadable-members-product.php
<?php
/**
* Give certain downloadable products to Paid Memberships Pro members for free.
* Adjust the code to your needs and to match your WooCommerce Product IDs and Membership Level IDs.
* Follow this guide to add the code to your WordPress website - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function free_download_product_for_members( $discount_price, $level_id, $original_price, $product ) {
$allowed_free_products = array( 58, 59, 100, 300, 501); // Adjust this with the WooCommerce Product ID's that are allowed to be discounted.
@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;
@ipokkel
ipokkel / confirmation-page-redirect-per-member-homepages.php
Last active Feb 7, 2020
Redirect members after PMPro checkout to the set level homepage instead of the default confirmation page. #pmpro #confirmation #redirect #homepages
View confirmation-page-redirect-per-member-homepages.php
<?php
/**
* This recipe will redirect members after checkout to the set level homepage.
*
* This Requires PMPro Member Homepages installed and active.
* https://www.paidmembershipspro.com/add-ons/member-homepages/
*
* If a homepage for a membership level is set this will
* redirect members after checkout to the set level homepage instead of
@ipokkel
ipokkel / change-auto-renewal-checkbox.php
Last active Feb 14, 2020
Change text for auto renewal checkbox translation strings
View change-auto-renewal-checkbox.php
<?php
// Add this code below to your PMPro Customizations plugin - http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
add_filter( 'gettext', 'change_text_for_auto_renewal_checkbox', 20, 3 );
/**
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*/
function change_text_for_auto_renewal_checkbox( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Would you like to set up automatic renewals?':
$translated_text = __( 'Do you want to set up automatic renewals?', 'pmproarc' );
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;
});
@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
@andrewlimaza
andrewlimaza / adjust-my-vat.php
Created Mar 30, 2020
Adjust VAT amount for VAT Add On PMPro
View adjust-my-vat.php
<?php
/**
* Adjust VAT amount charged from VAT Tax Add On Paid Memberships Pro.
* Adjust the code to your liking/needs.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function adjust_my_pmpro_vat( $vat ) {
$vat['DE'] = 0.25; //Change VAT to 25% for Germany.
@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.
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
You can’t perform that action at this time.