This file contains hidden or 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
| #make sure to change the 20 and 6 below to the ending and starting IDs of your levels respectively. | |
| UPDATE wp_pmpro_memberships_users SET membership_id = 20 WHERE membership_id = 6 AND STATUS = 'active'; |
This file contains hidden or 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
| // Avg downloads per customer | |
| function sc_edd_avg_downloads_per_customer( $atts ) { | |
| $amount = 0; | |
| $query = new WP_Query( array( 'post_type' => 'download' ) ); | |
| foreach( $query->posts as $post ) { | |
| $amount = $amount + edd_get_download_sales_stats( $post->ID ); | |
| } | |
| $amount = $amount / edd_count_total_customers(); | |
| return number_format( $amount, 2 ); | |
| } |
This file contains hidden or 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 | |
| /* | |
| Plugin Name: PMPro stop downgrade level | |
| Plugin URI: https://gist.github.com/1wdtv/a6d8a45979e4e217d212 | |
| Description: Prevent existing paid members from downgrading to free level (eg: when registering from a webinar). | |
| Version: 1 | |
| Author: 1WD.tv | |
| Author URI: https://1wd.tv | |
| */ | |
| /* |
This file contains hidden or 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
| /* | |
| Redirect away from the checkout page if you don't have a required level. | |
| */ | |
| function my_template_redirect_upgrade() | |
| { | |
| global $pmpro_pages, $pmpro_level; | |
| if(empty($pmpro_pages)) | |
| return; | |
This file contains hidden or 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
| /* | |
| Require a certain level before registering for another level. | |
| Add this code to your active theme's functions.php or | |
| a custom plugin. | |
| */ | |
| function my_pmpro_registration_checks($okay) | |
| { | |
| //only check if things are okay so far | |
| if($okay) | |
| { |
This file contains hidden or 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
| /* | |
| Run members list CSV export without logging in | |
| as long as you know the secret key. | |
| Important: Change the "secret key" below to something unique for your site. | |
| Add this code to your active theme's functions.php or a custom plugin. | |
| Set your cron to hit /wp-admin/admin-ajax.php?action=memberslist_csv_cron&secret={YOUR SECRET KEY} | |
| */ |
This file contains hidden or 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
| /* | |
| Add bcc for PMPro admin emails | |
| */ | |
| function my_pmpro_email_headers_admin_emails($headers, $email) | |
| { | |
| //bcc emails already going to admin_email | |
| if(strpos($email->template, "_admin") !== false) | |
| { | |
| //add bcc | |
| $headers[] = "Bcc:" . "otheremail@domain.com"; |
This file contains hidden or 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 code snippet can be added to your functions.php file (without the <?php) | |
| to add a query string to the login link emailed to the user upon registration | |
| which when clicked will validate the user, log them in, and direct them to | |
| the home page. | |
| */ | |
| /** | |
| * This first function is hooked to the 'user_register' action which fires |