Custom solution for Missing Grade link in Express

Discussion created by mwilday on Jul 11, 2017

In the absence of the Grades link with the Moodlerooms upgrade to 3.2 and dissolution of support for Express themes. I wanted to share the following solution for adding a Gradebook block with a custom grades link for your courses.

  1. Navigate into a course and Turn on editing.
  2. Navigate to the primary category containing your courses.
    (We have a category for each term of courses offered - but this could be done in multiple categories if your courses are sorted differently.
  3. Add an HTML block.
  4. Title the block Gradebook
  5. Switch the editor window to HTML view and add the following code.
     function gradelink() {
        var x = document.getElementsByTagName("body")[0].className;
        var y = x.match(/(course\-\w+)/g);
            if (y.length > 2){
             var z = y[2].split("course-");  
            else {
              var z = y[1].split("course-");      
       window.location = 'ht'+'tp://'+'ENTER YOUR DOMAIN HERE'+'/grade/report/user/index.php?id=' + z[1];
<div style="margin:3px 0;">
<a class="mygrades-block" onclick="ucgradelink()" style="color:#303030; cursor: pointer;">
<img class="smallicon navicon" src="" 
style="width:16px; height:16px; margin-top:0; padding-left: 6px; margin-right:6px; vertical-align: middle">Grades</a>
<!--If your domain starts with www. then you will need to update the window.location line and add 'www.'+ before the quote for enter your domain here. --> 

  1. Twirl open "Where this block appears"
  2. Choose Page Contexts: "Display on Category and any pages within it."
  3. Choose Display on Page Types: Any Page
  4. Set the default weight for where it will appear in your list of blocks.
  5. To hide the Gradebook block on your category pages twirl down "On this page" and set visible to "No".
  6. Repeat step 10 on each category page if you have several sub-categories.

What you are left with is a category block that will flow through to any course pages within the category and provide a valuable link to the users grades.