Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working remotely 😈

Mary Job MaryOJob

🏠
Working remotely 😈
View GitHub Profile
@dparker1005
dparker1005 / my_pmprogl_customize_message.php
Created Jan 16, 2020
Replace the text that is added to confirmation emails and confirmation page by the Gift Levels add-on
View my_pmprogl_customize_message.php
<?php
// Copy from below here...
/*
* Replace the text that is added to confirmation emails and confirmation page by the Gift Levels add-on
* As written, will just show the code instead of the link to checkout with the code.
*/
function my_pmprogl_customize_message() {
remove_filter("pmpro_email_body", "pmprogl_pmpro_email_body", 10, 2);
@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.
@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' );
@ideadude
ideadude / my_init_override_sponsored_members_pricing_update.php
Last active May 15, 2020
PMPro Sponsored Members Example with custom callback to override seat pricing.
View my_init_override_sponsored_members_pricing_update.php
/**
* Sponsored Members setup with child seat costs and child fields at checkout.
*/
global $pmprosm_sponsored_account_levels;
$pmprosm_sponsored_account_levels = array(
1 => array(
'main_level_id' => 1,
'sponsored_level_id' => 2,
'seat_cost' => 35,
'min_seats' => 1,
@ideadude
ideadude / pmpro-cpt.php
Last active Jul 22, 2020 — forked from strangerstudios/pmpro-cpt.php
Add the PMPro meta box to a CPT. Add this to your plugin/etc.
View pmpro-cpt.php
<?php
/**
* Add the PMPro meta box to a CPT
*/
function my_add_pmpro_meta_box_to_cpts() {
// Duplicate this row for each CPT. This one adds the meta boxes to 'product' CPTs.
add_meta_box('pmpro_page_meta', 'Require Membership', 'pmpro_page_meta', 'product', 'side' );
}
add_action( 'admin_menu', 'my_add_pmpro_meta_box_to_cpts', 20 );
@andrewlimaza
andrewlimaza / custom-depends-register-helper-simple-example.php
Created Aug 29, 2018
Multiple Depends example for Register Helper and Custom JQuery.
View custom-depends-register-helper-simple-example.php
<?php
/**
* This is a simple example that references a select drop down and when a certain option is selected will it show.
* Add this code to your PMPro Customizations and tweak to your liking.
*/
function my_pmprorh_init() {
//don't break if Register Helper is not loaded
if(!function_exists( 'pmprorh_add_registration_field' )) {
return false;
@andrewlimaza
andrewlimaza / my_admin_fees_example.php
Created Jan 29, 2018
Adding custom tax to Paid Memberships Pro and renaming to admin fees instead.
View my_admin_fees_example.php
<?php
/**
* This gist is to add a 20% fee on all orders and rename 'Tax' to 'Admin Fees'.
* Please add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* www.paidmembershipspro.com
*/
/**
* This function will add 20% to all orders using the 'pmpro_tax' filter.
@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');
}
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.