Skip to content

Instantly share code, notes, and snippets.

View LMNTL's full-sized avatar

Jessica Thomas LMNTL

  • Chicago, IL
View GitHub Profile
<?php
/*
* Give users a new level after x successful payments at another level.
*/
function my_pmpro_after_change_membership_level($level_id, $user_id, $cancel_level)
{
global $wpdb;
// change number of payments here
$payments = 10;
@LMNTL
LMNTL / pmpro-stripe-billing-limits.php
Last active March 19, 2019 17:18
PMPro Stripe Billing Limits
<?php
/*
Plugin Name: PMPro Stripe Billing Limits
Plugin URI: http://www.paidmembershipspro.com/add-ons/pmpro-stripe-billing-limits/
Description: Allow billing limits with Stripe, where the Stripe subscription is cancelled, but the PMPro membership is not after X payments.
Version: .3
Author: strangerstudios
Author URI: http://www.strangerstudios.com
*/
/*
@LMNTL
LMNTL / admin_redirect.php
Last active March 5, 2019 23:18
Change /wp-admin/ Redirect After Login for Paid Memberships Pro
<?php
/* Change /wp-admin/ Redirect After Login for Paid Memberships Pro */
function my_pmpromh_login_redirect( $redirect_to, $request, $user )
{
$admin_url = get_admin_url();
$landing_page_id = 11; //change this to the ID of the page you want to redirect the user to
if ( ! current_user_can( 'administrator' ) && $redirect_to == $admin_url ) {
$redirect_to = get_permalink( $landing_page_id );
}
@LMNTL
LMNTL / pmpro_add_member_notification.php
Last active January 12, 2021 15:40
Generate checkout email when using Add Member from Admin Add On for Paid Memberships Pro
<?php
/* Generate checkout email when using Add Member from Admin Add On for Paid Memberships Pro
*/
function pmpro_send_member_notification( $user ) {
$pmproemail = new PMProEmail();
$pmproemail->sendCheckoutEmail( $user );
}
add_action( 'pmpro_add_member_added', 'pmpro_send_member_notification', 10, 2 )
@LMNTL
LMNTL / gist:c3ec63f9b1ea1f91a10bae6796f27e2f
Created March 28, 2019 18:25 — forked from strangerstudios/gist:4081449
Change Paid Memberships Pro Email Subjects
/*
Change email subjects.
The function checks $email->template and updates the subject as needed.
The email template name will be equivalent to the filenames in the /email/ folder of the PMPro plugin.
*/
function my_pmpro_email_subject($subject, $email)
{
//only checkout emails
@LMNTL
LMNTL / pmpro-adjust-email-subject-to-level-checkout.php
Last active March 28, 2019 19:17 — forked from pbrocks/pmpro-adjust-email-content-to-level-checkout.php
This gist changes the subject line of the checkout email based on the member's level. - based on https://gist.github.com/pbrocks/abe099df6a462cb2353240af63a53959
<?php
/**
* Change subject line of Checkout email based on membership level.
*
* @param string $subject The email's subject is a string of text that you can adjust here as you see fit or pull from another custom function.
* @param object $email This is the php object from which we extracting the appropriate level and to which we'll add the new email content.
* @return string Whichever condition applies in the function below will determine what string is supplied to the email object. If none of the conditions are met, the return string will be the original message subject.
*/
function pmpro_adjust_email_subject_to_level_checkout( $subject, $email ) {
@LMNTL
LMNTL / pmpro-limited-time-registration.php
Last active April 7, 2021 03:55
Restrict a membership level to no longer allow sign ups after a given date (limited time offer) using Paid Memberships pro
<?php
/* Checks to see if a registration is happening after a given date; if so, prevent registration and stop new signups for the level/no longer display the level on the levels page
*/
global $pmproml_end_date, $pmproml_limited_level_id;
$pmproml_limited_level_id = 1; // change to the ID of the limited-time membership level
$pmproml_end_date = "2019/04/30"; // change to the date registration ends, in YYYY/MM/DD format
function pmproml_pmpro_registration_date_checks( $value ) {
global $wpdb, $pmproml_end_date, $pmproml_limited_level_id;
@LMNTL
LMNTL / pmpro-member-directory-page-number-in-title
Last active September 6, 2019 17:44
Add page numbers to page titles in Member Directory Add On for Paid Memberships Pro
<?php
/*
*/
function my_pmpro_add_directory_page_numbers($title){
global $post, $pmpro_pages;
$pn = 0;
if( isset($_REQUEST['pn'] ) )
{
$pn = sanitize_text_field( $_REQUEST['pn'] );
}
@LMNTL
LMNTL / customization.php
Last active April 15, 2019 21:52
Allows renewing yearly memberships with a set expiration date. Requires the Set Expiration Dates Add On for Paid Memberships Pro
/*
Allows renewing yearly memberships with a set expiration date.
E.g. if the level expires on 1/1/2020 and the member renews their membership before then, their membership will be extended to 1/1/2021
Requires the Set Expiration Dates Add On for Paid Memberships Pro
*/
function my_pmpro_yearly_membership_renewal($level) {
$extend_level = 1; //change to the level with a set expiration date
if( $level->id == $extend_level && pmpro_hasMembershipLevel( $extend_level ) )
@LMNTL
LMNTL / override-set-expiration-text.php
Created April 23, 2019 19:25
override expiration text for Set Expiration Date Add On for Paid Memberships Pro
/*
Change expiration text on levels page.
*/
function pmprosed_my_pmpro_level_expiration_text($expiration_text, $level)
{
$set_expiration_date = pmpro_getSetExpirationDate($level->id);
if (!empty($set_expiration_date)) {
$set_expiration_date = pmprosed_fixDate($set_expiration_date);
$expiration_text = "This membership level will expire on " . date(get_option('date_format'), strtotime($set_expiration_date, current_time('timestamp'))) . ".";
}