Per http://moodle.org/mod/forum/discuss.php?d=131591#p575882 I am creating this issue to document that while the options are listed for using the ##firstname## and ##lastname## tags they do not actually work. I am attaching at first a quick fix that will make it functional; however, it does not respect CFG->forcefirstname or CFG->forcelastname. To do so, I would like to propose modifying the fullname function such that the override parameter indicates the type of override. 0 or false would continue to mean that there is no override; however, I would advocate for changing 1 to 'fullname' and then use 'firstname' and 'lastname' as optional parameters. Thus the options would be:
I think this will make the fullname function more flexible and avoid having to use the get_field ('user', 'lastname', 'id',$record->userid). That way we can enforce the CFG->forcefirstname and CFG->forcelastname options and not accidentally disclose user names. So I would advocate for not applying this first patch which is really only for folks wanting a quick and dirty fix. I'll work on something better shortly but will need to check all the places where fullname is used to make sure any fullname($user,1) calls get switched to 'fullname'. Of course I am open to other suggestions or ideas as well.
Peace - Anthony