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 | |
/* | |
* 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(); |
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
/* | |
Change expiration text on levels page. | |
*/ | |
function pmprosed_my_pmpro_level_expiration_text($expiration_text, $level) | |
{ | |
$set_expiration_date = pmpro_getSetExpirationDate($level->id); | |
if (!empty($set_expiration_date)) { | |
$set_expiration_date = pmprosed_fixDate($set_expiration_date); | |
$expiration_text = "This membership level will expire on " . date(get_option('date_format'), strtotime($set_expiration_date, current_time('timestamp'))) . "."; | |
} |
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 | |
function replace_pmpro_directory_search($sqlQuery, $levels, $s, $pn, $limit, $start, $end, $order_by, $order) { | |
global $wpdb; | |
if($s) | |
{ | |
$sqlQuery = "SELECT SQL_CALC_FOUND_ROWS u.ID, u.user_login, u.user_email, u.user_nicename, u.display_name, UNIX_TIMESTAMP(u.user_registered) as joindate, mu.membership_id, mu.initial_payment, mu.billing_amount, mu.cycle_period, mu.cycle_number, mu.billing_limit, mu.trial_amount, mu.trial_limit, UNIX_TIMESTAMP(mu.startdate) as startdate, UNIX_TIMESTAMP(mu.enddate) as enddate, m.name as membership, umf.meta_value as first_name, uml.meta_value as last_name FROM $wpdb->users u LEFT JOIN $wpdb->usermeta umh ON umh.meta_key = 'pmpromd_hide_directory' AND u.ID = umh.user_id LEFT JOIN $wpdb->usermeta umf ON umf.meta_key = 'first_name' AND u.ID = umf.user_id LEFT JOIN $wpdb->usermeta uml ON uml.meta_key = 'last_name' AND u.ID = uml.user_id LEFT JOIN $wpdb->usermeta um ON u.ID = um.user_id LEFT JOIN $wpdb->pmpro_memberships_users mu ON u.ID = mu.user_id LEFT JOIN $wpdb->p |
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 example is to show you the 'niche' options each Paid Memberships Pro - Register Helper Add-on field can take and how to use it. | |
* For more information on the Register Helper Add-on please visit https://www.paidmembershipspro.com/add-ons/free-add-ons/pmpro-register-helper-add-checkout-and-profile-fields/ | |
**/ | |
function my_pmprorh_init() | |
{ | |
//don't break if Register Helper is not loaded |
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 | |
//forward all admin emails | |
function my_pmpro_forward_member_emails($recipient, $email) | |
{ | |
if(strpos($email->template, '_admin')) | |
$recipient = 'email@example.com'; | |
return $recipient; | |
} | |
add_filter("pmpro_email_recipient", "my_pmpro_forward_member_emails", 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 | |
/* | |
Shortcode to show membership account information | |
*/ | |
function pmpro_shortcode_account($atts, $content=null, $code="") | |
{ | |
global $wpdb, $pmpro_msg, $pmpro_msgt, $pmpro_levels, $current_user, $levels; | |
// $atts ::= array of attributes | |
// $content ::= text within enclosing form of shortcode element |
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 code recipe will remove the billing address fields from certain membership levels. | |
* This code gist requires the Paid Memberships Pro - Capture Name & Address for Free Levels or for Off-site Gateways Add On to be installed and activated - https://www.paidmembershipspro.com/add-ons/capture-name-address-free-levels-offsite-gateway/ | |
* Change the value "2" in the code recipe with the Paid Memberships Pro Membership Level ID of your choice. | |
* Add this code below into your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function remove_pmpro_billing_fields_by_level_id() { | |
// Specify the Membership Level ID | |
$remove_level = isset( $_REQUEST['level'] ) ? $_REQUEST['level'] : ''; |
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
/* | |
* Add 15 day grace period when membership expires | |
*/ | |
function my_pmpro_membership_post_membership_expiry( $user_id, $level_id ) { | |
// Make sure we aren't already in a grace period for this level | |
$grace_level = get_user_meta( $user_id, 'grace_level', true ); | |
if ( empty( $grace_level ) || $grace_level !== $level_id ) { | |
// Give them their level back with 15 day expiration | |
$grace_level = array(1,2); | |
$grace_level['user_id'] = $user_id; |
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
/** | |
* Allow customers to access wp-admin | |
*/ | |
add_filter( 'woocommerce_prevent_admin_access', '__return_false' ); | |
add_filter( 'woocommerce_disable_admin_bar', '__return_false' ); |
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
<html> | |
PMPro Free (<a href="http://pmpro.local/wp-admin/admin.php?page=pmpro-approvals&s=user06%40pmpro.local">Pending</a>) | |
</html> | |
<p>Menu</p> | |
<nav> | |
<ul> | |
<p>Menu</p> |