Skip to content

Instantly share code, notes, and snippets.

@messica
messica / pmpro_customizations_gift_levels_example.php
Last active December 2, 2020 15:55
PMPro Gift Levels Example
<?php
/* PMPro Gift Levels Example */
global $pmprogl_gift_levels;
$pmprogl_gift_levels = array(
// Set level 1 as a "Purchase Gift" membership level to create a gift code for a free level 2 gift.
1 => array( // "Purchase Gift" level ID
'level_id' => 2, // Membership Level ID of the gift membership level.
@messica
messica / my_pmpromrss_feeds.php
Last active May 16, 2023 06:05
pmpromrss_feeds filter example
<?php
/*
* PMPro RSS Extra Feeds Example
*
* Extra feeds format:
* $feeds["Label"] = Feed URL
*
* learn more about feed URLs at http://codex.wordpress.org/WordPress_Feeds
*/
@messica
messica / my_pmpro_levels.php
Created May 20, 2014 20:51
Create [my_pmpro_levels] shortcode which will work in sidebar widgets, etc.
<?php
/* Create [my_pmpro_levels] shortcode which will work in sidebar widgets, etc. */
function my_pmpro_levels($atts = NULL)
{
ob_start();
include(PMPRO_DIR . "/preheaders/levels.php");
@messica
messica / my_pmprosl_customizations.php
Created May 29, 2014 06:47
PMPro Social Locker Settings
<?php
// Constants
define( 'PMPROSL_FREE_LEVEL_ID', 5 ); //membership level to give access to
define( 'PMPROSL_MEMBERSHIP_PERIOD_DAYS', 7 ); //number of days to give visitor access
@messica
messica / pmpro_customizations.php
Last active August 29, 2015 14:02
Track trials used in certain levels to disable those trials when "upgrading" to a new level with a trial.
<?php
/*
Plugin Name: PMPro Customizations
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Customizations for Paid Memberships Pro
Version: .1
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
<?php
/*
Prorated payments. When a member chooses to upgrade,
he should be charged a pro-rated amount for the new membership level immediately,
and the payment date should stay the same.
Assumes initial payments are equal to billing amount.
Add this code to your active theme's functions.php or include this in a custom plugin.
*/
@messica
messica / my_pmpro_login_redirect_url.php
Created June 26, 2014 15:44
Redirect admins to dashboard, everyone else to home page.
<?php
/*
* Redirect admins to dashboard, everyone else to home page.
*/
function my_pmpro_login_redirect_url($url, $request, $user) {
//only do this if we have a user
if(is_a($user, 'WP_User')) {
if(in_array('administrator', $user->roles))
<?php
/*
Plugin Name: PMPro Address For Free Levels
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-address-for-free-levels/
Description: Show address fields for free levels also with Paid Memberships Pro
Version: .1
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
@messica
messica / my_pmpro_registration_checks.php
Created October 2, 2014 14:51
Limit number of checkouts for a specific membership level
<?php
/*
* Limit checkouts for membership level
*/
function my_pmpro_registration_checks($continue_registration) {
global $wpdb;
@messica
messica / getDaysUntilExpiration.php
Created December 22, 2014 17:35
PMPro - get the number of days until expiration
<?php
/*
* Return the # of days until expiration for a given user
*/
function getDaysUntilExpiration($user_id = NULL) {
global $current_user;
if(!$user_id)