This afternoon I updated the beta version of Email Users 4.4.1 to beta-3. This version improves the Custom Group filter options by introducing a new Custom Group Meta Key filter. It builds on the Custom Group Meta Filter but eliminates a lot of the work required if a filter on a Meta Key is desired instead of a Meta Key and Value pair.
For example the following code will yield a Send to Group Form with selections based on any possible value of a User Meta Key by the name of ‘department’:
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)) ; }
The only required argument is the first one, which is the name of the Meta Key. The second argument is an optional Meta Value and the third argument is an optional callback which accepts two strings, Meta Key and Meta Value, and returns a string which is used as the selection text on the form.
I have updated the example plugin again to create the filter which results in the image above, the examples I have done previously are still in the file however are commented out. You can download it and drop it into your plugins directory to see menus like shown in the beta-1 post.
Email Users Custom List (10725 downloads )Please download and test the beta release. Report back any issues and I’ll do what I can to fix them quickly.
Email Users Beta (27726 downloads )