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

Create a method that returns array of user names visible to current user

    XMLWordPrintable

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 3.2.2, 3.3
    • None
    • User management
    • None
    • MOODLE_32_STABLE, MOODLE_33_STABLE

    Description

      We have a method for retrieving user identity fields that current user can see in the given context:

      get_extra_user_fields()
      

      However we do not have a method that returns what user name fields current user can see in the given context. In some places in code we use something like this:

      order_in_string(get_all_user_name_fields(), $nameformat);
      // $nameformat is calculated from $CFG->fullnamedisplay and $CFG->alternativefullnameformat 
      // based on capability to view full names in the current context
      

      Where we need this new method:

      • Displaying the header with possible sort fields in the tables listing users (this is part of tablelib)
      • Exporting reports where we need one line per user - we do not want to put fullname() in one cell of the export table, we want to have firstname, lastname, etc. as separate columns

      To mention that there are some interesting methods in user_picture class but not quite what we need here

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              marina Marina Glancy
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: