Example #1
0
function rcl_add_group_user_options()
{
    global $rcl_user, $rcl_group, $user_ID;
    if ($user_ID == $rcl_user->ID) {
        return false;
    }
    if ($rcl_user->ID == $rcl_group->admin_id) {
        return false;
    }
    $group_roles = rcl_get_group_roles();
    echo '<div id="options-user-' . $rcl_user->ID . '" class="group-request" data-user="******">';
    echo '<div class="group-user-option">';
    echo rcl_get_group_callback('rcl_group_ajax_delete_user', __('Delete', 'wp-recall'));
    echo '</div>';
    echo '<div class="group-user-option">';
    echo __('User status', 'wp-recall') . ' <select name="user_role">';
    foreach ($group_roles as $role => $data) {
        echo '<option value="' . $role . '" ' . selected($rcl_user->user_role, $role, false) . '>' . $data['role_name'] . '</option>';
    }
    echo '</select>';
    echo rcl_get_group_callback('rcl_group_ajax_update_role', __('Save', 'wp-recall'), array('user_role'));
    echo '</div>';
    echo '</div>';
}
function rcl_get_group_users($group_id)
{
    global $rcl_group, $user_ID;
    add_filter('rcl_users_query', 'rcl_group_add_users_query');
    if (rcl_is_group_can('moderator') || current_user_can('edit_others_posts')) {
        add_action('user_description', 'rcl_add_group_user_options');
    }
    $page = isset($_POST['page']) ? $_POST['page'] : false;
    $users_role = isset($_POST['value']) ? $_POST['value'] : "all";
    $content = '<div id="group-userlist">';
    $group_roles = rcl_get_group_roles();
    $content .= '<div class="rcl-data-filters">' . 'Сортировка по статусу: ';
    foreach ($group_roles as $role => $data) {
        $class = $role == $users_role ? 'filter-active' : 'data-filter';
        $content .= rcl_get_group_link('rcl_get_group_users', $data['role_name'], array('value' => $role, 'class' => $class));
    }
    $content .= '</div>';
    $content .= '<h3>' . __('Group members', 'wp-recall') . '</h3>';
    $content .= rcl_get_userlist(array('paged' => $page, 'filters' => 0, 'orderby' => 'time_action', 'data' => 'rating_total,posts_count,comments_count,description,user_registered', 'add_uri' => array('value' => $users_role)));
    $content .= '</div>';
    return $content;
}