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

Some users cannot update their profile because of external locked fields

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.5, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.6, 1.6.1, 1.6.2, 1.6.3, 1.7
    • Fix Version/s: 1.9
    • Component/s: General
    • Labels:
      None
    • Database:
      Any
    • Affected Branches:
      MOODLE_15_STABLE, MOODLE_16_STABLE, MOODLE_17_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      Users having special characters in some external locked fields (e.g. O'Brien for lastname) cannot update their profile.
      They get the error message:
      Could not update the user record ([user id])
      because of database error:
      You have an error in your SQL syntax; check the manual that corresponds to your (My)SQL server version for the right syntax to use near...

      Replacing line 160 in user/edit.php
      $usernew->$field = $user->$field;
      with
      $usernew->$field = addslashes(clean_text(stripslashes(trim($user->$field)), FORMAT_MOODLE));
      solves the problem.
      As it was suggested in old tracker, bug #4073.

      Note that a (poor) workaround is to update the user profile as Moodle Admin because he can override the locked fields.

        Attachments

          Activity

            People

            Assignee:
            skodak Petr Skoda
            Reporter:
            saint-georges Arnaud saint-Georges
            Tester:
            Nobody
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              3/Mar/08