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
SET @membership_id = 10379; | |
SELECT um_first_name.meta_value AS first_name, | |
um_last_name.meta_value AS last_name, | |
u.user_email AS email, | |
l.lifetime_count, | |
t.expires_at AS expires_at | |
FROM wp_users AS u | |
LEFT JOIN wp_usermeta AS um_first_name | |
ON um_first_name.user_id = u.ID | |
AND um_first_name.meta_key = 'first_name' |
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 get_expired_subscription_urls_for_current_user() { | |
$expired_subscription_urls = array(); | |
if(MeprUtils::is_user_logged_in()) { | |
$current_user = MeprUtils::get_currentuserinfo(); | |
$all_subscriptions = $current_user->active_product_subscriptions('transactions', true, false); | |
if(!empty($all_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 | |
require './wp-load.php'; // only necessary if you run this script on the command line | |
$membership_id = 8888; // Change this to whatever your membership_id is | |
$m = new MeprProduct($membership_id); | |
$subscription_table = 'wp_mepr_subscriptions'; // change this to whatever your subscriptions table is named | |
$q = $wpdb->prepare(" | |
SELECT s.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
<?php | |
$current_user = wp_get_current_user(); | |
// Returns results from $wpdb->get_results ... not an array of MPCA_Corporate_Account objects | |
$corporate_accounts = MPCA_Corporate_Account::get_all_by_user_id($current_user->ID); | |
foreach($corporate_accounts as $ca_row) { | |
// Create blank MPCA_Corporate_Account object | |
$ca_obj = new MPCA_Corporate_Account(); |
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 | |
$user_id = 123; | |
$user = new MeprUser($user_id); | |
$reset_password_url = $user->reset_password_link(); | |
echo "<a href=\"{$reset_password_url}\">Create a New Password</a>"; |
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 style="font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif; padding: 20px; position: relative; text-align: center; background-color: #efefef;"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html;UTF-8" /> | |
</head> | |
<body style="background-color: #efefef;"> | |
<div id="header-pad" style="width: 680px; height: 5px; padding 0; margin: 0 auto; text-align: left;"> | |
</div> | |
<?php echo $body; ?> | |
<div id="footer-pad" style="width: 680px; height: 50px; padding 0; margin: 0 auto; text-align: left;"> | |
</div> |
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 | |
/** Creates a pretty link from a target url. Returns a pretty link url on success and false on failure. | |
* Assumes that Pretty Link is installed on your WordPress website. | |
*/ | |
function create_my_pretty_link($target_url) { | |
if( false != ( $link_id = prli_create_pretty_link($target_url) ) ) { | |
return prli_get_pretty_link_url($link_id); | |
} | |
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
<?php | |
/* This will alter the subscription so that the trial days will changed based on the date | |
* - it only works if a trial is enabled on the product/membership for the subscription | |
* but it will alter the number of days in the trial. | |
*/ | |
$my_product_id = 4519; | |
$fixed_date = strtotime('2017-12-03 00:00:00'); | |
add_filter('mepr-set-model-attribute-trial_days', 'override_trial_days'); | |
function override_trial_days($value, $obj) { |
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
<h3>Active Subscriptions</h3> | |
<ul> | |
<?php | |
if($user = MeprUtils::get_currentuserinfo()) { | |
$active_products = $user->active_product_subscriptions('products'); | |
foreach($active_products as $active_product) { | |
?> | |
<li><?php echo $active_product->post_title; ?></li> | |
<?php |
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 | |
$mpdb = new MeprDb(); | |
$count = $mpdb->get_count($mpdb->transactions, array( | |
'user_id'=>$txn->user_id, | |
'product_id'=>$txn->product_id, | |
'status'=>'complete')); |
NewerOlder