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_pmprolpv_has_membership_access.php
Created October 12, 2023 13:41 — forked from messica/my_pmprolpv_has_membership_access.php
Limit Post Views: Don't allow post views for certain categories.
<?php
/**
* Limit Post Views: Don't allow post views for certain categories.
*/
function my_pmprolpv_has_membership_access( $has_access, $post ) {
// Set blocked categories here.
$blocked_categories = array( 'silver', 'gold' );
@MaryOJob
MaryOJob / pmpro-add-on-learn-dash.php
Created September 15, 2023 12:26 — forked from ronalfy/pmpro-add-on-learn-dash.php
Paid Memberships Pro - Add On Packages Plus LearnDash
<?php
global $pmpro_addon_pages_for_courses;
// 28 is the page ID; 24 is the course ID.
// 30 is the page ID; 26 is the course ID.
$pmpro_addon_pages_for_courses = array(
28 => 24,
30 => 26,
);
function pmproap_learndash_template_redirect()
{
@MaryOJob
MaryOJob / pmpro-lock-membership-levels-allow-renewal.php
Last active July 31, 2023 14:33 — forked from ipokkel/pmpro-lock-membership-levels-allow-renewal.php
PMPro Lock Membership Levels - Allow members to cancel their own level but not change their current level
<?php
/**
* This recipe allows members to cancel a locked membership level
* if the level was locked with PMPro Lock Membership Levels Add On.
*
* This recipe expects and requires the Membership Locked page set up
* and assigned under Memberships > Settings > Page settings.
* @link https://www.paidmembershipspro.com/add-ons/pmpro-lock-membership-level/#install
*
@MaryOJob
MaryOJob / add_notification_bar_for_limit_post_view.php
Created July 3, 2023 17:32 — forked from kimcoleman/add_notification_bar_for_limit_post_view.php
Notification bar when post views are being tracked and restricted by the Limit Post Views Add On
<?php
/**
* Notification bar when post views are being tracked and restricted by the Limit Post Views Add On
*/
function add_notification_bar_for_limit_post_view() {
// check for past views and if we are on a single page. needs to check if the post is locked at all by default.
if ( ! empty( $_COOKIE['pmpro_lpv_count'] ) && is_single() ) {
global $current_user;
// Check cookie for views value.
@MaryOJob
MaryOJob / membership-card.php
Created June 15, 2023 15:43 — forked from ipokkel/membership-card.php
Custom PMPro Membership Card template displaying the renewal date under expiration date
<?php
/**
* Custom membership-card template: Set recurring membership renewal date as expiration date.
* Place this directly in your theme/child-theme's root directory
* e.g.: example.com/wp-content/themes/{your active theme}/membership-card.php
*/
global $wpdb, $pmpro_membership_card_user, $pmpro_currency_symbol, $post;
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 / 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_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.