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

User profile fields drop-down (menu) causes errors on pages with no context using get_complete_user_data() e.g. calendar export

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.2
    • Fix Version/s: 2.0.4
    • Component/s: Calendar
    • Environment:
      All

      Description

      If you create a new user profile field that is a menu type (drop-down select menu) then calendar exporting starts throwing an error message.

      This is because calendar/export_execute.php uses the get_complete_user_data function; which is getting the information for any user profile fields configured in the installation.

      Within the 'menu' user profile field there is a call to format_string() - format_string errors when called without a valid page context.

      Error:

      Coding problem: this page does not set $PAGE->context properly.
      line 341 of /lib/pagelib.php: call to debugging()
      line 599 of /lib/pagelib.php: call to moodle_page->magic_get_context()
      line 1236 of /lib/weblib.php: call to moodle_page->__get()
      line 23 of /user/profile/field/menu/field.class.php: call to format_string()
      line 496 of /user/profile/lib.php: call to profile_field_menu->profile_field_menu()
      line 517 of /user/profile/lib.php: call to profile_user_record()
      line 3820 of /lib/moodlelib.php: call to profile_load_custom_fields()
      line 16 of /calendar/export_execute.php: call to get_complete_user_data()

      Does calendar need to use get_complete_user_data function?
      A get_record call to user table might suffice instead and would stop this error.

      I haven't seen any evidence of this issue occurring elsewhere where get_complete_user_data() is called (e.g. rss/file.php); but of course, there may be other areas affected.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    1/Aug/11