WeBWorK Main Forum

Adding Student's Name to the main menu

Adding Student's Name to the main menu

by Brendan N -
Number of replies: 2
Hello,

I'm trying to make our webwork site a bit more personable for our students; one idea we've come up with is to have the student's name displayed instead of their ID so that when tutors come around they can look at the screen and say the student's name instead of randomly guessing. I've tried editing the ContentGenerator.pm file a couple of times but it's ended up crashing the server. Would anyone know how to go about doing this? Thanks!
Attachment Loggedin.png
In reply to Brendan N

Re: Adding Student's Name to the main menu

by Michael Gage -
I can tell you where to look. This week I don't have time to do anything myself.


The item in the Template that prints the "logged in as" message (for the math4 theme) is here:

https://github.com/openwebwork/webwork2/blob/master/htdocs/themes/math4/system.template#L94

it has a call back to obtain content to the function loginstatus()

which is defined in WeBWorK/ContentGenerator.pm (and may be overridden in subclasses although I doubt it. ).

https://github.com/openwebwork/webwork2/blob/master/lib/WeBWorK/ContentGenerator.pm#L948

You will need to find the user's actual name -- possibly it's in $r->param('userName') but you'll have to search. You may need to use the
userID to look up the students name in the database in order to display it.
(User -- is the targeted user of the problem. effectiveUser is the person actually viewing the problem (could be the professor acting as a student).

If you figure out a nice way to make this generally customizable (or you think that your change would be a net improvement in all cases) please submit a pull request.


In reply to Michael Gage

Re: Adding Student's Name to the main menu

by Brendan N -
It's all good, I just needed a direction to get started in. Thank you very much!