Course overview block / My courses page - improvement suggestion

Course overview block / My courses page - improvement suggestion

by Przemek Kaszubski -
Number of replies: 4
Hello Team,

I'm missing such options in the course overview display - whether on the My courses page or in the Course overview block added to the Dashboard:

1) For users with with the course request capability (if course requests are allowed one the site) - the link for Requesting a course.

2) For managers / admins and whoever with a capability to create courses for themselves, the link for Adding a new course

The My courses / Course overview seems like the right place for extending the list of the courses we currently have access too.
I think it would be great if the Course overview block plugin settings had the options to enable / disable the types of links mentioned above.

Many thanks for any consideration.

Kind regards,

Przemek
Average of ratings: -
In reply to Przemek Kaszubski

Re: Course overview block / My courses page - improvement suggestion

by Przemek Kaszubski -
Sorry, take back the "New course" option for Managers & Admins on the "My courses" page. It is there.
I still miss it in the Course overview block itself - should an admin decide to block "My courses" and only use the Dashboard page with customized blocks. Why would the admin do this? The "My courses" page lacks customization options - no blocks are supported here...
Rgds,
Przemek
In reply to Przemek Kaszubski

Re: Course overview block / My courses page - improvement suggestion

by Helen Foster -
Picture of Moodle HQ team

Hello Przemek,

If course requests are enabled, you should find a 'Request a course' link on the My courses page (in the same place as the 'New course' link).

In reply to Helen Foster

Re: Course overview block / My courses page - improvement suggestion

by Przemek Kaszubski -
Thanks, Helen. Indeed, it is as you say in Moodle 4.2 (and maybe Moodle 4.1), but not in my Moodle 4.0.8 / 4.0.9 . Apparently, that improvement had not made it into the Moodle 4.0 series... If I have time, I'll investigate further, and see if I can hack our code a bit if needed & possible.

BTW - speaking of course requests, there's been an inconsistency in the default Moodle settings vs what the docs say, going back to at least version 3.11.

See https://docs.moodle.org/311/en/Capabilities/moodle/course:request
and https://docs.moodle.org/402/en/Capabilities/moodle/course:request
which both say "The default Authenticated user role has this capability set to allow."

and this page

vs. the description on the Moodle page  /admin/settings.php?section=courserequest  next to "Enable course requests enablecourserequests" , which says (my bold):

"If enabled, users with the capability to request new courses (moodle/course:request) will have the option to request a course. This capability is not allowed for any of the default roles. It may be applied in the system or category context."

In line with the latter, the "Define roles" page for the "Authenticated user" will show:

Authenticated users define role page  filtered on moodle/course:request capability


So: which is, and should be, the default setting with respect to this capability for Authenticated users..?

Of course, current admins will cope, but I think at least new admins need a more consistent reading of what the default is, and whether they should be taking an "opt-in" approach for the roles to be enabled to request courses, or the "opt-out" approach, which is dominating the current documentation.

Maybe you'll want to double check which default is the right one, and prompt some update work where required. 

HTH and kind regards,

Przemek
Average of ratings: Useful (1)
In reply to Przemek Kaszubski

Re: Course overview block / My courses page - improvement suggestion

by Przemek Kaszubski -

PS. Should anyone require it, on the question of enabling Moodle 4.0.* "My courses" page to show the "Request a course" link to the permitted users, the workaround is luckily easy (if you have server access).

We must simply copy these two files from Moodle the 4.1.* release and replace the Moodle 4.0.* originals (after renaming them somehow for backup's sake):

  • /my/courses.php
  • /my/templates/dropdown.mustache
I have tested this setup on two different Moodle 4.0 sites, and everything works as on a Moodle 4.1 / 4.2 site.

The differences between Moodle 4.0 and Moodle 4.1 in both files were rather brief, altogether about ten lines of code affected. Here's the listing if anyone is interested:

In the courses.php file these two were added:

L. 32:
require_once($CFG->dirroot . '/course/lib.php');

after the line: require_once($CFG->dirroot . '/my/lib.php');


Ll. 82-88:

if ($coursecat) {
    $category = core_course_category::get_nearest_editable_subcategory($coursecat, ['moodle/course:request']);
    if ($category && $category->can_request_course()) {
        $coursemanagemenu['courserequesturl'] = new moodle_url('/course/request.php', ['categoryid' => $category->id]);

    }
}

BEFORE the line :
if (!empty($coursemanagemenu)) {


in dropdown.mustache there were 3 changes:

ll. 25-26:

        "manageurl": "https://moodle.test/course/management.php?categoryid=1",
        "courserequesturl": "https://moodle.test/course/request.php?categoryid=1"

replaced this l. 25:

        "manageurl": "https://moodle.test/course/management.php?categoryid=1"


l.29

<div class="btn-group{{#manageurl}} course-manage{{/manageurl}}{{#courserequesturl}} course-request{{/courserequesturl}}">

instead of this line 28:

<div class="btn-group">


ll. 41-43:

        {{#courserequesturl}}
            <a class="dropdown-item" href="{{courserequesturl}}">{{#str}}requestcourse, core{{/str}}</a>
        {{/courserequesturl}}

were added before the last two </div>'s


I'm happy to be able to use these "hacks" already, before the planned upgrade to Moodle 4.2 or 4.3 next year.

Maybe this will also help someone who, like me, is stuck with version 4.0 for some time.

Kind regards, 

Przemek