Skip to content

Instantly share code, notes, and snippets.

🏠
Working remotely 😈

Mary Job MaryOJob

🏠
Working remotely 😈
View GitHub Profile
@MaryOJob
MaryOJob / strike-pmpro-woo.php
Created Jun 12, 2020 — forked from andrewlimaza/strike-pmpro-woo.php
Strike pricing for WooCommerce and Paid Memberships Pro pricing.
View strike-pmpro-woo.php
<?php
/**
* This will add strike through pricing if the membership pricing is available for currrent user viewing Woo store.
* Add this code (Line 8 onwards) to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmprowoo_strike_prices( $price, $product ) {
global $pmprowoo_member_discounts, $current_user;
$level_id = $current_user->membership_level->id;
@dparker1005
dparker1005 / my_pmpro_is_order_renewal.php
Last active May 22, 2020
Adds a "Renewal" column to the Orders list and order CSV export to show if the order is a membership renewal.
View my_pmpro_is_order_renewal.php
<?php
// Copy from below here...
/*
* Adds a "Renewal" column to the Orders list and order CSV export
* to show if the order is a membership renewal.
*/
function my_pmpro_is_order_renewal( $order ) {
global $wpdb;
@MaryOJob
MaryOJob / pmpro_isOrderRecurring.php
Last active May 15, 2020 — forked from strangerstudios/pmpro_isOrderRecurring.php
Perform an action on Paid Memberships Pro (PMPro) recurring orders only.
View pmpro_isOrderRecurring.php
/*
Perform an action on PMPro recurring orders only.
A recurring order here is one that
(1) Has an earlier order with the same subscription_transaction_id.
(2) Is not created at PMPro checkout.
Note that we are checking if function_exists for pmpro_isOrderRecurring incase
we add this to PMPro core. Also note that the $test_checkout param there is used
here to avoid #2 above. So this parameter will check if the currently running PHP
script is being fired at checkout, not necessarily if the order was created at checkout,
@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.
@ipokkel
ipokkel / readonly-on-profile-example.php
Created Jan 21, 2020
Example Register Helper field that displays as read only to the user on the WordPress profile page.
View readonly-on-profile-example.php
<?php
/**
* PMPro Customization: Register Helper - Add date of birth date picker to checkout
* Display field as read-only for user but as editable field for administrators
*/
//we have to put everything in a function called on init, so we are sure Register Helper is loaded
function my_pmprorh_init() {
//don't break if Register Helper is not loaded
@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,
You can’t perform that action at this time.