Re: Guest access without the [Login as Guest] button...
http://moodle.org/course/view.php?id=5&username=guest
Re: Guest access without the [Login as Guest] button...
fantastic, thanks, that's really useful...
now, if it could only be a per-course setting which was switchable, then I'd be a v happy man...
Re: Guest access without the [Login as Guest] button...
- Do not allow guests in
- Allow guests without the key
- Allow guests who have the key
Re: Guest access without the [Login as Guest] button...
...I'm aware of those settings, but I think what I'm after is a setting which allows me to avoid the [Login as Guest] button for a particular course. With some courses it may be desirable I suppose.
Something like a
[x] allow guests without logging in
setting, which would append the &username=guest parameter onto the URL automatically. Otherwise, I have to hand encode it for course on which I want to achieve this, and I wouldn't wish that on other users...
This would be similar to having a 'normal' CMS which allows anyone in, but allows more information once you have logged in. Moodle is (currently) different from this model since it requires you to visit the Login page and click [Login as Guest] - which is a step I'd like to leave out on certain courses which consist primarily of public information in the form of downloadable resources, etc.
In the meanwhile you could maybe use a simple redirection script for any of the courses where you need this functionality. That way you don't have to impose it on anybody else. Or is that too easily thought?
Re: Guest access without the [Login as Guest] button...
In the function function print_category_info($category, $depth) change the line
echo "<a $linkcss href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->fullname</a>";
to
if ($course->guest ) {
echo "<a $linkcss href=\"$CFG->wwwroot/course/view.php?id=$course->id&username=guest\">$course->fullname</a>";
} else {
echo "<a $linkcss href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->fullname</a>";
}
Re: Guest access without the [Login as Guest] button...
code has changed in 1.9x so it needs a different code now
linking the course directly works fine :
<moodle url>/course/category.php?id=<id number>1&username=guest
Raz
Re: Guest access without the [Login as Guest] button...
I like this guest shortcut idea. Here's a followup question that should be easy enough for somebody to figure out...
If I wanted the &username=guest added to the links generated by the RSS feed of a Moodle forum, what file would I need to tweak and how?
Re: Guest access without the [Login as Guest] button...
This is very useful. In 1.8 I have found that you can also append this to the end of a category listing too eg
<moodle url>/course/category.php?id=1&username=guest
Any courses in that listing that allow guest access allow you in without making the round trip to the login page. The guest login is generated before you go into the course.
best regards
Mike Chaplin
vleadmin@mancat.ac.uk