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

User images do not display in forum post e-mails when "Force users to log in" is enabled

    • MOODLE_26_STABLE
    • MDL-43850-main
    • Hide
      1. Test in browser
        1. Login as admin
        2. Edit your profile and set your User picture to an image
        3. Set forcelogin = 1
        4. Set forceloginforprofileimage = 1
        5. Visit your profile /user/profile.php and right click on the avatar to get its url eg
          https://master.localhost/pluginfile.php/5/user/icon/boost/f1?rev=71
        6. Load this URL in incognito mode and confirm it redirects and loads the generic placeholder
        7. Set forceloginforprofileimage = 0
        8. Load the avatar URL again in incognito mode and confirm it loads the real image without the redirect
      2. End to end test in emails eg using mailhog
        1. In a test course have two users subscribed to a forum
        2. In the forum as an admin user click Add discussion topic, then Advanced
        3. Add a test message and tick 'Send forum post notifications with no editing-time delay'
        4. Run cron
        5. Load mailhog, ideally in a new browser session to avoid all caching and sessions complications
        6. Check the inbox and confirm that the emails have a generic avatar
        7. As admin change the forceloginforprofileimage back to 0 
        8. Repeat the forum steps 2 & 3, then confirm the real image avatar is visible
      Show
      Test in browser Login as admin Edit your profile and set your User picture to an image Set forcelogin = 1 Set forceloginforprofileimage = 1 Visit your profile /user/profile.php and right click on the avatar to get its url eg https://master.localhost/pluginfile.php/5/user/icon/boost/f1?rev=71 Load this URL in incognito mode and confirm it redirects and loads the generic placeholder Set forceloginforprofileimage = 0 Load the avatar URL again in incognito mode and confirm it loads the real image without the redirect End to end test in emails eg using mailhog In a test course have two users subscribed to a forum In the forum as an admin user click Add discussion topic, then Advanced Add a test message and tick 'Send forum post notifications with no editing-time delay' Run cron Load mailhog, ideally in a new browser session to avoid all caching and sessions complications Check the inbox and confirm that the emails have a generic avatar As admin change the forceloginforprofileimage back to 0  Repeat the forum steps 2 & 3, then confirm the real image avatar is visible

      When Moodle's security settings are set to "Force users to log in" (forcelogin) under Security > Site Policies, user images are prevented from showing inline in popular mail programs such as Outlook and Gmail. Instead, the default user silhouette image displays.

      It would seem reasonable that an admin would want to enable forcelogin without categorically preventing user images from properly appearing in embedded HTML e-mail messages from forum posts. Actually, this other setting under Site Policies: "Force users to log in to view pictures" (forceloginforprofileimage) seems like it should be the setting that should govern this behavior, and its corresponding help text indicates as much: "If enabled, users must login in order to view user profile pictures and the default user picture will be used in all notification emails.". However, I have found that as soon as forcelogin is enabled, the user image will not appear in the e-mail message, regardless of how forceloginforprofileimage is set.

      I would recommend that if forcelogin is enabled and forceloginforprofileimage is disabled, the user image reference encoded in the HTML e-mail should display the user's proper image rather than the default silhouette image.

      This issue has been reported/discussed here:
      https://moodle.org/mod/forum/discuss.php?d=154699
      https://moodle.org/mod/forum/discuss.php?d=113788

            dobedobedoh Andrew Lyons
            jamatrucola Joe Amatrucola
            Brendan Heywood Brendan Heywood
            Votes:
            2 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 5 hours, 13 minutes
                5h 13m

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