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) | |
{ | |
$approval_admin = array( "admin_approved", "admin_denied", "admin_notification" ); | |
//bcc emails already going to admin_email | |
if( strpos($email->template, "_admin") !== false || in_array($email->template, $approval_admin) ) | |
{ |
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 | |
/* | |
Changes Report for Paid Memberships Pro | |
Title: pmpro_reports_changes | |
Slug: pmpro_reports_changes | |
*/ | |
//update this array for your desired reports. the format is: "report name" => array( initial_level_id, current_level_id ), | |
global $pmpro_reports_level_changes; | |
$pmpro_reports_level_changes = array( | |
"Members upgrading from Level 1 to 2" => array( 1, 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
/* | |
Restrict membership access based on parent category | |
*/ | |
function category_restrictions($hasaccess, $mypost, $myuser, $post_membership_levels) | |
{ | |
global $post, $current_user; | |
$categories = wp_get_post_categories($mypost->ID); | |
$restrict = false; |
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 checks to see if the user has a 'pending' check order and will deny access whever member content is called. | |
* Add this code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function pmpro_deny_if_user_is_pending( $hasaccess, $post, $user, $levels ) { | |
$order = new MemberOrder(); | |
$order->getLastMemberOrder( $user->ID, array( 'pending', '', 'check' ) ); |
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 | |
/** | |
* Make PMPro MailChimp compatible with PMPro Email Confirmation | |
*/ | |
// Don't subscribe to MailChimp if user is not validated. | |
function my_pmproec_pmpro_after_change_membership_level($level_id, $user_id) { | |
if( function_exists('pmproec_isEmailConfirmationLevel') && pmproec_isEmailConfirmationLevel($level_id) ) { | |
$validation_key = get_user_meta($user_id, "pmpro_email_confirmation_key", true); |
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
function my_custom_memberslist_order($sqlQuery) | |
{ | |
echo "<a href=".admin_url('admin.php?page=pmpro-memberslist&enddate_sort=asc').">Sort by Enddate ASC</a><br>". | |
"<a href=".admin_url('admin.php?page=pmpro-memberslist&enddate_sort=desc').">Sort by Enddate DESC</a>"; | |
if(isset($_REQUEST['enddate_sort']) && ($_REQUEST['enddate_sort'] == 'asc' || $_REQUEST['enddate_sort'] == 'desc')) | |
{ | |
$sort_order = $_REQUEST['enddate_sort']; | |
global $wpdb; |
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 assumes you already have a 'myrole' custom role created. | |
Members signing up get the 'myrole' role in addition to any other roles they already have. | |
Members cancelling are given the subscriber role. | |
Admin users are ignored. | |
Usable with or without the PMPro Roles Add On. | |
*/ | |
function my_pmpro_after_change_membership_level($level_id, $user_id) | |
{ |
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 WP User Avatar from Register Helper field during checkout. | |
*/ | |
function my_updated_user_meta($meta_id, $user_id, $meta_key, $meta_value) { | |
// Change user_avatar to your Register Helper file upload name. | |
if( 'user_avatar' == $meta_key) { | |
$filename = $meta_value['fullpath']; | |
$filetype = wp_check_filetype( basename( $filename ), null ); | |
$wp_upload_dir = wp_upload_dir(); | |
$attachment = array( |
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
function my_pmpro_after_change_membership_level_default_level($level_id, $user_id) | |
{ | |
//set this to the id of the level you want to give members when they cancel | |
$cancel_level_id = 1; | |
//if we see this global set, then another gist is planning to give the user their level back | |
global $pmpro_next_payment_timestamp; | |
if(!empty($pmpro_next_payment_timestamp)) | |
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
<?php | |
/** | |
* Change subject line of Checkout email based on membership level. | |
* | |
* @param string $subject The email's subject is a string of text that you can adjust here as you see fit or pull from another custom function. | |
* @param object $email This is the php object from which we extracting the appropriate level and to which we'll add the new email content. | |
* @return string Whichever condition applies in the function below will determine what string is supplied to the email object. If none of the conditions are met, the return string will be the original message subject. | |
*/ | |
function pmpro_adjust_email_subject_to_level_checkout( $subject, $email ) { |
NewerOlder