I'm writing a MySQL report (in the Configurable Reports block, if that's relevant) in which I want to link to a student's user grade report in a class. In theory, it works, but in practice, it doesn't.
My SQL query is:
concat('<a target="_new" href="%%WWWROOT%%/grade/report/user/index.php\?id=',c.id,'&userid=',u.id,'&groupid=',grm.groupid,'">',u.firstname,' ',u.lastname,"'s Grades",'</a>') AS 'View Grades',
which correctly generates the link and URL http://mymoodlesite.org/grade/report/user/index.php?id=249&userid=450&group=1909
The student's User Report opens in a new window, but gives the error "User is not a member of this group" because the User Report doesn't open to the group indicated in the URL.
If I manually change the group to the correct one, the URL remains the same, but the student's grades appear.
Note that the URL on each image is identical, and I know for certain that the group id passed in the URL is correct.
Is there any way I can make the User Report open with the correct group already selected?