Skip to content

Instantly share code, notes, and snippets.

View dparker1005's full-sized avatar

David Parker dparker1005

  • Stranger Studios
View GitHub Profile
@dparker1005
dparker1005 / my_pmpro_require_email_confirmation_for_checkout.php
Created June 8, 2021 15:37
Require user to confirm there email address before checking out for specific levels.
<?php
/*
* Require user to confirm there email address before checking out for specific levels.
* Can build a free level requiring email confirmation for users to sign up for before the "real" levels.
*
* 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_convert_currency.php
Last active June 5, 2021 13:12
Automatically updates the cost of a membership level to be the local currency amount equivalent to a defined price in a different currency.
<?php
// Copy from below here...
/**
* Automatically updates the cost of a membership level to be the local currency amount
* equivalent to a defined price in a different currency.
*
* For example, the default setup below will get the conversion rate from USD to ZAR
* every day and use that information to set the membership price for level ID 5
@dparker1005
dparker1005 / my_pmproza_change_level.php
Last active October 4, 2023 09:54
Modify memberships that are given to users via Zapier. As written, this will change the billing amount shown to $10/year.
<?php
// Copy from below here...
/**
* Modify memberships that are given to users via Zapier.
* As written, this will change the billing amount shown to $10/year.
*
* 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 / redirect_from_checkout_and_cancel.php
Created June 1, 2021 20:51
Prevent users from cancelling their membership or checking out for a new one.
<?php
// Copy from below here...
/**
* Prevent users from cancelling their membership or checking out for a new one.
*/
function my_pmpro_redirect_from_checkout_and_cancel() {
global $pmpro_pages;
@dparker1005
dparker1005 / my_pmpro_stripe_params_send_user_id.php
Created May 10, 2021 15:30
Send user ID to Stripe as metadata.
<?php
// Copy from below here...
/**
* Send user ID to Stripe as metadata.
*
* 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.
@dparker1005
dparker1005 / my_custom_get_price_parts.php
Last active August 11, 2023 10:56
Example of how to use pmpro_get_price_parts filter alongside PMPro Donations with custom "extras" included in price.
<?php
// Copy from below here...
/**
* Example of how to use pmpro_get_price_parts filter alongside PMPro Donations
* with custom "extras" included in price.
*
* 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 / redirect_confirmation_to_member_homepage.php
Last active April 27, 2021 16:47
Redirects users from the PMPro confirmation page to their membership level's homepage.
<?php
// Copy from below here...
/**
* Redirects users from the PMPro confirmation page to their membership level's homepage.
*
* 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.
@dparker1005
dparker1005 / mailchimp_next_payment_date.php
Last active April 23, 2021 14:38
Send users' next payment date to Mailchimp.
<?php
// Copy from below here...
/**
* Send users' next payment date to Mailchimp.
*
* 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.
@dparker1005
dparker1005 / my_pmpro_send_expiration_warning_email_level_filter.php
Created April 13, 2021 15:09
Set specific levels to send expiration warning emails to.
<?php
// Copy from below here...
/**
* Set specific levels to send expiration warning emails to.
*
* 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.
@dparker1005
dparker1005 / expiry_log.php
Last active April 18, 2022 18:13
Creates a log at /paid-memberships-pro/logs/level-change.txt for whenever a membership is expired.
<?php
// Copy from below here...
/*
* Creates a log at /paid-memberships-pro/logs/level-change.txt for whenever a
* membership is expired.
*/
function my_pmpro_pre_membership_expiry_log( $user_id, $membership_id ) {
global $wpdb;