Is there any way for a WW problem to obtain information about the logged-in user (e.g. name, username, student id #), so as to use it in customizing a problem non-randomly? If such an ability doesn't already exist, would it be possible to write my own PG macro to do it?
This is possible. Have a look at the following OPL problem:
which makes use of $studentLogin to access student identity data and then set a seed for Rserve.
Uncommenting the "warn" line in this file shows that the $studentName and $studentID fields are also accessible.
- webwork2/lib/WeBWorK/PG.pm puts these three data fields into the PG %envir hash.
- pg/macros/PG_CAPAmacros.pl makes use of $main::studentName
- pg/macros/PGtextevaluators.pl makes use of all 3 fields
- Several other files in the pg code tree make use of either:
Hope this helps,