Skip to content

Instantly share code, notes, and snippets.

View andrewlimaza's full-sized avatar

Andrew Lima andrewlimaza

View GitHub Profile
@andrewlimaza
andrewlimaza / bulk-update.sql
Created September 18, 2018 07:48 — forked from eighty20results/bulk-update.sql
Bulk update membership levels in Paid Memberships Pro
UPDATE wp_pmpro_memberships_users SET 'membership_id' = 2 WHERE status = 'active' AND 'membership_id' = 1;
@andrewlimaza
andrewlimaza / pmpro_content_filter_description_confirmation.php
Created September 20, 2018 07:50 — forked from kimcoleman/pmpro_content_filter_description_confirmation.php
Apply the WordPress the_content filter to the level description and confirmation message so that you can add shortcodes or other content in this area.
<?php // Do not copy this tag
/**
* Apply the WordPress the_content filter to the level description and confirmation message
* so that you can add shortcodes or other content in this area.
*
* Add this code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
// Apply the_content filter to level description.
function my_pmpro_level_description( $description ) {
@andrewlimaza
andrewlimaza / my_require_cvv_for_reals.php
Last active February 15, 2019 13:25 — forked from ideadude/my_require_cvv_for_reals.php
Set CVV as a Required Field with PMPro
<?php
/**
* Set CVV as a Required Field with PMPro
* Add this code to a custom plugin. https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*
* NOTE: Doesn't yet work with Stripe, Braintree, or PayPal Express (most gateways) that don't pass the CVV to the server.
*/
function my_require_cvv_for_reals( $fields ) {
if ( ! empty( $_REQUEST['CVV'] ) ) {
@andrewlimaza
andrewlimaza / pmpro-customizations.php
Created February 28, 2019 06:45 — forked from ipokkel/pmpro-customizations.php
PMPro Customization: Register Helper - Add JQuery widget date of birth date picker to checkout
<?php
/*
Plugin Name: PMPro Customizations
Plugin URI: https://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Customizations for my Paid Memberships Pro Setup
Version: .1
Author: Paid Memberships Pro
Author URI: https://www.paidmembershipspro.com
*/
@andrewlimaza
andrewlimaza / pmpro-apply-addon-access-to-all-child-pages.php
Last active February 28, 2019 08:53 — forked from strangerstudios/pmpro-apply-addon-access-to-all-child-pages.php
Protect all child pages of a page protected by the "Protect Add-on Pages" add-on
<?php
/*
Plugin Name: Paid Memberships Pro - Protect Child Pages Add On
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Apply protection to all child pages of a Add-on Page that's protected.
Version: .1
Author: Thomas Sjolshagen @ Stranger Studios <[email protected]>
Author URI: https://eighty20results.com/thomas-sjolshagen/
*/
/**
@andrewlimaza
andrewlimaza / pmpro-grace-period.php
Last active June 5, 2023 14:35 — forked from travislima/pmpro-grace-period.php
PMPRO - Grace Period (After expiration date is met)
<?php
/*
* Add 15 day grace period when membership expires
*/
function my_pmpro_membership_post_membership_expiry( $user_id, $level_id ) {
// Make sure we aren't already in a grace period for this level
$grace_level = get_user_meta( $user_id, 'grace_level', true );
if ( empty( $grace_level ) || $grace_level !== $level_id ) {
// Give them their level back with 15 day expiration
@andrewlimaza
andrewlimaza / my_wp_bouncer_number_simultaneous_logins.php
Last active October 31, 2019 09:13 — forked from strangerstudios/my_wp_bouncer_number_simultaneous_logins.php
Change WP Bouncer limit based on user's membership level.
function my_wp_bouncer_number_simultaneous_logins($num) {
// Bail if PMPro not activated or function not available.
if ( ! function_exists( 'pmpro_hasMembershipLevel' ) ) {
return $num;
}
if ( pmpro_hasMembershipLevel( '1' ) ) {
$num = 1;
}
@andrewlimaza
andrewlimaza / register-helper-test1.php
Last active November 21, 2019 13:31 — forked from MaryOJob/register-helper-test1.php
Adding Five Custom Fields to PMPro Accounts Page
<?php
/**
* Register Helper example for five fields. This is a test Register Helper example.
* Please add the below code to your custom plugin or Code Snippets Plugin by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmprorh_init() {
//don't break if Register Helper is not loaded
if ( ! function_exists( "pmprorh_add_registration_field" ) ) {
@andrewlimaza
andrewlimaza / my_first_last_display_name.php
Last active April 16, 2021 06:15 — forked from kimcoleman/my_first_last_display_name.php
Set Display Name on Membership Checkout and for BuddyPress Name field.
<?php
/**
* Set Display Name on Membership Checkout and for BuddyPress Name field.
*/
function my_first_last_display_name( $user_id, $morder ) {
// Get user's first and last name.
$first_name = get_user_meta( $user_id, 'first_name', true );
if ( ! empty( $first_name ) ) {
@andrewlimaza
andrewlimaza / my_ipn_redirect.php
Last active December 10, 2019 09:30 — forked from strangerstudios/my_ipn_redirect.php
Redirect IPN URL Example
<?php
function my_ipn_redirect() {
if( ! empty($_REQUEST['option'] ) && $_REQUEST['option'] == 'rs_membership' && ! empty( $_REQUEST['paypalpayment'] ) && defined('PMPRO_DIR') ) {
require_once(PMPRO_DIR . "/services/ipnhandler.php");
exit;
}
}
add_action('init', 'my_ipn_redirect');