Skip to content

Instantly share code, notes, and snippets.

View andrewlimaza's full-sized avatar

Andrew Lima andrewlimaza

View GitHub Profile
@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 / 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-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 / 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_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 / 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-add-pdf-invoice-attachment.php
Last active October 22, 2021 08:08 — forked from greathmaster/pmpro-add-pdf-invoice-attachment.php
Adds a PDF invoice attachment to checkout emails.
<?php
/*
Add a PDF attachement of the invoice to the checkout email. This code gist must be configured...
1) Download the DOMPDF library: https://github.com/dompdf/dompdf
1.1) Save to wp-content/your-plugin/
2) Download the PHP SVG library: https://github.com/PhenX/php-svg-lib
2.1) Save to dompdf/lib/
3) Download the PHP FONT library: https://github.com/PhenX/php-font-lib
3.1) Save to dompdf/lib/
@andrewlimaza
andrewlimaza / my_pmpro_pre_handle_404.php
Created September 4, 2018 14:34 — forked from strangerstudios/my_pmpro_pre_handle_404.php
If we 404, and the slug matches a pmpro discount code, redirect
/*
If we 404, and the slug matches a discount code, redirect
Add this code to a custom plugin
*/
function my_pmpro_pre_handle_404($preempt, $wp_query) {
global $wpdb;
//bail if PMPro is not installed
if(empty($wpdb->pmpro_discount_codes_levels))
@andrewlimaza
andrewlimaza / pmpro-register-helper-fields.php
Last active February 19, 2019 15:10 — forked from BusyBLibrary/pmpro-register-helper-fields.php
Modified PMPro Register Helper Example with fields for school, county, job title, race, ethnicity, languages spoken, and gender.
<?php
/*
Plugin Name: Register Helper Example
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Register Helper Initialization Example
Version: .2
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
@andrewlimaza
andrewlimaza / index.js
Created August 15, 2018 12:26 — forked from MoOx/index.js
Export/import github labels
// go on you labels pages
// eg https://github.com/cssnext/cssnext/labels
// paste this script in your console
// copy the output and now you can import it using https://github.com/popomore/github-labels !
var labels = [];
[].slice.call(document.querySelectorAll(".label-link"))
.forEach(function(element) {
labels.push({
name: element.textContent.trim(),