/** * Get the users based on groups from the User Access Manager plugin * $meta_filter can be '', MAILUSERS_ACCEPT_NOTIFICATION_USER_META, or MAILUSERS_ACCEPT_MASS_EMAIL_USER_META */ function mailusers_get_uam_groups($exclude_id = '', $meta_filter = '') { global $wpdb; $uam = array(); $groups = $wpdb->get_results("\n SELECT DISTINCT a.id, a.groupname FROM {$wpdb->prefix}uam_accessgroups a\n\t\tINNER JOIN {$wpdb->prefix}uam_accessgroup_to_object b ON a.id = b.group_id\n\t\tWHERE b.object_type != 'role' "); foreach ($groups as $group) { $ids = mailusers_get_recipients_from_uam_group($group->id, $exclude_id, $meta_filter); if (!empty($ids)) { $uam[$group->id] = $group->groupname; } } return $uam; }
break; default: $send_roles[] = $value; break; } } // Extract the recipinents from the various target sources $recipients = array(); if (!empty($send_filters)) { $recipients = array_merge($recipients, mailusers_get_recipients_from_custom_meta_filters($send_filters, $exclude_id, MAILUSERS_ACCEPT_MASS_EMAIL_USER_META)); } if (class_exists(MAILUSERS_USER_GROUPS_CLASS) && !empty($send_ug)) { $recipients = array_merge($recipients, mailusers_get_recipients_from_user_groups($send_ug, $exclude_id, MAILUSERS_ACCEPT_MASS_EMAIL_USER_META)); } if (class_exists(MAILUSERS_USER_ACCESS_MANAGER_CLASS) && !empty($send_uam)) { $recipients = array_merge($recipients, mailusers_get_recipients_from_uam_group($send_uam, $exclude_id, MAILUSERS_ACCEPT_MASS_EMAIL_USER_META)); } if (class_exists(MAILUSERS_ITTHINX_GROUPS_CLASS) && !empty($send_groups)) { $recipients = array_merge($recipients, mailusers_get_recipients_from_itthinx_groups_group($send_groups, $exclude_id, MAILUSERS_ACCEPT_MASS_EMAIL_USER_META)); } if (class_exists(MAILUSERS_PMPRO_CLASS) && !empty($send_pmpro)) { $recipients = array_merge($recipients, mailusers_get_recipients_from_membership_levels($send_pmpro, $exclude_id, MAILUSERS_ACCEPT_MASS_EMAIL_USER_META)); } if (!empty($send_roles)) { $recipients = array_merge($recipients, mailusers_get_recipients_from_roles($send_roles, $exclude_id, MAILUSERS_ACCEPT_MASS_EMAIL_USER_META)); } if (empty($recipients)) { ?> <p><strong><?php _e('No recipients were found.', MAILUSERS_I18N_DOMAIN); ?>