Skip to content

Instantly share code, notes, and snippets.

View ideadude's full-sized avatar

Jason Coleman ideadude

View GitHub Profile
@ideadude
ideadude / my_pmpro_category_filter.php
Last active April 14, 2024 16:18 — forked from strangerstudios/my_pmpro_category_filter.php
Add specific members-only categories back to main loop when filtering searches and archives.
<?php
/**
* Add specific members-only categories back to main loop
* when filtering searches and archives.
* Updated for PMPro 3.0+.
*
* 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/
@ideadude
ideadude / my_pmpro_additional_categories.php
Created October 19, 2022 09:59 — forked from strangerstudios/my_pmpro_additional_categories.php
Add "Purchase Additional Access" box to Membership Checkout for a la carte category purchase.
<?php
/**
* Require specific category user meta to view posts in designated categories.
* Custom price-adjusting fields are added via user fields.
* The initial payment and billing amount is adjusted based on cat selections.
*
* 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/
@ideadude
ideadude / add-billing-to-add-member-and-profile.php
Last active August 25, 2022 17:31 — forked from andrewlimaza/add-billing-to-add-member-and-profile.php
Add billing fields to Add Member Settings
<?php
/*
* Add this code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* This will add billing fields to Add Member and the user's profile page.
*/
function add_billing_fields_to_add_member_profile() {
//check for register helper
if(!function_exists("pmpro_add_user_field")) // pmprorh_add_registration_field
return;
@ideadude
ideadude / automatically-approve-previously-approved.php
Created December 3, 2021 14:36 — forked from travislima/automatically-approve-previously-approved.php
Automatically approve, previously approved members. [Paid Memberships Pro]
<?php
/**
* Automatically approve any previously approved member.
* Requires the PMPro Approval Process for Membership Add On - https://www.paidmembershipspro.com/add-ons/approval-process-membership/
* Add this code to your site following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_automatically_approve_previously_approved( $level_id, $user_id, $cancelled_level ) {
if ( ! class_exists( 'PMPro_Approvals' ) ) {
@ideadude
ideadude / pmpro-prorate-initial-payment.php
Last active November 17, 2021 20:05 — forked from femiyb/pmpro-prorate-initial-payment.php
Prorate the initial payment. Useful for subscriptions that occur on the first of every month.
/**
* Prorate the initial payment at PMPro checkout based on the day of the month.
* You should use the Subscription Delays add on to set your subscription
* to delay until Y1-M1-01.
*/
function my_pmpro_checkout_level( $level ) {
$current_day = date( 'j' );
// Ignore if it's the first of the month.
if ( $current_day == 1 ) {
@ideadude
ideadude / pmpro_queries.sql
Last active October 24, 2022 21:22 — forked from strangerstudios/pmpro_queries.sql
Some queries around PMPro sales/etc
# successful paid orders for a given month
SELECT COUNT( * )
FROM wp_pmpro_membership_orders
WHERE
total > 0 AND
status NOT IN (
'error', 'token', 'refunded', 'pending', 'review'
)
AND TIMESTAMP > '2017-10-01'
AND TIMESTAMP < '2017-11-01';
@ideadude
ideadude / a-gettext-filter-4-pmpro.php
Last active October 5, 2021 01:31 — forked from pbrocks/a-gettext-filter-4-pmpro.php
Sometimes we may want to change the wording of the language used in a plugin or theme, but don't want to edit code directly. A cleaner way to go is to use the built in filter that WordPress has called 'gettext'. This filter will search your codebase for translatable strings and replace when an exact match is found.
<?php
/**
* This filter will search your codebase for translatable strings and replace when an exact match is found.
*
* Here we're changing 'Membership' to 'Subscription' for Paid Memberships Pro.
*
* Add this code to your PMPro Customizations Plugin
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* Note: When adding to your Customizations Plugin, be careful not to include the opening php tag on line 1 above.
*
@ideadude
ideadude / my_pmpro_ipn_check_receiver_email.php
Created August 31, 2021 17:09 — forked from andrewlimaza/my_pmpro_ipn_check_receiver_email.php
Allow other receiver/business email addresses for PMPro IPN Messages.
<?php
/**
* Allow other business email addresses for PMPro IPN Messages.
* To add this code to your site you may follow this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_ipn_check_receiver_email($check, $email) {
if ( in_array( 'bbb@gmail.com', $email ) ) { //change email here to the old email
$check = true;
}
@ideadude
ideadude / my_pmpro_checkout_level.php
Last active December 5, 2021 13:07 — forked from strangerstudios/my_pmpro_checkout_level.php
Increase price at checkout if a certain value (e.g. added via PMPro Register Helper) is set.
<?php
/**
* If a user checked option1, then add $100 to the price.
*/
function my_pmpro_checkout_level($level) {
if( ! empty( $_REQUEST['option1'] ) || ! empty( $_SESSION['option1'] ) ) {
$level->initial_payment = $level->initial_payment + 100;
//$level->billing_amount = $level->billing_amount + 100; //to update recurring payments too
}
@ideadude
ideadude / pmpro-australia-gst.php
Last active January 19, 2023 09:27 — forked from strangerstudios/pmpro-australia-gst.php
Paid Memberships Pro - Australia GST
<?php
/*
Plugin Name: Paid Memberships Pro - Australia GST
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-australia-gst/
Description: Apply Australia GST to Checkouts with PMPro
Version: .1
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
/*