Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-20199

Database: ##firstname## and ##lastname## tags not working in templates


    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Not a bug
    • Affects Version/s: 1.9.5
    • Fix Version/s: None
    • Labels:
    • Difficulty:
    • Affected Branches:


      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:

      fullname($user, 'fullname')
      fullname($user, 'lastname')
      fullname($user, 'firstname')

      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

        Gliffy Diagrams


            Issue Links



                • Votes:
                  1 Vote for this issue
                  3 Start watching this issue


                  • Created: