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_after_change_membership_level.php
Last active March 21, 2019 12:51 — forked from strangerstudios/my_pmpro_after_change_membership_level.php
Only allow users to use the trial level once with Paid Memberships Pro.
<?php
/*
Only allow users to use the trial level once.
Add this code to your active theme's functions.php
or a custom plugin.
Be sure to change the $trial_level_id variable in multiple places.
*/
//get trial level ids
function my_pmpro_trial_level_ids() {
// edit this to be a comma separated list of your trial level ids
@ideadude
ideadude / my_pmpro_registration_checks_restrict_email_addresses.php
Last active July 6, 2022 11:01 — forked from strangerstudios/my_pmpro_checkout_restrict_email_domain.php
Restrict Membership Signup by Email Domain (Useful for Education, Corporate, or Association Memberships)
<?php
/**
* Restrict Membership Signup by Email Domain
* Make sure to edit the $valid_domains array defined further below
* to include only the domains you'd like to allow.
*
* Add this code to a custom plugin. More info: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_registration_checks_restrict_email_addresses( $value ) {
$email = $_REQUEST['bemail'];
@ideadude
ideadude / tids_transaction_ids.php
Created June 5, 2019 10:38 — forked from strangerstudios/tids_transaction_ids.php
Show and Search By Payment/Subscription Transaction IDs with Paid Memberships Pro
<?php
/*
Payment/Subscription Transaction IDs Code
Add to your active theme's functions.php or a custom plugin.
*/
//Add Transaction IDs to Members List
function tids_pmpro_memberslist_extra_cols_header($theusers)
{
?>
@ideadude
ideadude / my_pmproec_after_validate_user.php
Last active April 13, 2021 18:25 — forked from strangerstudios/my_pmproec_after_validate_user.php
Redirect to the membership account page instead of the home page after email validation with the PMPro Email Confirmation add on.
/**
* Redirect to the membership account page instead of the home page after email validation with the PMPro Email Confirmation add on.
* Add this code to a custom WordPress plugin. https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmproec_after_validate_user() {
if( is_user_logged_in() ) {
wp_safe_redirect( '/membership-account/' );
} else {
wp_safe_redirect( wp_login_url( '/membership-account/' ) );
}
@ideadude
ideadude / my_init_membership_level_translate.php
Last active November 3, 2021 13:55 — forked from strangerstudios/my_init_membership_level_translate.php
Translate Membership Level Names and Descriptions with Paid Memberships Pro
<?php
/*
* Filter membership level names and descriptions for translating.
*
* Add this code to a custom plugin or your active theme's functions.php file.
* Be sure to update the $pmpro_translated_levels array. Add a sub array for each locale.
* The sub array keys should be the membership level ids,
* and values should be an array with the name and description to translate to.
*
*/
@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:
@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 / pmprorh-init-buddypress-fields.php
Created July 2, 2020 12:14 — forked from pbrocks/pmprorh-init-buddypress-fields.php
Example of defining PMPro Register Helper Fields Synchronized to BuddyPress XProfile Fields
<?php
/**
* Based on the Register Helper example.
* We've added a "buddypress" option for each field
* set to the XProfile name we used when setting up
* the fields in the BuddyPress extended profile.
* If the PMPro BuddyPress Add On is activated
* then the fields will be synchronized.
* Register Helper: https://www.paidmembershipspro.com/add-ons/pmpro-register-helper-add-checkout-and-profile-fields/
* PMPro BuddyPress: https://www.paidmembershipspro.com/add-ons/buddypress-integration/
@ideadude
ideadude / pmpro-cancel-on-billing-failure.php
Last active February 2, 2021 11:20 — forked from strangerstudios/pmpro-cancel-on-billing-failure.php
Cancel PMPro subscriptions when a recurring payment fails.
<?php
/**
* Cancel subscriptions when a recurring payment fails.
* You should also use the PMPro Email Templates Add On to edit the
* default billing_failure.html email to mention that users are cancelled upon failure.
*/
function my_cancel_subscriptions_on_any_failed_payment( $order ) {
pmpro_cancelMembershipLevel( $order->membership_id, $order->user_id );
}
add_action( 'pmpro_subscription_payment_failed', 'my_cancel_subscriptions_on_any_failed_payment' );
@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
*/
/*