Skip to content

Instantly share code, notes, and snippets.

Avatar

David Parker dparker1005

  • Stranger Studios
View GitHub Profile
@dparker1005
dparker1005 / custom_addon_package_prices.php
Last active Jan 12, 2021 — forked from strangerstudios/custom_addon_package_prices.php
Charge different prices for different membership levels with PMPro and PMPro Addon Packages.
View custom_addon_package_prices.php
<?php
// Copy from below here...
/*
* Charge different prices for different membership levels.
*/
//global var to store the price configurations
global $custom_addon_package_prices;
$custom_addon_package_prices = array(
@dparker1005
dparker1005 / remove-vp-pricing-discounut-code.php
Last active Sep 23, 2020 — forked from andrewlimaza/remove-vp-pricing-discounut-code.php
Remove variable pricing check and hide errors when discount code is applied.
View remove-vp-pricing-discounut-code.php
<?php
// Copy from below here...
/**
* Remove variable pricing check and hide errors when discount code is applied.
* Follow this guide to add this code snippet to your site - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* Visit www.paidmembershipspro.com for more information.
*/
@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_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 Mar 30, 2021 — 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 / one_time_trial_level.php
Last active Apr 21, 2020 — forked from strangerstudios/my_pmpro_after_change_membership_level.php
Only allow users to check out for a level one time.
View one_time_trial_level.php
<?php
/*
Only allow users to use the trial level once.
Add this code to your active theme's functions.php
or a custom plugin.
Be sure to change the $trial_level_id variable in multiple places.
*/
//record when users gain the trial level
function my_pmpro_one_time_trial_level($level_id, $user_id)
{
@dparker1005
dparker1005 / pmpro_cancel_on_next_payments_date.php
Last active Nov 26, 2019 — forked from strangerstudios/pmpro_cancel_on_next_payments_date.php
Change PMPro membership cancellation to set expiration date for next payment instead of cancelling immediately. In the process of updating to support MMPU.
View pmpro_cancel_on_next_payments_date.php
/*
Change cancellation to set expiration date for next payment instead of cancelling immediately.
Assumes orders are generated for each payment (i.e. your webhooks/etc are setup correctly).
Since 2015-09-21 and PMPro v1.8.5.6 contains code to look up next payment dates via Stripe and PayPal Express APIs.
*/
//before cancelling, save the next_payment_timestamp to a global for later use. (Requires PMPro 1.8.5.6 or higher.)
function my_pmpro_before_change_membership_level($level_id, $user_id) {
//are we on the cancel page?
@dparker1005
dparker1005 / require_discount_code.php
Last active Jun 9, 2020 — forked from femiyb/require_discount_code.php
Require discount code on checkout
View require_discount_code.php
<?php
// Copy from below here
/*
* Require that a user use a discount code when reigstering for specific levels.
*/
function my_pmpro_registration_checks_require_code_to_register( $pmpro_continue_registration ) {
$restricted_levels = array( 1, 3 ); // Levels 1 and 3 require a discount code to register
global $discount_code, $pmpro_level;