Skip to content

Instantly share code, notes, and snippets.

@JudeRosario
Created February 5, 2015 10:46
Show Gist options
  • Save JudeRosario/055ead68c1856fd109cb to your computer and use it in GitHub Desktop.
Save JudeRosario/055ead68c1856fd109cb to your computer and use it in GitHub Desktop.
Membership Force Communications
function emergency_mail_send()
{
global $wpdb;
$expiring_users = $wpdb->get_results("
SELECT `ID` , `sub_id` , `level_id`, `user_email` , `user_login` , `display_name`
FROM `wp_m_membership_relationships`
INNER JOIN `wp_users` ON wp_m_membership_relationships.user_id = wp_users.ID
WHERE `expirydate`
BETWEEN '2015-01-30 23:59:59'
AND '2015-02-01 23:59:59'");
foreach ($expiring_users as $user) {
$comm = new M_Communication(3);
$comm->send_message( $user->ID, $user->sub_id, $user->level_id);
}
return ;
}
add_action('activated_plugin','save_error');
function save_error(){
update_option('plugin_error', ob_get_contents());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment