This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // do not copy to Customizations plugin | |
/** | |
* After expiration, assign them a specific "cancelled" level. | |
* | |
* Can be used to downgrade someone to a free level when they cancel. | |
* Will allow members to the "cancel level" to cancel from that though. | |
*/ | |
function pmpro_upon_expiration_change_membership_levels( $level_id, $user_id ) { | |
// set this to the id of the original level | |
$last_level_2 = 2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* When users cancel (are changed to membership level 0) we give them another "cancelled" level. | |
* Can be used to downgrade someone to a free level when they cancel. | |
* Will allow members to the "cancel level" to cancel from that though. | |
*/ | |
function pmpro_after_expiration_change_membership_levels( $level_id, $user_id ) { | |
// set this to the id of the level you want to give members when they cancel | |
$last_level_3 = 3; | |
$last_level_8 = 8; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This requires billing fields to be enabled at checkout. | |
* Generate a username from firstname and lastname fields. If name exists will try to generate a random number after the username. | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_generate_username_at_checkout() { | |
//check for level as well to make sure we're on checkout page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Edit the Signup Shortcode password that is generated and emailed to the customer. | |
* Add this code to your site by following this guide: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
remove_filter('pmpro_email_data', 'pmprosus_pmpro_email_data', 10, 2); | |
function pmprosus_pmpro_email_data_edit($data, $email) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This recipe will add billing fields to the checkout. Useful for payment gateways | |
* that don't have the option to display billing fields. | |
* | |
* 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/ | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
When users cancel (are changed to membership level 0) who previously belonged to | |
level 2 are given level 1 with expiration date of one year. | |
*/ | |
function my_pmpro_after_change_membership_level($level_id, $user_id) | |
{ | |
$levelshistory = $wpdb->get_results("SELECT * FROM $wpdb->pmpro_memberships_users WHERE user_id = '$current_user->ID' ORDER BY id DESC"); | |
if($levelshistory && $levelshistory[0]->membership_id == 2 && $level_id == 0) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Remove Custom fields from Confirmation Email | |
* Add code to your site following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function pmpro_remove_rhfields_confirmation_email(){ | |
if ( has_filter( 'pmpro_email_filter', 'pmprorh_pmpro_email_filter' ) ) { | |
remove_filter( 'pmpro_email_filter', 'pmprorh_pmpro_email_filter', 10, 2 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Hide Auto-Renewal Checkbox for Check payment | |
*/ | |
function my_pmpropbc_enqueue_scripts() { | |
global $pmpro_pages; | |
if(is_page($pmpro_pages['checkout'])) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Once a user checks out for a level, it will add usermeta to the user's account. | |
* This will then remove any subscription delay for that member in the future, even if the user cancels and then re-signs up. | |
*/ | |
// Update level meta everytime a user changes their level to ensure they are blocked from subscription delays. | |
function my_pmpro_trial_used( $level_id, $user_id ) { | |
update_user_meta( $user_id, "pmpro_trial_level_used", "1" ); // Assume the user has any level. | |
} |