Skip to content

Instantly share code, notes, and snippets.

View ideadude's full-sized avatar

Jason Coleman ideadude

View GitHub Profile
@ideadude
ideadude / my_sync_stripe_events.php
Created March 13, 2020 17:43
Synchronize Stripe invoice.payment_succeeded Events in PMPro.
/**
* Synchronize Stripe invoice.payment_succeeded Events
* Warning. This code will update your database,
* create new orders, and potentially email your customers.
* Proceed with caution. Back up your database.
* You will likely want to pair this script with a plugin
* or script to disable all email.
* The default limit is 200 events. You may need to increase this
* or update the script to paginate and run events in batches.
* The default delay between event calls is 2 seconds.
@ideadude
ideadude / pmpro-customizations.php
Last active March 11, 2020 18:47 — forked from strangerstudios/pmpro-customizations.php
Tax solution for British Columbia, Canada to be used with Paid Memberships Pro
<?php
/*
Plugin Name: PMPro Customizations
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Customizations for PMPro
Version: .2
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
/*
@ideadude
ideadude / my_hide_jnews_ads_from_members.php
Created March 5, 2020 21:26
Unhook JNews Theme Ads if the user is a PMPro member
// Unhook JNews Theme Ads if the user is a PMPro member
// Add this code into a custom plugin.
// I am not sure that this is running late enough to override
// the JNews Ad insert. You may need to hook into init later
// or even another hook that runs later.
function my_hide_jnews_ads_from_members() {
// do nothing if PMPro is not running
if ( ! function_exists( 'pmpro_hasMembershipLevel' ) ) {
return;
}
@ideadude
ideadude / htaccess.txt
Created March 4, 2020 12:24
Lock down ONLY PDFs with Paid Memberships Pro
RewriteBase /
RewriteRule ^wp-content/uploads/(.*\.pdf)$ /wp-content/plugins/paid-memberships-pro/services/getfile.php [L]
@ideadude
ideadude / getfile.php
Created March 4, 2020 12:21
Enable Paid Memberships Pro's getfile script to lock down files.
define('PMPRO_GETFILE_ENABLED', true);
@ideadude
ideadude / htaccess.txt
Created March 4, 2020 12:20
Locking down files with PMPro.
RewriteBase /
RewriteRule ^wp-content/uploads/(.*)$ /wp-content/plugins/paid-memberships-pro/services/getfile.php [L]
@ideadude
ideadude / htaccess.txt
Last active February 8, 2022 20:36
Locking down only PDF,DOC,DOCX,PPT,ZIP files with Paid Memberships Pro
RewriteBase /
RewriteRule ^wp-content/uploads/.*(\.pdf|\.doc|\.docx|\.ppt|\.zip)$ /wp-content/plugins/paid-memberships-pro/services/getfile.php [L]
@ideadude
ideadude / my_pmpro_report_login_wp_visits_only_for_users.php
Created February 21, 2020 13:29
Change PMPro to only track visits for logged in users.
/**
* Change PMPro to only track visits for logged in users.
* Add this code into a custom plugin or code snippet.
*/
function my_pmpro_report_login_wp_visits_only_for_users() {
if ( ! is_user_logged_in() ) {
remove_action( 'wp', 'pmpro_report_login_wp_visits' );
}
}
add_action( 'init', 'my_pmpro_report_login_wp_visits_only_for_users' );
@ideadude
ideadude / my_add_meta_queries_to_pmpro_directory_search.php
Created January 17, 2020 06:09
Allow meta filtering of the PMPro membership directory
/**
* Allow meta filtering of the membership directory
* if pk and ps params are passed into the URL.
* PMPro and the PMPro Member Directory Add Ons should be active.
* Then add this code to a custom plugin.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_add_meta_queries_to_pmpro_directory_search( $sql_parts ) {
global $wpdb;
@ideadude
ideadude / directory.php
Created January 17, 2020 05:50 — forked from greathmaster/directory.php
Custom directory template. Alphabetical last name search, and meta key/value search.
<?php
/*
Custom directory template. Adds alphabetical last name query. For example you can use the URL:
http://www.example.com/membership-account/directory/?lt=A
if you want all the members with last names starting with 'A'.
Also includes meta key/value search. For example you can use the URL: