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

Browse list of users page error when sorting by custom user field

    XMLWordPrintable

Details

    • MOODLE_311_STABLE
    • MOODLE_311_STABLE
    • MDL-71832-m311
    • MDL-71832-master
    • Hide

      To reproduce:

      1. If you don't already have one, add a custom user profile field (admin / Users / Accounts / User profile fields) of type 'text input', max length 100, short name 'testid'
      2. Set this field to be shown in user identity (admin / Users / Permissions / User policies) by ticking it in the list.
      3. Go to the browse list of users page (admin / Users / Accounts / Browse list of users). The new column should appear in the list of users.
      4. Click on the column name to sort by it.

      EXPECTED: There should not be an error message.

      Show
      To reproduce: If you don't already have one, add a custom user profile field (admin / Users / Accounts / User profile fields) of type 'text input', max length 100, short name 'testid' Set this field to be shown in user identity (admin / Users / Permissions / User policies) by ticking it in the list. Go to the browse list of users page (admin / Users / Accounts / Browse list of users). The new column should appear in the list of users. Click on the column name to sort by it. EXPECTED: There should not be an error message.

    Description

      To reproduce:

      1. If you don't already have one, add a custom user profile field (admin / Users / Accounts / User profile fields) of type 'text input', max length 100, short name 'testid'
      2. Set this field to be shown in user identity (admin / Users / Permissions / User policies) by ticking it in the list.
      3. Go to the browse list of users page (admin / Users / Accounts / Browse list of users). The new column should appear in the list of users.
      4. Click on the column name to sort by it.

      You get the following error:

      Error reading from database

      More information about this error
      Debug info: Unknown column 'profilefieldtestid' in 'order clause'
      SELECT u.id, username, email, city, country, lastaccess, confirmed, mnethostid, suspended , uf1d_1.data AS profile_field_testid, u.firstnamephonetic, u.lastnamephonetic, u.middlename, u.alternatename, u.firstname, u.lastname
      FROM mdl_user u
      JOIN mdl_user_info_field uf1f_1 ON uf1f_1.shortname = ?
      LEFT JOIN mdl_user_info_data uf1d_1 ON uf1d_1.fieldid = uf1f_1.id
      AND uf1d_1.userid = u.id
      WHERE deleted <> 1 AND u.id <> ?
      ORDER BY profilefieldtestid ASC LIMIT 0, 30
      [array (
      0 => 'testid',
      1 => '1',
      )]
      Error code: dmlreadexception
      Stack trace:

      line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown
      line 1273 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      line 540 of /lib/datalib.php: call to mysqli_native_moodle_database->get_records_sql()
      line 245 of /admin/user.php: call to get_users_listing()

      Attachments

        1. MDL-71832.jpg
          32 kB
          Anna Carissa Sadia

        Activity

          People

            quen Sam Marshall
            quen Sam Marshall
            Katie Ransom Katie Ransom
            Andrew Lyons Andrew Lyons
            Anna Carissa Sadia Anna Carissa Sadia
            David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              12/Jul/21

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 10 minutes
                1h 10m