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

External badge image not displayed in some cases

    XMLWordPrintable

Details

    • MOODLE_311_STABLE
    • MOODLE_311_STABLE
    • MDL-73153-311
    • MDL-73153-master
    • Hide

      Prerequisites

      1. An outgoing server configured (mailcacher or similar).
      2. One Badgr account on badgr.io with some badges and a collection (you'll find one testing account in the "Moodle testing accounts, data & credentials"). At least one of these badges should have filled the image author name/email/URL or image caption (in the testing account, that's the "Literature expert" badge).
      3. Debugging for developers enabled in Moodle.

      Setup

      1. Login as admin.
      2. Go to "Preferences / Badges / Backpack settings".
      3. Connect to the backpack using the Badgr.io account.
      4. Open the verification email and open the URL to validate the account.
      5. Confirm status is set to Connected.
      6. In the "Badge import settings" section (in the "Backpack settings" page), select at least one collection with badges and save changes (if you are using the testing account, you should select the "All my badges" collection).

      Testing scenario 1: The fields are displayed properly

      1. Login as admin.
      2. Go to the user profile page.
      3. Check there is, at least, one badge in the "Badges from other web sites:" section.
      4. Check the following warning is not displayed: "Warning: htmlspecialchars() expects parameter 1 to be string, object given in moodle/lib/weblib.php on line 100"
      5. Check the "alt" attribute for the badge image is the caption defined in the badge (if you're using the testing account, the caption for the "Literature expect" badge is "Library with a door").
      6. Open the badge containing author/caption information from the "Badges from other web sites:" section (if you're using the testing account, that's the "Literature expert" badge).
      7. Check the following warning is not displayed: "Warning: htmlspecialchars() expects parameter 1 to be string, object given in moodle/lib/weblib.php on line 100"
      8. Check the "alt" attribute for the badge image is the caption defined in the badge (if you're using the testing account, the caption for the "Literature expect" badge is "Library with a door").
      9. Check the "More details" section is displayed (only for master branch).
      10. Check it contains author and caption fields (only for master branch).
      Show
      Prerequisites An outgoing server configured (mailcacher or similar). One Badgr account on badgr.io with some badges and a collection (you'll find one testing account in the "Moodle testing accounts, data & credentials"). At least one of these badges should have filled the image author name/email/URL or image caption (in the testing account, that's the "Literature expert" badge). Debugging for developers enabled in Moodle. Setup Login as admin. Go to "Preferences / Badges / Backpack settings". Connect to the backpack using the Badgr.io account. Open the verification email and open the URL to validate the account. Confirm  status is set to Connected. In the "Badge import settings" section (in the "Backpack settings" page), select at least one collection with badges and save changes (if you are using the testing account, you should select the "All my badges" collection). Testing scenario 1: The fields are displayed properly Login as admin. Go to the user profile page. Check there is, at least, one badge in the "Badges from other web sites:" section. Check the following warning is not displayed: "Warning: htmlspecialchars() expects parameter 1 to be string, object given in moodle/lib/weblib.php on line 100" Check the "alt" attribute for the badge image is the caption defined in the badge (if you're using the testing account, the caption for the "Literature expect" badge is "Library with a door"). Open the badge containing author/caption information from the "Badges from other web sites:" section (if you're using the testing account, that's the "Literature expert" badge). Check the following warning is not displayed: "Warning: htmlspecialchars() expects parameter 1 to be string, object given in moodle/lib/weblib.php on line 100" Check the "alt" attribute for the badge image is the caption defined in the badge (if you're using the testing account, the caption for the "Literature expect" badge is "Library with a door"). Check the "More details" section is displayed (only for master branch). Check it contains author and caption fields (only for master branch).
    • Moppies Kanban

    Description

      While creating a user for testing purposes I've faced the following error: external badges with additional information in their badge images, such as the author details or the caption, are raising the following error:

      Warning: htmlspecialchars() expects parameter 1 to be string, object given in moodle/lib/weblib.php on line 100 
      

       

      The problem is that, when this data is present, the image field doesn't contain the image URL; in that case, it's an object with several fields, so it should be processed properly to get the URL.

      Attachments

        1. MDL-73153_master_setup.png
          MDL-73153_master_setup.png
          91 kB
        2. MDL-73153_master_step 3-5.png
          MDL-73153_master_step 3-5.png
          202 kB
        3. MDL-73153_master_step 7-10.png
          MDL-73153_master_step 7-10.png
          391 kB
        4. MDL-73153_v311_setup.png
          MDL-73153_v311_setup.png
          99 kB
        5. MDL-73153_v311_step 3-5.png
          MDL-73153_v311_step 3-5.png
          155 kB
        6. MDL-73153_v311_step 7-8.png
          MDL-73153_v311_step 7-8.png
          386 kB

        Issue Links

          Activity

            People

              sarjona Sara Arjona (@sarjona)
              sarjona Sara Arjona (@sarjona)
              Amaia Anabitarte Amaia Anabitarte
              Jun Pataleta Jun Pataleta
              Angelia Dela Cruz Angelia Dela Cruz
              Yuliya Bozhko, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                17/Jan/22

                Time Tracking

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