Note: You are currently viewing documentation for Moodle 3.8. Up-to-date documentation for the latest stable version of Moodle may be available here: Course rate block.

Course rate block

From MoodleDocs

Couse Rating Block

The block contains a link to a separate form page to give a rating, and displays the current aggregate of all user ratings including the number of people who have made ratings.


Each user can rate a course only once. If they visit the ratings form again, a message is displayed to indicate that they've already rated the course, and the (disabled) form displays the rating they gave.


  • Download the plugin from
  • Copy the files into the \blocks folder.
  • Go to the \admin page and allow the block to be installed
  • Add the block to your course pages to display course ratings

Roles and Permissions

The default installation will allow all roles except for Guest and Authenticated User to rate a course. All users, regardless of role, can see ratings.


English, Hebrew, Mexican spanish and German.

If using the german language pack, you will need to copy the star0.png file from rate_course/lang/de_utf8 into rate_course/graphic to replace the one there with english text included. Hopefully we'll improve this to dynamically include the language some time!

Integrating the Questionnaire module

In the Moodle 2.x compatible version of this block, you can edit the block settings to add a link to a Questionnaire. If you do not have the questionnaire module installed, or do not wish to use this feature, simply leave the block setting empty.

Advanced Options

You can get the rating graphic displayed anywhere you want by adding this code at the right point:

 $block = block_instance('rate_course');
 $block->display_rating($course->id);   //will echo immediately 

or some thing like

 $block = block_instance('rate_course');
 $summary = $summary.$block->display_rating($course->id,true);  //use true to get a return value as string, otherwise the rating will be echoed directly

We've added this to our course listings so you can see the rating for each course as you browse through the categories. To do the same, edit the file course/renderer.php and paste the second example in the get_course_formatted_summary() function. You can also add it to the myMoodle course information by editing the print_overview() function in course/lib.php;

To Do

It would be great if users could enter their rating by clicking directly on the star graphic in the block, using AJAX, rather than have to go to a separate page, submit a form and return to the course home page. This would need to be an option, so that sites (or users) which do not have AJAX enabled could continue to use the form page.


The Course Ratings Block is maintained by Jenny Gray at the UK Open University.