Title: A clean-lean plugin
Last modified: September 2, 2016

---

# A clean-lean plugin

 *  [dmenne](https://wordpress.org/support/users/dmenne/)
 * (@dmenne)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/a-clean-lean-plugin/)
 * This plugin is the right tool if you have special requirements to send email 
   to dynamically defined user groups. It needs some php-fiddling to get it working,
   but definitively much less than what the dinosaurs require.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Mike Walsh](https://wordpress.org/support/users/mpwalsh8/)
 * (@mpwalsh8)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/a-clean-lean-plugin/#post-7861746)
 * I am curious – what PHP did you have to change to get it working?
 *  Thread Starter [dmenne](https://wordpress.org/support/users/dmenne/)
 * (@dmenne)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/a-clean-lean-plugin/#post-7861747)
 * What php-fiddling:
    Sorry, I was not clear; no changes in core code, we just 
   had a series of “business-rules” (“strings” are persons playing viola or violin
   who have a status of “Aktiv”), and I added some filters following your example.
 * It would be nice to have an example with multiple keys, I could not yet get the
   following concept to work (but will, for sure).
    But maybe it’s anyway better
   to have these in some cron-controled function.
 *     ```
       $args = array(
       			'meta_query' => array(
       				0 => array(
       			     'key' => $searchkey,
       			     'value' => $val[$searchkey],
       				 'compare' => '='
       			    ),
       				1 => array(
       				 'key'   => 'status',
       				 'value' => 'Aktiv',
       				 'compare' => '='
       		)));
               $uq = new WP_User_Query($args) ;
       ```
   
 *  Thread Starter [dmenne](https://wordpress.org/support/users/dmenne/)
 * (@dmenne)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/a-clean-lean-plugin/#post-7861753)
 * Just in case someone should need it:
 *     ```
       function send_to_streicher()
       {
           mailusers_register_group_custom_meta_filter('Aktive Streicher', 'streicher',1,"=");
       }
   
       function update_active_strings_meta_filter(){
         $newkey = 'streicher' ;
         $searchkey = 'instrument';
         $searchvalues = array(
               'Kontrabass','Cello','Violine I','Violine II','Viola'
          ) ;
         update_active_register_meta_filter($searchkey,$searchvalues,$newkey);
       }
   
       function update_active_register_meta_filter($searchkey,$searchvalues,$newkey)
       {
           $uq = new WP_User_Query(array('meta_key' => $newkey)) ;
   
           foreach ($uq->get_results() as $u)
               delete_user_meta($u->ID, $newkey) ;
           foreach  ($searchvalues as $val)
           {
       		$args = array(
       			'meta_query' => array(
       				0 => array(
       			     'key' => $searchkey,
       			     'value' => $val,
       			    ),
       				1 => array(
       				 'key'   => 'status',
       				 'value' => 'Aktiv'
       				)
       		));
               $uq = new WP_User_Query($args) ;
   
       		foreach ($uq->get_results() as $u){
                   update_user_meta($u->ID, $newkey, true) ;
       		}
           }
       }
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘A clean-lean plugin’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/email-users_a0e0cf.svg)
 * [Email Users](https://wordpress.org/plugins/email-users/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/email-users/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/email-users/)
 * [Active Topics](https://wordpress.org/support/plugin/email-users/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/email-users/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/email-users/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [dmenne](https://wordpress.org/support/users/dmenne/)
 * Last activity: [11 years, 11 months ago](https://wordpress.org/support/topic/a-clean-lean-plugin/#post-7861753)