Moodle

No such course id

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.6
  • Fix Version/s: 1.9.5
  • Component/s: Messages
  • Labels:
    None
  • Environment:
    Windows XP
  • Database:
    MySQL
  • Affected Branches:
    MOODLE_16_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE

Description

A teacher did click on my (admin's) name in the message block box witch gave him No such course id on the page moodle/user/view.php?id=2&course=3

Issue Links

Activity

Hide
Wez Morris added a comment -

The message address is incorrect, (course should = 1, not 11)

Show
Wez Morris added a comment - The message address is incorrect, (course should = 1, not 11)
Hide
Florian Steinfeltz added a comment -

Had this error too.
If a teacher clicks in mymoodle on a sender-name from a moodle-intern message, the id was incorrect and the error message:
'No such course id' was reported.

Moodle: 1.8.4+ (20080305)
Umgebung:
Ubuntu 7.10, kernel 2.6.19-4-server
Apache/2.0.55
PHP 5.1.2

Show
Florian Steinfeltz added a comment - Had this error too. If a teacher clicks in mymoodle on a sender-name from a moodle-intern message, the id was incorrect and the error message: 'No such course id' was reported. Moodle: 1.8.4+ (20080305) Umgebung: Ubuntu 7.10, kernel 2.6.19-4-server Apache/2.0.55 PHP 5.1.2
Hide
Dennis Meyer added a comment -

Same error here:
Moodle: 1.9.4.+

MyMoodle-Link on Message-Block with wrong course-id. (Only the name is linked wrong - the small envelope is linked correctly)

Show
Dennis Meyer added a comment - Same error here: Moodle: 1.9.4.+ MyMoodle-Link on Message-Block with wrong course-id. (Only the name is linked wrong - the small envelope is linked correctly)
Hide
Minh-Tam Nguyen added a comment -

We just ran across this one as well, on 1.9.4

It seems to me that these three issues are about the same problem:
MDL-6890 - Name in the message block send the user to wrong error message
MDL-5887 - No such course id
MDL-18279 - Messages Block - Sender's name/image does not link to sender's profile

Cheers,
Minh-Tam

Show
Minh-Tam Nguyen added a comment - We just ran across this one as well, on 1.9.4 It seems to me that these three issues are about the same problem: MDL-6890 - Name in the message block send the user to wrong error message MDL-5887 - No such course id MDL-18279 - Messages Block - Sender's name/image does not link to sender's profile Cheers, Minh-Tam
Hide
Minh-Tam Nguyen added a comment -

I'm posting here because there are more watchers and it's older.
I'm looking at 1.9.4, on XAMPP (Win XP, Apache 2.2.9, PHP 5.2.6).

I believe that the name and picture are supposed to link to a user's profile, and the envelope and number are supposed to open the messaging popup. As described, clicking the name or picture sends the user off to the profile of the sender, but in the context of a seemingly random course, to which the user may not have access.

Here's a suggestion for a quick fix to make it behave in the same way the Online Users block does. It will need some verifying, though.

/blocks/messages/block_messages.php @ line 45 in 1.9.4 is :
$this->content->text .= '<li class="listentry"><div class="user"><a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course=1'.$this->instance->pageid.'" title="'.$timeago.'">';

Replace that with :
$this->content->text .= '<li class="listentry"><div class="user"><a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course=1" title="'.$timeago.'">';

BTW, this bug can also be reproduced on Moodle.org: If I send myself a message the link is to http://moodle.org/user/view.php?id=442824&course=442824 and in the Online users Block it's to http://moodle.org/user/view.php?id=442824&course=1

Cheers,
Minh-Tam

Show
Minh-Tam Nguyen added a comment - I'm posting here because there are more watchers and it's older. I'm looking at 1.9.4, on XAMPP (Win XP, Apache 2.2.9, PHP 5.2.6). I believe that the name and picture are supposed to link to a user's profile, and the envelope and number are supposed to open the messaging popup. As described, clicking the name or picture sends the user off to the profile of the sender, but in the context of a seemingly random course, to which the user may not have access. Here's a suggestion for a quick fix to make it behave in the same way the Online Users block does. It will need some verifying, though. /blocks/messages/block_messages.php @ line 45 in 1.9.4 is : $this->content->text .= '<li class="listentry"><div class="user"><a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course=1'.$this->instance->pageid.'" title="'.$timeago.'">'; Replace that with : $this->content->text .= '<li class="listentry"><div class="user"><a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course=1" title="'.$timeago.'">'; BTW, this bug can also be reproduced on Moodle.org: If I send myself a message the link is to http://moodle.org/user/view.php?id=442824&course=442824 and in the Online users Block it's to http://moodle.org/user/view.php?id=442824&course=1 Cheers, Minh-Tam
Hide
Minh-Tam Nguyen added a comment -

apologies, but my first line of code above is incorrect.

/blocks/messages/block_messages.php @ line 45 in 1.9.4 is :
$this->content->text .= '<li class="listentry"><div class="user"><a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.$this->instance->pageid.'" title="'.$timeago.'">';

Show
Minh-Tam Nguyen added a comment - apologies, but my first line of code above is incorrect. /blocks/messages/block_messages.php @ line 45 in 1.9.4 is : $this->content->text .= '<li class="listentry"><div class="user"><a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.$this->instance->pageid.'" title="'.$timeago.'">';
Hide
Martin Dougiamas added a comment - - edited

Ah, is this ONLY happening on the "My Moodle" page, is it?

Show
Martin Dougiamas added a comment - - edited Ah, is this ONLY happening on the "My Moodle" page, is it?
Hide
Minh-Tam Nguyen added a comment -

ah, yes, we didn't tell you that.
It only happens in the Messages block on the myMoodle page.

Show
Minh-Tam Nguyen added a comment - ah, yes, we didn't tell you that. It only happens in the Messages block on the myMoodle page.
Hide
Minh-Tam Nguyen added a comment -

actually, my suggestion above would break the behaviour of the block if it's added to a course (where it should go to the profile of the user in the current course.
I think to make both work one would have to add $COURSE to the globals used in get_content():

/blocks/messages/block_messages.php @ line 10 in 1.9.4 :
from: global $USER, $CFG;
to: global $USER, $CFG, $COURSE;

and the offending line 45 to:
$this->content->text .= '<li class="listentry"><div class="user"><a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.$COURSE->id.'" title="'.$timeago.'">';

What does that do for performance?

Show
Minh-Tam Nguyen added a comment - actually, my suggestion above would break the behaviour of the block if it's added to a course (where it should go to the profile of the user in the current course. I think to make both work one would have to add $COURSE to the globals used in get_content(): /blocks/messages/block_messages.php @ line 10 in 1.9.4 : from: global $USER, $CFG; to: global $USER, $CFG, $COURSE; and the offending line 45 to: $this->content->text .= '<li class="listentry"><div class="user"><a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.$COURSE->id.'" title="'.$timeago.'">'; What does that do for performance?
Hide
Minh-Tam Nguyen added a comment -

To me it doesn't look like there would be too many issues with this, given that the online users block does it the same way. But then I'm doing this on a desktop PC.
I'm attaching 'MDL-5887.diff' to this so it's more readable than my previous post. It's my first patch file, let me know if it's not right.
Cheers,
Minh-Tam

Show
Minh-Tam Nguyen added a comment - To me it doesn't look like there would be too many issues with this, given that the online users block does it the same way. But then I'm doing this on a desktop PC. I'm attaching 'MDL-5887.diff' to this so it's more readable than my previous post. It's my first patch file, let me know if it's not right. Cheers, Minh-Tam
Hide
Dan Poltawski added a comment -

Thanks for the report. I've fixed this in CVS by instead linking to the site profile, which I think is the most robust solution.

Show
Dan Poltawski added a comment - Thanks for the report. I've fixed this in CVS by instead linking to the site profile, which I think is the most robust solution.
Hide
Petr Škoda (skodak) added a comment -

thinking a bit more about this, SITEID may not be the best target, maybe we could first test $COURSE participation and then use SITEID, the only problem here is performance because we would have to check course:view of all other users which may be very slow

Show
Petr Škoda (skodak) added a comment - thinking a bit more about this, SITEID may not be the best target, maybe we could first test $COURSE participation and then use SITEID, the only problem here is performance because we would have to check course:view of all other users which may be very slow
Hide
Dan Poltawski added a comment -

Considering that on the message contact list page we link to SITEID do you not think this solution is best for performance and conistency? Afterall it might be a little confusing to some users that some profile are in the course profile and others in the site (the visual distinction isn't that great)

Show
Dan Poltawski added a comment - Considering that on the message contact list page we link to SITEID do you not think this solution is best for performance and conistency? Afterall it might be a little confusing to some users that some profile are in the course profile and others in the site (the visual distinction isn't that great)
Hide
Petr Škoda (skodak) added a comment -

The problem is that some sites do not want students to see profiles of everybody on frontpage, just their class mates - I guess this could be considered a privacy issue.

Show
Petr Škoda (skodak) added a comment - The problem is that some sites do not want students to see profiles of everybody on frontpage, just their class mates - I guess this could be considered a privacy issue.
Hide
Dan Poltawski added a comment -

This will break on the main messages contactlist though as this is how it is setup at present.

Show
Dan Poltawski added a comment - This will break on the main messages contactlist though as this is how it is setup at present.
Hide
Petr Škoda (skodak) added a comment -

I guess we can close this now, all potential problems are known and I doubt there is a better way for 1.9.x
thanks everybody

Show
Petr Škoda (skodak) added a comment - I guess we can close this now, all potential problems are known and I doubt there is a better way for 1.9.x thanks everybody
Hide
Minh-Tam Nguyen added a comment -

for consistensy, should blocks/online_users/block_online_users.php also be changed?
it currently uses $COURSE:
<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.$COURSE->id.'" title="'.$timeago.'">';

Show
Minh-Tam Nguyen added a comment - for consistensy, should blocks/online_users/block_online_users.php also be changed? it currently uses $COURSE: <a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.$COURSE->id.'" title="'.$timeago.'">';
Hide
Dan Poltawski added a comment -

Minh-Tam, No - the online users block specifically searches for online users within a course so it is safe to link to course profile, the difference with the messages block is that it shows users from any message you receive and so its not safe to do this.

Show
Dan Poltawski added a comment - Minh-Tam, No - the online users block specifically searches for online users within a course so it is safe to link to course profile, the difference with the messages block is that it shows users from any message you receive and so its not safe to do this.

Dates

  • Created:
    Updated:
    Resolved: