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

No standard, theme-overridable, way to get user profile image url

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.6, 3.7, 3.8, 3.9.2
    • Fix Version/s: None
    • Component/s: Forum, HTML and CSS, Messages, Themes
    • Labels:
    • Affected Branches:
      MOODLE_36_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE

      Description

      Most code that displays a user image goes through the render_user_picture renderer, which allows themes to override it.

      Some other bits of code, do their own thing to get the url, such as messaging which creates a user object, creates a user_picture object from that, then calls get_url on it and builds the HTML for the user image in the template.

      This means that the user icons in messaging differ from the others in ways that might be small or big depending on what the theme does.

      e.g. someone might set the border radius on .userpicture and expect it to affect all .userpictures, but the user picture in the message interface will have rounded-circle forced on it. Or might use the defaultuserpic class to style default user pics, which user pics in the message interface won't be affected by. Or a security minded theme might want to only display uploaded images to certain types of user.

       

      Possibly a render_user_picture_url() function that accepts a user_picture object might work (not sure how that fits with the magic naming scheme, might need a different name) and that could be used within the render_user_picture() function as well as elsewhere.

      Or the messaging interface could calle render_user_picture and then use the standard HTML that is returned.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            bawjaws David Scotson
            Participants:
            Component watchers:
            Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Amy Groshek, David Scotson, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Bas Brands
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated: