Setting reading rights to the course resources for all (guest)?

Setting reading rights to the course resources for all (guest)?

by Teemu Leinonen -
Number of replies: 4
Hi,

I was trying to find an answer from the forums and also testing the Resources module from this perspective, but couldn't find an answer.

I am wondering if is it possible to set up reading rights for the course resources so that anyone will have an access in them (guest, without log in).

What I am looking for is the possibility to set up Moodle so that all the course content could be open (libre smile for anyone interested in to do self-study, but the activities that requires more "human resources" would be open only for the students accepted and enrolled to the course.

When releasing the course resource for all there could also be an option for the teacher to select one of the Creative Commons license for the resource.
Average of ratings: -
In reply to Teemu Leinonen

Re: Setting reading rights to the course resources for all (guest)?

by Henry Feldman -
We had a similar problem, and created a small modification to moodle, which enrolls everyone in everything when they sign up, and with the maintanence cron job, makes sure everyone is added, if new courses are added.
In reply to Henry Feldman

Re: Setting reading rights to the course resources for all (guest)?

by Henry Feldman -
I realize I didn't include how we did it. Many of the mods are simply mods of other people's functions in moodle. With these mods, when a user confirms, they are enrolled automatically in all open courses. Here are the mods: (I put the code we changed in bold, and tried to include a couple of lines around it for clarity in normal text)


to login/confirm.php:

           // The user has confirmed successfully, let's log them in
 
                if (!$USER = get_user_info_from_db("username", $user->username)) {
                    error("Something serious is wrong with the database");
                }
                // HACK now lets enroll them in all current courses
                enrol_in_all($user->id);
               // END HACK

                set_moodle_cookie($USER->username);

to lib/moodlelib.php:

<>function enrol_student($userid, $courseid) {
/// Enrols a student in a given course
>   SHORTENED FOR CLARITY
}
<>
// HACK to enroll a user in all courses
function enrol_in_all($userid) {
>
    $courses = get_open_courses("all");

    foreach ($courses as $course) {

            enrol_student($userid, $course->id);

    }

}
// END HACK

function unenrol_student($userid, $courseid=0) {

to lib/datalib.php:

//  HACK
//Returns list of courses, for whole site that are not password protected and visible
function get_open_courses($categoryid="all", $sort="c.sortorder ASC", $fields="c.*") {
    global $USER, $CFG;
    $selectsql = "{$CFG->prefix}course as c where password='' and visible>0";
     return get_records_sql("SELECT DISTINCT $fields FROM $selectsql");
}
// END  HACK

to admin/cron.php:

  // HACK
    //Enroll users in all visible and non-pw protected classes
    $user_list = get_records_sql("SELECT distinct * FROM  chip_user WHERE confirmed = 1 order by id");
    if ($user_list) {
        foreach ($user_list as $enroll_user) {
                //echo "User >".$enroll_user->id."< \n";
                enrol_in_all($enroll_user->id);
        }
    } else echo "*** failed query *** echo enroll cancled\n\n";   
    //echo "enroll in all script completed correctly\n\n";
    //END HACK

    //echo "Cron script completed correctly\n";

In reply to Henry Feldman

Re: Setting reading rights to the course resources for all (guest)?

by Teemu Leinonen -
Thank you Henry.

Actually I would like all the course resources to be available for anyone browsing the web, meaning reaching the right URL. This way the course resources could be free for all, even without a user account to the Moodle. From the main page of the Moodle one could have a look of the course resource without right (user account and enrolment to the course) to participate in the course activities.

I am not sure if your change work this way. Please, could you clarify?
In reply to Teemu Leinonen

Re: Setting reading rights to the course resources for all (guest)?

by Henry Feldman -
I'm not sure if this is true, but "guest" is a user, if enabled, and the cron job would enable them too probably.