center-for-learning-management / moodle-local_edusupport

Plugin to manage a moodle based helpdesk
GNU General Public License v3.0
4 stars 3 forks source link

link issue is not appearing for 2nd and third level #52

Closed shreo1992-beep closed 2 years ago

shreo1992-beep commented 2 years ago

"All support members of 2nd and 3rd level will find a link "Issues" in the left panel. Under that link they have access to an overview page that shows them all issues" regarding what has been described for the plugin that once the issue is forwarded to the supporting user a link issues will be found on the left panel of the 2nd and 3rd level supporter simply i have logged in to my moodle with the 2nd level support and i have searched for the link that you have mentioned and i didn't find any link is it under site administration or should i add it to my theme Note:- i am using boost theme

shreo1992-beep commented 2 years ago

rschrenk could you please help me regarding this issue

rschrenk commented 2 years ago

Well, the link is created by the use of Moodle Navigation API for adding a link to the navigation tree.

https://github.com/center-for-learning-management/moodle-local_edusupport/blob/465b7296ee2aba2913d037cb5377cc4f21192999/lib.php#L107

It is nested under the "home" section - have you disabled it somehow? It should appear like this: menu

Anyway, you can place a link anywhere to the page yourmoodle.domain/local/edusupport/issues.php. Users that are not in the group of support members, will not see any issues on it. However, it would be better if the link is only visible to the group of users you want it to be visible.

shreo1992-beep commented 2 years ago

Dear @rschrenk i have found the reason why the issue link was not shown simply i have opened the following file (moodle dir)/local/edusupport/classes/lib.php

i went to function is_supportteam in line 422 and i have found the following public static function is_supportteam($userid = 0, $courseid = 0, $includeglobalteam = true) { global $DB, $USER; if (empty($userid)) $userid = $USER->id; $sql = "SELECT id,userid FROM {local_edusupport_supporters} WHERE userid = ?"; $params = array($userid);

    if ($courseid > 0 && !$includeglobalteam) {
        $sql .= " AND courseid = ?";
        $params[] = $courseid;
    } elseif ($courseid > 0 && $includeglobalteam) {
        $sql .= " AND (courseid = ? OR courseid = ?)";
        $params[] = $courseid;
        $params[] = self::SYSTEM_COURSE_ID;
    } else {
        $sql .= " AND courseid = ?";
        $params[] = self::SYSTEM_COURSE_ID;
    }

    $sql .= " LIMIT 0 OFFSET 1";
    $chk = $DB->get_record_sql($sql, $params);
    return !empty($chk->userid);
}

all i just did is that i have changed "return !empty($chk->userid);" to "return empty($chk->userid);" and issues link started to appear, but now the issues link appear to all users including students so i believe in order to make this link be shown to support users only we need weather to put an if condition before the return statement or change role permissions, i am not sure which one should i do so could you help

rschrenk commented 2 years ago

It sounds that you have not added any user to the support team. What you did is simply: show the link to everyone that is NOT in the support team…

shreo1992-beep commented 2 years ago

edu as you can see in the attached file i have added the forum to a support user

edusupporters

and as you can see at the above link i have already added supporters

shreo1992-beep commented 2 years ago

@rschrenk did you see the screenshots

shreo1992-beep commented 2 years ago

@rschrenk i have solve it