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
global $pmprosm_sponsored_account_levels;
$pmprosm_sponsored_account_levels = [
//set 5 seats at checkout
4 => [
'main_level_id' => 4, //redundant but useful
'sponsored_level_id' => [4], //array or single id
'sponsored_accounts_at_checkout' => TRUE,
'seat_cost' => 0,
'max_seats' => 4,
'min_seats' => 4,
@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 / remove-gift-aid-text-from-checkout-page.php
Created February 8, 2023 13:15 — forked from ipokkel/remove-gift-aid-text-from-checkout-page.php
Remove PMPro Gift Aid text from checkout page for specified levels in the $no_gift_aid_level_ids variable.
<?php
/**
* Remove the gift aid text from the checkout page for specified membership levels.
*
* 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 / my_pmprowc_free_shipping_example.php
Last active January 18, 2023 13:51 — forked from JarrydLong/my_pmprowc_free_shipping.php
Give members of specific level IDs Free Shipping on orders above $75 in your WooCommerce store.
<?php // Do not copy this line
/**
* Add the following code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* Give members of level 1 or 2 Free Shipping when free shipping is available (must set free shipping as an option in store settings).
* Change $pmprowc_free_shipping_levels = array(1,2); to include level IDs that receive free shipping
*/
function my_pmprowc_free_shipping( $rates, $package ) {
@MaryOJob
MaryOJob / my_logout_go_home.php
Last active January 6, 2023 23:43 — forked from andrewlimaza/my_logout_go_home.php
Redirect users to a specified page when logging out of your WordPress PMPro site
<?php // DO NOT COPY THIS LINE
//copy lines 5 onwards into your active theme's function.php or custom plugin for code snippets.
function mypmpro_redirect_logout(){
// wp_safe_redirect( '/contact/' ); // use this line to redirect to a specific page on your site
wp_safe_redirect( home_url() ); // use this to redirect to your website home page
exit();
}
add_action('wp_logout','mypmpro_redirect_logout');
@MaryOJob
MaryOJob / my_pmpro_email_attachments.php
Created December 15, 2022 06:11 — forked from strangerstudios/my_pmpro_email_attachments.php
Add an attachment to confirmation emails in Paid Memberships Pro
/*
Add an attachment to confirmation emails.
Requires PMPro v1.7.14+
*/
function my_pmpro_email_attachments($attachments, $email)
{
//make sure it's a checkout email (but not the admin one)
if(strpos($email->template, "checkout_") !== false && strpos($email->template, "admin") === false)
{
@MaryOJob
MaryOJob / generate_member_number.php
Last active December 8, 2022 11:36 — forked from kimwhite/generate_member_number.php
Code to generate incremental Member Number values for PMPro users/members.
<?php // do not copy this line.
/**
* This recipe creates Member Numbers
* Change the generate_member_number function if your member number needs to be in a certain format.
* Member numbers are generated when users are registered or when the membership account page is accessed for the first time.
*
* 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.
@MaryOJob
MaryOJob / member_days_left_pmpro.php
Created November 15, 2022 20:04 — forked from andrewlimaza/member_days_left_pmpro.php
Show "Days Left" for Paid Memberships Pro
<?php
//Copy lines 5 onwards into your PMPro Customizations plugin -> https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
/**
* Add days left to members list
*/
function my_pmpro_days_left_members_list_col_header( $theusers )
{
?>
@MaryOJob
MaryOJob / pmpro-change-level-recurring.php
Created November 15, 2022 20:04 — forked from ronalfy/pmpro-change-level-recurring.php
PMPro - Change Never Label Message for Recurring Levels
<?php
/**
* Changes the output label to Recurring in member/order lists for recurring levels.
*
* 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/
*/
/**
<?php
/**
* Edit Teaser Messages Depending on Content
*
*/
function pmpro_pmpro_not_logged_in_text_filter( $text ) {
global $post;
$access = pmpro_has_membership_access( $post->ID, NULL, true );
$level_ids = $access[1];