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

After initial profile update, the user is not forward to wantsurl

XMLWordPrintable

    • MOODLE_34_STABLE
    • MDL-61591_forward_to_wantsurl
    • Hide
      1. Visit a course URL directly which requires authentication
      2. On the authentication form, sign in with an account with some of required profile fields unset, so the profile completion form appears after authentication
      3. After successfully saving the missing profile fields, the user should be redirected to the course URL stored in wantsurl session variable.
      Show
      Visit a course URL directly which requires authentication On the authentication form, sign in with an account with some of required profile fields unset, so the profile completion form appears after authentication After successfully saving the missing profile fields, the user should be redirected to the course URL stored in wantsurl session variable.

      When a user profile is not fully set up on first login and Moodle requests the profile completion, after saving the changes the client is not forward to the initial value of "$SESSION->wantsurl" but to his or hers profile.

      Example: a user tries to open a course URL from another system (an e-mail, for instance); Moodle shows the authentication form and the user uses an external authentication provider which does not provide all the required profile fields for moodle; moodle requests the missing data from the user and, when the user saves the form, is forward to the user profile instead of the initial course URL.

      Fixing this should be relatively easy. Here's my suggestion:

      diff --git a/user/edit.php b/user/edit.php
      index f837016..29d0ff5 100644
      --- a/user/edit.php
      +++ b/user/edit.php
      @@ -185,6 +185,8 @@ if ($usernew = $userform->get_data()) {
               } else {
                   $returnurl = new moodle_url('/user/profile.php', array('id' => $user->id));
               }
      +    } else if(!empty($SESSION->wantsurl)){
      +        $returnurl = $SESSION->wantsurl;
           } else {
               $returnurl = new moodle_url('/user/preferences.php', array('userid' => $user->id));
           }
      

      By adding those two lines the user should be forward to the initial requested URL.

        1. patch.txt
          0.5 kB
          Cláudio Esperança

            Unassigned Unassigned
            cesperanc@ Cláudio Esperança
            Dan Bennett Dan Bennett
            Votes:
            3 Vote for this issue
            Watchers:
            23 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.