<?php

if (!current_user_can('delete_users')) {
    wp_die(__('You do not have sufficient permissions to manage options for this site.', 'contexture-page-security'));
}
$groupInfo = CTXPS_Queries::get_group_info($_GET['groupid']);
$groupPageCount = CTXPS_Queries::count_protected($_GET['groupid']);
$actionmessage = '';
$actionmessage2 = '';
if (!empty($_GET['action']) && !empty($_GET['submit']) && $_GET['action'] == "delete" && $_GET['submit'] == "Confirm Deletion") {
    $sqlstatus = CTXPS_Queries::delete_group($_GET['groupid']);
    if (!$sqlstatus) {
        $actionmessage = '<div class="error below-h2"><p>' . __('An error occurred. The group was not fully deleted.', 'contexture-page-security') . '</p></div>';
    } else {
        $actionmessage2 = '<div id="message" class="update below-h2"><p><strong>1</strong> ' . __('group was deleted.', 'contexture-page-security') . ' <a href="' . admin_url() . 'users.php?page=ps_groups">' . __('View all groups', 'contexture-page-security') . ' &gt;&gt;</a></p></div>';
    }
}
        $user_type = get_user_meta(get_current_user_id(), 'rpr_user_type', true);
        // set $is_teacher if admin or if user_type === Teacher
        $is_teacher = false;
        if ($user_type === 'Teacher' || current_user_can('manage_options')) {
            $is_teacher = true;
        }
        if ($is_teacher) {
            the_content();
            $teacher_groups = get_user_meta(get_current_user_id(), 'gd_teacher_groups', true);
            if (!empty($teacher_groups) && class_exists('CTXPS_Queries')) {
                $students = array();
                echo '<h1 class="teacher-groups-header">' . $teacher_user->display_name . '\'s class overview:</h1>';
                echo '<div id="teacher-groups">';
                foreach ($teacher_groups as $group_id) {
                    $group_members = CTXPS_Queries::get_group_members($group_id);
                    $group_info = CTXPS_Queries::get_group_info($group_id);
                    $team_page_id = get_option('gd_team_page_id');
                    $team_page_permalink = get_permalink($team_page_id);
                    // A button that will clear a team's progress (delete their posts and the progress they've made)
                    $clear_progress = '<button class="button" id="clear-team-progress" data-teamid="' . $group_id . '">Clear Team Progress</button>';
                    ?>
                                    <div id="<?php 
                    echo $group_info->ID;
                    ?>
" class="gd-tdash-group">
                                        <p><a href="<?php 
                    echo $team_page_permalink;
                    ?>
?team_id=<?php 
                    echo $group_info->ID;
                    ?>
Exemplo n.º 3
0
        </div>

        <div id="breadcrumbdivider">&nbsp;</div>

        <div id="post-content">
            <?php 
if (is_user_logged_in()) {
    if (class_exists('CTXPS_Queries')) {
        if (isset($_GET['team_id'])) {
            // get team id from $_GET query
            $team_id = (int) $_GET['team_id'];
            // check if user belongs to group if not administrator
            if (!current_user_can('manage_options')) {
                $is_member = CTXPS_Queries::check_membership(get_current_user_id(), $team_id);
            } else {
                $current_group = CTXPS_Queries::get_group_info($team_id);
                $is_member = true;
            }
        } else {
            $groups = CTXPS_Queries::get_groups(get_current_user_id());
            $current_group = new stdClass();
            if (count($groups) > 0) {
                $current_group = $groups[0];
            }
            $team_id = $current_group->ID;
            $is_member = true;
        }
        ?>
                <?php 
        if ($is_member) {
            ?>