Skip to content

Instantly share code, notes, and snippets.

View MaryOJob's full-sized avatar
🏠
Working remotely 😈

Mary Job MaryOJob

🏠
Working remotely 😈
View GitHub Profile
@MaryOJob
MaryOJob / my_admin_fees_example.php
Last active September 29, 2021 20:09 — forked from andrewlimaza/my_admin_fees_example.php
Adding custom tax to Paid Memberships Pro and renaming to vat fees instead.
<?php // do not copy this line
/**
* This gist is to add a 20% fee on all orders and rename 'Tax' to 'VAT 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.
@MaryOJob
MaryOJob / my_gettext_pay_by_check.php
Created May 14, 2020 21:27 — forked from strangerstudios/my_gettext_pay_by_check.php
Update Pay by Check wording in pmpro-pay-by-check to something else.
<?php
/*
Change "Pay by Check" language to "Pay by Wire Transfer"
Add this code to your active theme's functions.php
or a custom plugin.
*/
function my_gettext_pay_by_check($translated_text, $text, $domain)
{
if($domain == "pmpropbc" && $text == "Pay by Check")
@MaryOJob
MaryOJob / redirect_users_after_login.php
Last active May 15, 2020 11:25 — forked from andrewlimaza/redirect_users_after_login.php
Redirect Users After Login For WordPress
<?php // DO NOT COPY THIS LINE
/**
* Redirect all non-admin user's after they login to your website's home page.
* Documentation for login_redirect filter - https://codex.wordpress.org/Plugin_API/Filter_Reference/login_redirect
*/
function pmpro_redirect_after_login( $redirect_to, $request, $user ) {
if ( isset( $user->roles ) && is_array( $user->roles ) ) {
@MaryOJob
MaryOJob / my_change_text_giftaddon.php
Last active May 20, 2020 13:17 — forked from femiyb/my_change_text_mmpu.php
Change text with str_replace on the Gift Levels PMPro Add-On
<?php
/*
Replace or translate text strings that's not translatable with gettext.
*/
// Check page content and replace text strings
function my_change_text_gift_addon( $text ) {
global $pmpro_pages;
@MaryOJob
MaryOJob / pmpro-prorate-initial-payment.php
Created May 20, 2020 13:35 — forked from greathmaster/pmpro-prorate-initial-payment.php
Prorate the initial payment. Useful for subscriptions that occur on the first of every month.
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;
}
@MaryOJob
MaryOJob / redirect_after_pmpro_checkout.php
Last active October 27, 2023 12:12 — forked from ugonkwocha/PMPro Gist
Redirect to another page / site after a PMPro checkout.
<?php // DO NOT COPY THIS LINE
/* See full article here please: https://www.paidmembershipspro.com/set-up-unique-membership-confirmation-pages-based-on-level/
* Copy this into a PMPro Customizations Plugin: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
**/
function my_pmpro_confirmation_url($rurl, $user_id, $pmpro_level) {
if(pmpro_hasMembershipLevel(2))
$rurl = "https://online.9jacodekids.com/my-account/";
elseif(pmpro_hasMembershipLevel(3))
@MaryOJob
MaryOJob / strike-pmpro-woo.php
Created June 12, 2020 14:40 — forked from andrewlimaza/strike-pmpro-woo.php
Strike pricing for WooCommerce and Paid Memberships Pro pricing.
<?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;
@MaryOJob
MaryOJob / my_pmproan2c_change_priority.php
Last active June 1, 2022 07:35 — forked from ipokkel/my_pmproan2c_change_priority.php
Reorder the PMPro "Add First and Last Name (add-on)" field setting it to display after the username field
<?php // Do not copy this line
/* Load add name to checkout (pmproan2c) earlier than default
* Can be used to reposition name fields when multiple custom fields are
* loaded after the username field on the checkout page
* Add this code to your PMPro Customizations Plugin: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmproan2c_change_priority() {
remove_action( 'pmpro_checkout_after_password', 'pmproan2c_pmpro_checkout_after_password' );
@MaryOJob
MaryOJob / my_pmpro_change_text_example.php
Last active July 15, 2020 14:48 — forked from kimwhite/my_pmpro_change_text_example.php
Change text example in a PMPro Page Template.
<?php // Do Not Copy This Line Please
/**
* This recipe replaces text strings in the content filter.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
@MaryOJob
MaryOJob / pmpro-rh-ec-fields.php
Created August 10, 2020 21:19 — forked from ronalfy/pmpro-rh-ec-fields.php
Paid Memberships Pro Register Helper Adding Emergency Contact Fields
<?php
// We have to put everything in a function called on init, so we are sure Register Helper is loaded.
function pmpro_register_field_peakbagger_init() {
// Don't break if Register Helper is not loaded.
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) {
return false;
}
pmprorh_add_checkout_box( 'contact', 'Contact Information' );
pmprorh_add_checkout_box( 'emergency', 'Emergency Contact Information' );