Skip to content

Instantly share code, notes, and snippets.

@afragen
Created July 13, 2013 20:22
Show Gist options
  • Save afragen/5992086 to your computer and use it in GitHub Desktop.
Save afragen/5992086 to your computer and use it in GitHub Desktop.
This is a simple plugin by Mike Walsh (mpwalsh8) to set custom meta filters for the Email Users plugin.
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
/**
* @package Email-Users-Custom-List
* @version 1.3
*/
/*
Plugin Name: Email Users Custom List
Plugin URI: http://michaelwalsh.org/wordpress/wordpress-plugins/email-users-custom-list/
Description: This plugin shows how a custom meta filter can be used in conjunction with the Email Users plugin to address a Custom List of Users.
Author: Mike Walsh
Version: 1.3
Author URI: http://michaelwalsh.org/
*/
//add_action( 'mailusers_user_custom_meta_filter', 'first_names_starting_with_d', 5 );
function first_names_starting_with_d()
{
mailusers_register_user_custom_meta_filter('First Name: Not D', 'first_name', 'D%', 'NOT LIKE');
}
//add_action( 'mailusers_user_custom_meta_filter', 'last_names_starting_with_m', 5 );
function last_names_starting_with_m()
{
mailusers_register_user_custom_meta_filter('Last Name: M', 'last_name', 'M%', 'LIKE');
}
//add_action( 'mailusers_user_custom_meta_filter', 'first_name_alex', 5 );
function first_name_alex()
{
mailusers_register_user_custom_meta_filter('First Name: Alex', 'first_name', 'Alex');
}
//add_action( 'mailusers_user_custom_meta_filter', 'mail_wendy_matt', 5 );
function mail_wendy_matt()
{
mailusers_register_user_custom_meta_filter('Last Name: Matt', 'last_name', 'Matt');
}
//add_action( 'mailusers_group_custom_meta_filter', 'send_to_fire_department', 5 );
function send_to_fire_department()
{
mailusers_register_group_custom_meta_filter('Fire Department', 'department', 'fire');
}
//add_action( 'mailusers_group_custom_meta_filter', 'send_to_police_department', 5 );
function send_to_police_department()
{
mailusers_register_group_custom_meta_filter('Police Department', 'department', 'police');
}
add_action( 'mailusers_group_custom_meta_key_filter', 'send_to_departments', 5 );
function send_to_departments() {
mailusers_register_group_custom_meta_key_filter('department', null, 'send_to_departments_label');
}
function send_to_departments_label($mk, $mv) {
return(ucwords($mk) . ' = ' . ucwords($mv)) ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment