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

"Invalid user" error when non-logged user attempts to access student profile

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.5.1
    • Fix Version/s: 2.5.3
    • Component/s: Badges
    • Labels:
    • Environment:
      Moodle2.5.1
    • Database:
      MySQL
    • Testing Instructions:
      Hide

      To test, you need badges enabled.

      1. Set forceloginforprofiles and forcelogin to no.
      2. Make sure you can view any user profile page without "Invalid user" error.
      3. Log in as any user.
      4. Make sure you can view your own and other users profile pages without "Invalid user" errors.

      Show
      To test, you need badges enabled. 1. Set forceloginforprofiles and forcelogin to no. 2. Make sure you can view any user profile page without "Invalid user" error. 3. Log in as any user. 4. Make sure you can view your own and other users profile pages without "Invalid user" errors.
    • Affected Branches:
      MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-41662_master

      Description

      Similar to MDL-37177. But, show error for every user's profile.(See Picture: not loggedin)
      I am using Moodle2.5.1.
      I only noticed this error after I enabled Badges.
      A student can have Badges displayed right under profile, looks good.(see Picture: loggedin)
      I want the Badges can be displayed for public (without log in account) to view.
      I managed to display via Mozella Open Badges, that is OK enough.
      But the error is annoying.
      Tried to disable Badges, it is too late.
      I can give you an admin account to fix my site.

      Thanks

        Gliffy Diagrams

        1. loggedin.jpg
          56 kB
        2. notloggedin.jpg
          47 kB

          Activity

          Hide
          ybozhko Yuliya Bozhko added a comment -

          Hi Wenxin,

          I was able to replicate the problem. Will fix it today. Meantime, why do you say "Tried to disable Badges, it is too late."?...

          As a temporary solution, you can try enabling "forceloginforprofiles" and "forcelogin" settings on your web site if it possible.

          Yuliya

          Show
          ybozhko Yuliya Bozhko added a comment - Hi Wenxin, I was able to replicate the problem. Will fix it today. Meantime, why do you say "Tried to disable Badges, it is too late."?... As a temporary solution, you can try enabling "forceloginforprofiles" and "forcelogin" settings on your web site if it possible. Yuliya
          Hide
          wenxin Wenxin Lu added a comment -

          Dear Yuliya,
          I've set:
          1.Force users to login=no; 2. Force users to login for profiles=no; 3. Force users to login to view user pictures=no.
          The 'invalid user' still stay there.

          'too late'>>>As long as you started to using Badges, after the first badge issued to a students, you have no way to get it back. No way to disable the Badge Module. No way to clean Badges from your Moodle, thus no way for me to remove that error.

          Thank you again for your quick reply.

          Show
          wenxin Wenxin Lu added a comment - Dear Yuliya, I've set: 1.Force users to login=no; 2. Force users to login for profiles=no; 3. Force users to login to view user pictures=no. The 'invalid user' still stay there. 'too late'>>>As long as you started to using Badges, after the first badge issued to a students, you have no way to get it back. No way to disable the Badge Module. No way to clean Badges from your Moodle, thus no way for me to remove that error. Thank you again for your quick reply.
          Hide
          ybozhko Yuliya Bozhko added a comment -

          Hi Wenxin,

          You need to ENABLE "forceloginforprofiles" and "forcelogin" setting for the temporary solution that I suggested. This will make users to login when viewing other's profiles and can be a temporary workaround. Error that you are getting right now is due to global $USER capability issue when users are not logged in.

          Also, in "Site Admin > Advanced Features" there is "Enable badges" setting that you can DISABLE to turn the feature completely off.

          Yuliya

          Show
          ybozhko Yuliya Bozhko added a comment - Hi Wenxin, You need to ENABLE "forceloginforprofiles" and "forcelogin" setting for the temporary solution that I suggested. This will make users to login when viewing other's profiles and can be a temporary workaround. Error that you are getting right now is due to global $USER capability issue when users are not logged in. Also, in "Site Admin > Advanced Features" there is "Enable badges" setting that you can DISABLE to turn the feature completely off. Yuliya
          Hide
          wenxin Wenxin Lu added a comment -

          Dear Yuliya,

          I followed your instruction to set "Enable Badges"=off, and the error Gone!
          Yes, it works, Moodle Badges can be off.
          Thank you very much.
          Looking forwards to seeing Badges to getting better.

          Cheers

          Show
          wenxin Wenxin Lu added a comment - Dear Yuliya, I followed your instruction to set "Enable Badges"=off, and the error Gone! Yes, it works, Moodle Badges can be off. Thank you very much. Looking forwards to seeing Badges to getting better. Cheers
          Hide
          abgreeve Adrian Greeve added a comment -

          [Y] Syntax
          [Y] Whitespace
          [Y] Output
          [-] Language
          [-] Databases
          [Y] Testing (instructions and automated tests)
          [-] Security
          [-] Documentation
          [Y] Git
          [Y] Sanity check

          Hello Yuliya,

          I see no problem with this fix. Please submit for integration.

          Thanks.

          Show
          abgreeve Adrian Greeve added a comment - [Y] Syntax [Y] Whitespace [Y] Output [-] Language [-] Databases [Y] Testing (instructions and automated tests) [-] Security [-] Documentation [Y] Git [Y] Sanity check Hello Yuliya, I see no problem with this fix. Please submit for integration. Thanks.
          Hide
          ybozhko Yuliya Bozhko added a comment -

          Thanks, Adrian! Will do!

          Show
          ybozhko Yuliya Bozhko added a comment - Thanks, Adrian! Will do!
          Hide
          samhemelryk Sam Hemelryk added a comment -

          Thanks Yuliya this has been integrated now.

          Show
          samhemelryk Sam Hemelryk added a comment - Thanks Yuliya this has been integrated now.
          Hide
          rwijaya Rossiani Wijaya added a comment -

          This is working as expected.

          Tested for 2.5 and master.

          Test passed.

          Show
          rwijaya Rossiani Wijaya added a comment - This is working as expected. Tested for 2.5 and master. Test passed.
          Hide
          samhemelryk Sam Hemelryk added a comment -

          Yarrr me 'arties, good job done. Yer code 'as landed and the weeklies ave been released with your contributions in tow.
          The brethren thank ya for yer 'ard work and if there'd been treasure to ave ya would ave got yer cut.

          Thanks for the effort everyone, another successful weekly release has been rolled.
          Please keep in mind code freeze is just around the corner now, get your new features and improvements in ASAP.

          Many thanks
          Sam

          Show
          samhemelryk Sam Hemelryk added a comment - Yarrr me 'arties, good job done. Yer code 'as landed and the weeklies ave been released with your contributions in tow. The brethren thank ya for yer 'ard work and if there'd been treasure to ave ya would ave got yer cut. Thanks for the effort everyone, another successful weekly release has been rolled. Please keep in mind code freeze is just around the corner now, get your new features and improvements in ASAP. Many thanks Sam

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                11/Nov/13