예제 #1
0
/**
 * 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_itthinx_groups($exclude_id = '', $meta_filter = '')
{
    global $wpdb;
    $itthinx_groups = array();
    $groups = Groups_Utility::get_group_tree();
    $groups = Mailusers_Groups_Utility::flatten_group_tree($groups);
    foreach ($groups as $key => $value) {
        $group = Groups_Group::read($value);
        $ids = mailusers_get_recipients_from_itthinx_groups_group($group->group_id, $exclude_id, $meta_filter);
        if (!empty($ids)) {
            $itthinx_groups[$group->group_id] = $group->name;
        }
    }
    return $itthinx_groups;
}
/**
 * Tree view : a simple tree view
 */
function groups_admin_tree_view()
{
    global $wpdb;
    $output = '';
    $today = date('Y-m-d', time());
    if (!current_user_can(GROUPS_ACCESS_GROUPS)) {
        wp_die(__('Access denied.', GROUPS_PLUGIN_DOMAIN));
    }
    $output .= '<div class="groups-tree-view">' . '<h1>' . __('Tree of Groups', GROUPS_PLUGIN_DOMAIN) . '</h1>';
    $tree = Groups_Utility::get_group_tree();
    $tree_output = '';
    Groups_Utility::render_group_tree($tree, $tree_output);
    $output .= $tree_output;
    $output .= '</div>';
    // .groups-tree-view
    echo $output;
}