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 | |
/* Enter Your Custom Functions Here */ | |
function mepr_autoembed_thankyou_message($message) { | |
global $wp_embed; | |
if(!class_exists('MeprTransaction')) { return $message; } | |
if(!isset($_REQUEST['trans_num'])) { return $message; } | |
$txn = new MeprTransaction(); |
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 | |
//hooks in to MemberPress $args array before sending new subscriber info to MailChimp | |
function mepr_add_my_tags($args, $member) { | |
$zip = get_user_meta($member->ID, 'mepr-address-zip', true); | |
$country = get_user_meta($member->ID, 'mepr-address-country', true); | |
if($zip) { | |
$args['merge_fields']['MMERGE6'] = $zip; //YOU'LL NEED TO CHANGE MMERGEX TO MAP THEM TO YOUR OWN TAG VALUES | |
} | |
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 | |
/* Enter Your Custom Functions Here */ | |
function get_the_pretty_link($post_id) { | |
global $plp_options, $prli_blogurl, $prli_link; | |
$post = get_post($post_id); | |
if(!($plp_options->autocreate_option($post->post_type))) { return false; } | |
$pretty_link_id = PrliUtils::get_prli_post_meta($post->ID, "_pretty-link", true); |
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 mepr_override_protection($protect, $post) { | |
$user = MeprUtils::get_currentuserinfo(); | |
if($user === false) { return $protect; } | |
//Set the registration date back one month, to ensure they have access to current issue. | |
$registration_date = strtotime(MeprUser::get_user_registration_date($user->ID)) - MeprUtils::months(1); | |
$post_date = strtotime($post->post_date); | |
$active_product_subscriptions = $user->active_product_subscriptions(); |
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 | |
//PASTE THIS CODE IN A PLUGIN LIKE My Custom Functions (RECOMMENDED) OR IN YOUR THEME'S functions.php FILE | |
//THIS ASSUMES YOU HAVE THE GOOGLE ANALYTICS JAVASCRIPT INCLUDED ALREADY | |
function echo_ga_tracking_script() { | |
if(isset($_GET['membership']) && isset($_GET['trans_num'])) { | |
$txn = MeprTransaction::get_one_by_trans_num($_GET['trans_num']); | |
if(isset($txn->id) && $txn->id > 0) { | |
//Echo the script to the HTML <head> | |
?> |
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 cspf_custom_cancel_link($html, $sub) { | |
ob_start(); | |
?> | |
<a href="?action=upsell&sub=<?php echo $sub->id; ?>">Cancel</a> | |
<?php | |
return ob_get_clean(); | |
} | |
add_action('mepr_custom_cancel_link', 'cspf_custom_cancel_link', 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 | |
/* | |
* This only works if the Affiliate Royale plugin | |
* is set to NOT create affiliates from new users automatically | |
*/ | |
function make_new_user_affiliate($txn) { | |
//CHANGE THIS ARRAY TO THE IDS OF THE MEMBERSHIPS YOU WANT TO AUTO CREATE AFFS WITH | |
$membership_ids_for_affs = array(123,321,789); | |
if(in_array($txn->product_id, $membership_ids_for_affs, false) && class_exists('WafpUser')) { |
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 | |
//The following code could be pasted into a plugin like My Custom Functions | |
function display_validate_email_field() { | |
?> | |
<div class="mp-form-row mepr_validate_email"> | |
<div class="mp-form-label"> | |
<label><?php _ex('Verify Email:*', 'ui', 'memberpress'); ?></label> | |
<span class="cc-error"><?php _ex('Invalid Email', 'ui', 'memberpress'); ?></span> | |
</div> | |
<input type="email" name="user_validate_email" id="user_validate_email" class="mepr-form-input" value="" required /> |
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 | |
//Sets up a trial period on MemberPress such that ALL users renew on March 31st. | |
function mepr_days_until($date){ | |
return (isset($date)) ? floor((strtotime($date) - time())/60/60/24) : false; | |
} | |
function mepr_update_mepr_trial_period() { | |
$prd = new MeprProduct(123); //CHANGE 123 to the ID of your Membership level | |
$last_check = get_option('mepr_trial_period_last_checked-'.$prd->ID, 0); |