Skip to content

Instantly share code, notes, and snippets.

Avatar

David Parker dparker1005

View GitHub Profile
@dparker1005
dparker1005 / checkout_levels_api_demo.php
Created Aug 10, 2020
2 demos to demonstrate the PMPro checkout_levels API call.
View checkout_levels_api_demo.php
<?php
// Copy from below here...
/*
* Add widget to checkout to get result of checkout_levels API call when button is pressed.
*/
function my_pmpro_test_checkout_levels_api() {
?>
<hr/>
@dparker1005
dparker1005 / pmpro_email_data_edit_user.php
Created Aug 10, 2020
Adds variable !!edit_user!! to email templates to link to edit user page.
View pmpro_email_data_edit_user.php
<?php
// Copy from below here...
/*
* Adds variable !!edit_user!! to email templates to link to edit user page.
*/
function my_pmpro_email_data_add_edit_user($data, $email) {
$user = get_user_by( 'email', $data['user_email'] );
$edit_user_page = 'http://yoursite.com/wp-admin/user-edit.php?user_id=' . $user->ID;
@dparker1005
dparker1005 / my_pmproz_after_checkout_data.php
Created Aug 7, 2020
Send extra fields to Zapier after PMPro checkout.
View my_pmproz_after_checkout_data.php
<?php
// Copy from below here...
/*
* Send extra fields to Zapier after PMPro checkout.
*/
function my_pmproz_after_checkout_data( $data, $user_id ) {
// Assuming 'first_name' and 'last_name' are fields on your PMPro checkout page.
if ( ! empty( $_REQUEST['first_name'] ) ) {
@dparker1005
dparker1005 / disable-reporting-pmpro.php
Last active Aug 5, 2020 — forked from andrewlimaza/disable-reporting-pmpro.php
Disable Reporting For Paid Memberships Pro
View disable-reporting-pmpro.php
<?php
/**
* Remove tracking for Paid Memberships Pro on high traffic sites.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_disable_reporting() {
remove_action("wp", "pmpro_report_login_wp_visits"); // Visits
remove_action("wp_head", "pmpro_report_login_wp_views"); // Views
remove_action("wp_login", "pmpro_report_login_wp_login", 10 ,2); // Logins
}
@dparker1005
dparker1005 / my_pmpro_payfast_fix_warning.php
Created Aug 3, 2020
Fix PMPro Payfast showing SSL error in admin menus when set up correctly.
View my_pmpro_payfast_fix_warning.php
<?php
// Copy from below here...
/*
* Fix PMPro Payfast showing SSL error in admin menus
* when set up correctly.
*/
function my_pmpro_payfast_fix_warning( $pmpro_is_ready ) {
global $pmpro_gateway_ready, $pmpro_pages_ready;
@dparker1005
dparker1005 / my_pmpro_fix_wpelogin.php
Last active Jul 29, 2020 — forked from ideadude/my_fix_wpelogin.php
Fix password reset behavior when using PMPro login page on WP Engine hosting.
View my_pmpro_fix_wpelogin.php
<?php
// Copy from below here...
/*
* In addition to adding this code to your site, note that
* WP Engine also has aggressive caching that your login page
* should be excluded from, especially if you experience issues
* with your login page.
* https://wpengine.com/support/cache/#Cache_Exclusions
@dparker1005
dparker1005 / pmpro-sponsored-member-message-shortcode.php
Last active Jul 28, 2020 — forked from greathmaster/pmpro-sponsored-member-message-shortcode.php
Creates a PMPro email shortcode for the sponsored members message to use for greater control over location of message. Use !!sponsored_message!! in email checkout body to display. Removes the automatic insertion of message at the top of the email.
View pmpro-sponsored-member-message-shortcode.php
<?php
/*
* Creates a PMPro email shortcode for the sponsored members message to use for greater control over location of message.
* Use !!sponsored_message!! in email checkout body to display.
* Removes the automatic insertion of message at the top of the email.
*/
function my_sponsored_email_shortcode($pmpro_email)
{
global $wpdb, $pmprosm_sponsored_account_levels;
@dparker1005
dparker1005 / active_users_on_date.sql
Last active Jul 28, 2020
Get the users who were active on a specific date (as written, June 1st 2020)
View active_users_on_date.sql
SELECT distinct mu.user_id, u.user_email FROM wp_pmpro_memberships_users AS mu
LEFT JOIN wp_users AS u
ON mu.user_id = u.id
WHERE mu.startdate < "2020-06-01 23:59:59"
AND ( mu.enddate > "2020-06-01 00:00:00" OR mu.enddate = "0000-00-00 00:00:00" OR mu.enddate is NULL )
ORDER BY mu.user_id
@dparker1005
dparker1005 / pmpro_mailchimp_merge_fields.php
Created Jul 24, 2020
Creates a new merge field in Mailchimp if one doesn't already exist.
View pmpro_mailchimp_merge_fields.php
<?php
// Copy from below here...
/*
* Creates a new merge field in Mailchimp if one doesn't already exist.
*/
function my_pmpro_mailchimp_merge_fields( $merge_fields ) {
// Adds a "COMPANY" merge field to Mailchimp.
$merge_fields[] = array('name' => 'COMPANY', 'type' => 'text');
@dparker1005
dparker1005 / pmproarc_update_checkbox_label.php
Last active Jul 24, 2020
Update PMPro Auto-Renewal Checkbox based on payment plan chosen (levels method).
View pmproarc_update_checkbox_label.php
<?php
// Copy from below here...
/*
* Update PMPro Auto-Renewal Checkbox based on payment plan chosen (levels method).
*/
function my_pmproarc_update_checkbox_label() {
?>
<script>
You can’t perform that action at this time.