Here is the scenario:
- Several user's sign up on the site.
- I add a new field that is completed on the registration form, required, but not editable by user's after they've created their account.
- When a user goes to edit their profile, they can't see the field (they don't have the edit permission). However, when they try to save their profile, they get an error about a required field not being filled out.

Here is the change that I made on line 145:

      foreach (element_children($form[$category]) as $key) { // This line already there, everything below was added.
        // If the field is required but not set then never hide it as it will
        // throw an error that the field is required whether or not the user
        // can edit it. This happens when a required field is added after
        // the user already signed up.
        if (!empty($form[$category][$key]['#required']) &&
             empty($form[$category][$key]['#default_value'])) {
          continue;
        }
        // If field is restricted and current user does not have privilege to