Skip to content

Instantly share code, notes, and snippets.

View andrewlimaza's full-sized avatar

Andrew Lima andrewlimaza

View GitHub Profile
@dparker1005
dparker1005 / memberslist_billing_address.php
Created February 28, 2024 16:12
Add the "billing address" column back to the members list and CSV export.
<?php
/**
* Add the "billing address" column back to the members list and CSV export.
*
* Note: This will add the most recent billing address for the user and level
* by looking at the user's order history, not user meta.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
@dparker1005
dparker1005 / filter_pmpro_send_200_http_response.php
Created November 8, 2021 15:47
Disables the `pmpro_send_200_http_response()` function.
<?php
// Copy from below here...
/**
* Disables the `pmpro_send_200_http_response()` function.
*
* That function was implemented in PMPro v2.6.4 to allow IPN/webhook
* handlers to adknowledge the receipt of a webhook before processing
* it in order to avoid timeout issues at the gateway.
@sc0ttkclark
sc0ttkclark / pmpro-disable-email-html-cleanup.php
Last active January 31, 2022 18:07
This recipe will disable the HTML removal from email templates when using unsupported tags.
<?php // do not copy this line.
/**
* This recipe will disable the HTML removal from email templates when using unsupported tags.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
@dparker1005
dparker1005 / pmpro_csv_export_add_views_column.php
Created May 5, 2020 16:01
Adds content from Visits, Views, and Logins report to Member List to CSV export.
<?php
// Copy from below here...
/*
* Adds content from Visits, Views, and Logins report to Member List to CSV export.
*
* Here is where all the columns in the Visits, Views, and Logins report are filled
* in case you would like to customize this Gist:
* https://github.com/strangerstudios/paid-memberships-pro/blob/c3129bfce929bb4f5e7dd03f5efd74c209a5530e/adminpages/reports/login.php#L215-L252
@ideadude
ideadude / my_sync_stripe_events.php
Created March 13, 2020 17:43
Synchronize Stripe invoice.payment_succeeded Events in PMPro.
/**
* Synchronize Stripe invoice.payment_succeeded Events
* Warning. This code will update your database,
* create new orders, and potentially email your customers.
* Proceed with caution. Back up your database.
* You will likely want to pair this script with a plugin
* or script to disable all email.
* The default limit is 200 events. You may need to increase this
* or update the script to paginate and run events in batches.
* The default delay between event calls is 2 seconds.
@ideadude
ideadude / my_pmpro_forward_ipn.php
Created May 4, 2019 15:53
Forward PMPro PayPal IPNs to another domain
/**
* Forward PMPro PayPal IPNs to another domain.
* Each domain will process the IPNs. The IPN handlers should be setup to ignore
* messages that aren't for that site. PMPro does this.
* This is useful if you have 2 different sites using the same PayPal account
* and the IPN is setup to go to a PMPro site.
* Add this to a custom plugin on the PMPro site the IPN hits.
* Update the domain/url to the IPN you want to forward to.
* The pmprodev_gateway_debug_setup check makes sure this DOESN'T run if you have the
* PMPro Toolkit plugin enabled, i.e. you are on a staging site.
@messica
messica / my_pmpro_applydiscountcode_return_js.php
Last active March 25, 2022 16:00
Display original price and discount when a discount code is applied.
<?php
/**
* Display messages of the Original Price, Discounted Price and Amount Saved when discount code is applied to PMPro order.
* Add this code recipe to a PMPro Customization Plugin - Display messages of the Original Price, Discounted Price and Amount Saved when discount code is applied to PMPro order
* Various classes added to strings to allow for styling - ".pmpro-discorig-message", ".pmpro-orginal-price", ".pmpro-discount-price", ".pmpro-save-price"
*
* [my_pmpro_applydiscountcode_return_js] Display original price and discount when a discount code is applied.
* @param string $discount_code [description]
* @param integer $discount_code_id [description]
@ideadude
ideadude / init_create_my_administrator_user.php
Created February 13, 2018 17:23
Create a WordPress administrator user account via PHP/FTP.
<?php
/*
Sometimes you have FTP access to a site, but don't have a WP administrator account.
You can use this code to create one.
1. Add this code into any plugin or theme file that you know will be run.
2. Visit /?createmyadministratoruser=1.
3. Delete the code you added.
*/
function init_create_my_administrator_user() {
@ideadude
ideadude / my_pmpro_orders_read_only_fields.php
Created December 26, 2017 17:34
make all fields (including transaction ids) editable on the orders page in the PMPro dashboard
/*
Make all fields (including transaction ids) editable on the orders page in the PMPro dashboard.
Add this code to a custom plugin.
*/
function my_pmpro_orders_read_only_fields($fields)
{
return array();
}
add_filter('pmpro_orders_read_only_fields', 'my_pmpro_orders_read_only_fields');
@barbietunnie
barbietunnie / stop-mac-apache.sh
Created February 25, 2017 22:42
Stop Default Apache server running on Mac OS Sierra
sudo apachectl stop
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null