diff --git a/.upgradenotes/MDL-83909-2025013112303352.yml b/.upgradenotes/MDL-83909-2025013112303352.yml new file mode 100644 index 00000000000..786831a546a --- /dev/null +++ b/.upgradenotes/MDL-83909-2025013112303352.yml @@ -0,0 +1,10 @@ +issueNumber: MDL-83909 +notes: + core_badges: + - message: >- + The fields imageauthorname, imageauthoremail, and imageauthorurl have + been removed from badges due to confusion and their absence from the + official specification. These fields also do not appear in OBv3.0. + Additionally, the image_author_json.php file has been removed as it is + no longer needed. + type: removed diff --git a/backup/moodle2/backup_stepslib.php b/backup/moodle2/backup_stepslib.php index e1e75bffc3c..2f620905da0 100644 --- a/backup/moodle2/backup_stepslib.php +++ b/backup/moodle2/backup_stepslib.php @@ -928,8 +928,7 @@ class backup_badges_structure_step extends backup_structure_step { 'timecreated', 'timemodified', 'usercreated', 'usermodified', 'issuername', 'issuerurl', 'issuercontact', 'expiredate', 'expireperiod', 'type', 'courseid', 'message', 'messagesubject', 'attachment', 'notification', 'status', 'nextcron', - 'version', 'language', 'imageauthorname', 'imageauthoremail', 'imageauthorurl', - 'imagecaption')); + 'version', 'language', 'imagecaption')); $criteria = new backup_nested_element('criteria'); $criterion = new backup_nested_element('criterion', array('id'), array('badgeid', diff --git a/backup/moodle2/restore_stepslib.php b/backup/moodle2/restore_stepslib.php index 12506966ee7..c1c749322a4 100644 --- a/backup/moodle2/restore_stepslib.php +++ b/backup/moodle2/restore_stepslib.php @@ -2789,9 +2789,6 @@ class restore_badges_structure_step extends restore_structure_step { 'nextcron' => $data->nextcron, 'version' => $data->version, 'language' => $data->language, - 'imageauthorname' => $data->imageauthorname, - 'imageauthoremail' => $data->imageauthoremail, - 'imageauthorurl' => $data->imageauthorurl, 'imagecaption' => $data->imagecaption ); diff --git a/badges/badge_json.php b/badges/badge_json.php index 3c9659e0394..45574b1e359 100644 --- a/badges/badge_json.php +++ b/badges/badge_json.php @@ -47,23 +47,12 @@ if ($badge->status != BADGE_STATUS_INACTIVE) { $json['name'] = $badge->name; $json['description'] = $badge->description; - if ($badge->imageauthorname || - $badge->imageauthoremail || - $badge->imageauthorurl || - $badge->imagecaption) { - $urlimage = moodle_url::make_pluginfile_url($context->id, - 'badges', 'badgeimage', $badge->id, '/', 'f3')->out(false); - $json['image'] = array(); - $json['image']['id'] = $urlimage; - if ($badge->imageauthorname || $badge->imageauthoremail || $badge->imageauthorurl) { - $authorimage = new moodle_url('/badges/image_author_json.php', array('id' => $badge->id)); - $json['image']['author'] = $authorimage->out(false); - } - if ($badge->imagecaption) { - $json['image']['caption'] = $badge->imagecaption; - } - } else { - $json['image'] = $urlimage; + $urlimage = moodle_url::make_pluginfile_url($context->id, + 'badges', 'badgeimage', $badge->id, '/', 'f3')->out(false); + $json['image'] = []; + $json['image']['id'] = $urlimage; + if ($badge->imagecaption) { + $json['image']['caption'] = $badge->imagecaption; } $params = ['id' => $badge->id]; diff --git a/badges/classes/assertion.php b/badges/classes/assertion.php index 81fcd521893..4a0f89206e1 100644 --- a/badges/classes/assertion.php +++ b/badges/classes/assertion.php @@ -360,10 +360,7 @@ class core_badges_assertion { if ($alignments = $this->get_alignments()) { $json['alignments'] = $alignments; } - if ($this->_data->imageauthorname || - $this->_data->imageauthoremail || - $this->_data->imageauthorurl || - $this->_data->imagecaption) { + if ($this->_data->imagecaption) { $storage = get_file_storage(); $imagefile = $storage->get_file($context->id, 'badges', 'badgeimage', $this->_data->id, '/', 'f3.png'); if ($imagefile) { diff --git a/badges/classes/badge.php b/badges/classes/badge.php index 6ecc87fee30..498ef431d07 100644 --- a/badges/classes/badge.php +++ b/badges/classes/badge.php @@ -106,15 +106,6 @@ class badge { /** @var string What language is this badge written in. */ public $language; - /** @var string The author of the image for this badge. */ - public $imageauthorname; - - /** @var string The email of the author of the image for this badge. */ - public $imageauthoremail; - - /** @var string The url of the author of the image for this badge. */ - public $imageauthorurl; - /** @var string The caption of the image for this badge. */ public $imagecaption; @@ -985,9 +976,6 @@ class badge { $fordb->version = $data->version; $fordb->language = $data->language; $fordb->description = $data->description; - $fordb->imageauthorname = $data->imageauthorname; - $fordb->imageauthoremail = $data->imageauthoremail; - $fordb->imageauthorurl = $data->imageauthorurl; $fordb->imagecaption = $data->imagecaption; $fordb->timecreated = $now; $fordb->timemodified = $now; @@ -1047,9 +1035,6 @@ class badge { $this->version = trim($data->version); $this->language = $data->language; $this->description = $data->description; - $this->imageauthorname = $data->imageauthorname; - $this->imageauthoremail = $data->imageauthoremail; - $this->imageauthorurl = $data->imageauthorurl; $this->imagecaption = $data->imagecaption; $this->usermodified = $USER->id; $this->issuername = $data->issuername; diff --git a/badges/classes/external/user_badge_exporter.php b/badges/classes/external/user_badge_exporter.php index 1c7ad234a5f..23a522c2d7d 100644 --- a/badges/classes/external/user_badge_exporter.php +++ b/badges/classes/external/user_badge_exporter.php @@ -206,24 +206,6 @@ class user_badge_exporter extends exporter { 'optional' => true, 'null' => NULL_ALLOWED, ], - 'imageauthorname' => [ - 'type' => PARAM_TEXT, - 'description' => 'Name of the image author', - 'optional' => true, - 'null' => NULL_ALLOWED, - ], - 'imageauthoremail' => [ - 'type' => PARAM_TEXT, - 'description' => 'Email of the image author', - 'optional' => true, - 'null' => NULL_ALLOWED, - ], - 'imageauthorurl' => [ - 'type' => PARAM_URL, - 'description' => 'URL of the image author', - 'optional' => true, - 'null' => NULL_ALLOWED, - ], 'imagecaption' => [ 'type' => PARAM_TEXT, 'description' => 'Caption of the image', diff --git a/badges/classes/form/badge.php b/badges/classes/form/badge.php index 8774830657e..d67ee28a8e6 100644 --- a/badges/classes/form/badge.php +++ b/badges/classes/form/badge.php @@ -83,15 +83,6 @@ class badge extends moodleform { $mform->insertElementBefore($currentimage, 'image'); } $mform->addHelpButton('image', 'badgeimage', 'badges'); - $mform->addElement('text', 'imageauthorname', get_string('imageauthorname', 'badges'), ['size' => '70']); - $mform->setType('imageauthorname', PARAM_TEXT); - $mform->addHelpButton('imageauthorname', 'imageauthorname', 'badges'); - $mform->addElement('text', 'imageauthoremail', get_string('imageauthoremail', 'badges'), ['size' => '70']); - $mform->setType('imageauthoremail', PARAM_TEXT); - $mform->addHelpButton('imageauthoremail', 'imageauthoremail', 'badges'); - $mform->addElement('text', 'imageauthorurl', get_string('imageauthorurl', 'badges'), ['size' => '70']); - $mform->setType('imageauthorurl', PARAM_URL); - $mform->addHelpButton('imageauthorurl', 'imageauthorurl', 'badges'); $mform->addElement('text', 'imagecaption', get_string('imagecaption', 'badges'), ['size' => '70']); $mform->setType('imagecaption', PARAM_TEXT); $mform->addHelpButton('imagecaption', 'imagecaption', 'badges'); @@ -218,14 +209,6 @@ class badge extends moodleform { $errors['expirydategr'] = get_string('error:invalidexpiredate', 'badges'); } - if ($data['imageauthoremail'] && !validate_email($data['imageauthoremail'])) { - $errors['imageauthoremail'] = get_string('invalidemail'); - } - - if ($data['imageauthorurl'] && !preg_match('@^https?://.+@', $data['imageauthorurl'])) { - $errors['imageauthorurl'] = get_string('invalidurl', 'badges'); - } - return $errors; } } diff --git a/badges/classes/output/badgeclass.php b/badges/classes/output/badgeclass.php index c33944c789d..91c6634ad4b 100644 --- a/badges/classes/output/badgeclass.php +++ b/badges/classes/output/badgeclass.php @@ -119,18 +119,6 @@ class badgeclass implements renderable { $data->hasotherfields = true; $data->version = $this->badge->version; } - if (!empty($this->badge->imageauthorname)) { - $data->hasotherfields = true; - $data->imageauthorname = $this->badge->imageauthorname; - } - if (!empty($this->badge->imageauthoremail)) { - $data->hasotherfields = true; - $data->imageauthoremail = obfuscate_mailto($this->badge->imageauthoremail, $this->badge->imageauthoremail); - } - if (!empty($this->badge->imageauthorurl)) { - $data->hasotherfields = true; - $data->imageauthorurl = $this->badge->imageauthorurl; - } if (!empty($this->badge->imagecaption)) { $data->hasotherfields = true; $data->imagecaption = $this->badge->imagecaption; diff --git a/badges/classes/output/external_badge.php b/badges/classes/output/external_badge.php index e5a0f552234..fa960211b0f 100644 --- a/badges/classes/output/external_badge.php +++ b/badges/classes/output/external_badge.php @@ -125,10 +125,6 @@ class external_badge implements renderable { } $data->badgeimage = $this->issued->image; if (is_object($data->badgeimage)) { - if (!empty($data->badgeimage->author)) { - $data->hasotherfields = true; - $data->imageauthorname = $data->badgeimage->author; - } if (!empty($data->badgeimage->caption)) { $data->hasotherfields = true; $data->imagecaption = $data->badgeimage->caption; diff --git a/badges/classes/output/issued_badge.php b/badges/classes/output/issued_badge.php index 6fbf793ab93..3022c99778d 100644 --- a/badges/classes/output/issued_badge.php +++ b/badges/classes/output/issued_badge.php @@ -175,18 +175,6 @@ class issued_badge implements renderable { $data->hasotherfields = true; $data->version = $badge->version; } - if (!empty($badge->imageauthorname)) { - $data->hasotherfields = true; - $data->imageauthorname = $badge->imageauthorname; - } - if (!empty($badge->imageauthoremail)) { - $data->hasotherfields = true; - $data->imageauthoremail = obfuscate_mailto($badge->imageauthoremail, $badge->imageauthoremail); - } - if (!empty($badge->imageauthorurl)) { - $data->hasotherfields = true; - $data->imageauthorurl = $badge->imageauthorurl; - } if (!empty($badge->imagecaption)) { $data->hasotherfields = true; $data->imagecaption = $badge->imagecaption; diff --git a/badges/classes/privacy/provider.php b/badges/classes/privacy/provider.php index 826995be3fb..f98e60406ec 100644 --- a/badges/classes/privacy/provider.php +++ b/badges/classes/privacy/provider.php @@ -454,9 +454,6 @@ class provider implements 'name' => $badge->name, 'version' => $badge->version, 'language' => $badge->language, - 'imageauthorname' => $badge->imageauthorname, - 'imageauthoremail' => $badge->imageauthoremail, - 'imageauthorurl' => $badge->imageauthorurl, 'imagecaption' => $badge->imagecaption, 'issued' => null, 'manual_award' => null, diff --git a/badges/classes/reportbuilder/local/entities/badge.php b/badges/classes/reportbuilder/local/entities/badge.php index a205d5eed93..16b337d9e33 100644 --- a/badges/classes/reportbuilder/local/entities/badge.php +++ b/badges/classes/reportbuilder/local/entities/badge.php @@ -262,19 +262,6 @@ class badge extends base { } }); - // Image author details. - foreach (['imageauthorname', 'imageauthoremail', 'imageauthorurl'] as $imageauthorfield) { - $columns[] = (new column( - $imageauthorfield, - new lang_string($imageauthorfield, 'core_badges'), - $this->get_entity_name() - )) - ->add_joins($this->get_joins()) - ->set_type(column::TYPE_TEXT) - ->add_field("{$badgealias}.{$imageauthorfield}") - ->set_is_sortable(true); - } - return $columns; } diff --git a/badges/image_author_json.php b/badges/image_author_json.php deleted file mode 100644 index 50438dcdc17..00000000000 --- a/badges/image_author_json.php +++ /dev/null @@ -1,52 +0,0 @@ -. -/** - * Serve profile image author JSON for assertion. - * - * @package core - * @subpackage badges - * @copyright 2018 Tung Thai - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @author Tung Thai - */ - -define('AJAX_SCRIPT', true); -define('NO_MOODLE_COOKIES', true); // No need for a session here. -require_once(__DIR__ . '/../config.php'); -require_once($CFG->libdir . '/badgeslib.php'); - -if (empty($CFG->enablebadges)) { - throw new \moodle_exception('badgesdisabled', 'badges'); -} - -$id = required_param('id', PARAM_INT); // Unique hash of badge assertion. -$badge = new badge($id); - -$json = array(); -$authorimage = new moodle_url('/badges/image_author_json.php', array('id' => $badge->id)); -$json['id'] = $authorimage->out(false); -$json['type'] = OPEN_BADGES_V2_TYPE_AUTHOR; -if (!empty($badge->imageauthorname)) { - $json['name'] = $badge->imageauthorname; -} -if (!empty($badge->imageauthoremail)) { - $json['email'] = $badge->imageauthoremail; -} -if (!empty($badge->imageauthorurl)) { - $json['url'] = $badge->imageauthorurl; -} -echo $OUTPUT->header(); -echo json_encode($json); \ No newline at end of file diff --git a/badges/renderer.php b/badges/renderer.php index 363ee5bc78f..947672912ca 100644 --- a/badges/renderer.php +++ b/badges/renderer.php @@ -186,11 +186,6 @@ class core_badges_renderer extends plugin_renderer_base { $dl[get_string('description', 'badges')] = $badge->description; $dl[get_string('createdon', 'search')] = userdate($badge->timecreated); $dl[get_string('badgeimage', 'badges')] = print_badge_image($badge, $context, 'large'); - $dl[get_string('imageauthorname', 'badges')] = $badge->imageauthorname; - $dl[get_string('imageauthoremail', 'badges')] = - html_writer::tag('a', $badge->imageauthoremail, array('href' => 'mailto:' . $badge->imageauthoremail)); - $dl[get_string('imageauthorurl', 'badges')] = - html_writer::link($badge->imageauthorurl, $badge->imageauthorurl, array('target' => '_blank')); $dl[get_string('imagecaption', 'badges')] = $badge->imagecaption; $tags = \core_tag_tag::get_item_tags('core_badges', 'badge', $badge->id); $dl[get_string('tags', 'badges')] = $this->output->tag_list($tags, ''); diff --git a/badges/templates/issued_badge.mustache b/badges/templates/issued_badge.mustache index 41dedd50848..1e3add38764 100644 --- a/badges/templates/issued_badge.mustache +++ b/badges/templates/issued_badge.mustache @@ -37,9 +37,6 @@ * hasotherfields - Wheter the badge has other fields or not. * language - Badge language [optional]. * version - Badge version [optional]. - * imageauthorname - Badge image author name [optional]. - * imageauthoremail - Badge image author email [optional]. - * imageauthorurl - Badge image author URL [optional]. * imagecaption - Badge image caption [optional]. * endorsement - Badge endorsement data, with id, badgeid, issuername... [optional]. * hasrelatedbadges - Whether the badge has related badges or not. @@ -66,9 +63,6 @@ "hasotherfields": true, "language": "English", "version": "1.0beta", - "imageauthorname": "Judit Blanque", - "imageauthoremail": "judit@moodle.invalid", - "imageauthorurl": "http://juditblanque.cat", "imagecaption": "This is a nice picture from my cat", "endorsement": { "id": "2", @@ -253,38 +247,6 @@ {{/language}} - {{#imageauthorname}} -
-
- {{#str}}imageauthorname, core_badges{{/str}} -
-
- {{imageauthorname}} -
-
- {{/imageauthorname}} - - {{#imageauthoremail}} -
-
- {{#str}}imageauthoremail, core_badges{{/str}} -
-
- {{{imageauthoremail}}} -
-
- {{/imageauthoremail}} - - {{#imageauthorurl}} -
-
- {{#str}}imageauthorurl, core_badges{{/str}} -
-
- {{imageauthorurl}} -
-
- {{/imageauthorurl}} {{#imagecaption}}
diff --git a/badges/tests/badge_test.php b/badges/tests/badge_test.php index b98d6b53e68..b4e787bb686 100644 --- a/badges/tests/badge_test.php +++ b/badges/tests/badge_test.php @@ -288,9 +288,6 @@ final class badge_test extends \advanced_testcase { 'status' => BADGE_STATUS_ACTIVE_LOCKED, 'version' => OPEN_BADGES_V2, 'language' => 'en', - 'imageauthorname' => 'Image author', - 'imageauthoremail' => 'author@example.com', - 'imageauthorurl' => 'http://image.example.com/', 'imagecaption' => 'Image caption', 'tags' => [], ]; diff --git a/badges/tests/badgeslib_test.php b/badges/tests/badgeslib_test.php index 55a16b83d55..2514c7fc62f 100644 --- a/badges/tests/badgeslib_test.php +++ b/badges/tests/badgeslib_test.php @@ -65,9 +65,6 @@ final class badgeslib_test extends badges_testcase { $this->assertEquals($badge->version, $clonedbadge->version); $this->assertEquals($badge->language, $clonedbadge->language); $this->assertEquals($badge->imagecaption, $clonedbadge->imagecaption); - $this->assertEquals($badge->imageauthorname, $clonedbadge->imageauthorname); - $this->assertEquals($badge->imageauthoremail, $clonedbadge->imageauthoremail); - $this->assertEquals($badge->imageauthorurl, $clonedbadge->imageauthorurl); } public function test_badge_status(): void { @@ -251,9 +248,6 @@ final class badgeslib_test extends badges_testcase { $badge->version = "Version $i"; $badge->language = "en"; $badge->imagecaption = "Image caption $i"; - $badge->imageauthorname = "Image author's name $i"; - $badge->imageauthoremail = "author$i@example.com"; - $badge->imageauthorname = "Image author's name $i"; $badgeid = $DB->insert_record('badge', $badge, true); $badges[$badgeid] = new badge($badgeid); @@ -332,9 +326,6 @@ final class badgeslib_test extends badges_testcase { $badge->version = "Version $i"; $badge->language = "en"; $badge->imagecaption = "Image caption"; - $badge->imageauthorname = "Image author's name"; - $badge->imageauthoremail = "author@example.com"; - $badge->imageauthorname = "Image author's name"; $badgeid = $DB->insert_record('badge', $badge, true); $badges[$badgeid] = new badge($badgeid); diff --git a/badges/tests/behat/add_badge.feature b/badges/tests/behat/add_badge.feature index 9229bb0d31f..2a573823252 100644 --- a/badges/tests/behat/add_badge.feature +++ b/badges/tests/behat/add_badge.feature @@ -32,7 +32,6 @@ Feature: Add badges to the system | Version | v1 | | Language | English | | Description | Test badge description | - | Image author | http://author.example.com | | Image caption | Test caption image | | Tags | Math, Physics | | Issuer contact | issuer@example.com | @@ -63,7 +62,6 @@ Feature: Add badges to the system | Version | v1 | | Language | French | | Description | Test badge related description | - | Image author | http://author.example.com | | Image caption | Test caption image | And I upload "badges/tests/behat/badge.png" file to "Image" filemanager And I press "Create badge" @@ -74,7 +72,6 @@ Feature: Add badges to the system | Version | v2 | | Language | English | | Description | Test badge description | - | Image author | http://author.example.com | | Image caption | Test caption image | And I upload "badges/tests/behat/badge.png" file to "Image" filemanager And I press "Create badge" @@ -96,7 +93,6 @@ Feature: Add badges to the system | Version | v1 | | Language | English | | Description | Test badge description | - | Image author | http://author.example.com | | Image caption | Test caption image | And I upload "badges/tests/behat/badge.png" file to "Image" filemanager When I press "Create badge" @@ -120,7 +116,6 @@ Feature: Add badges to the system | Version | v1 | | Language | English | | Description | Test badge description | - | Image author | http://author.example.com | | Image caption | Test caption image | And I upload "badges/tests/behat/badge.png" file to "Image" filemanager When I press "Create badge" @@ -153,7 +148,6 @@ Feature: Add badges to the system | Version | v1 | | Language | English | | Description | Test badge description | - | Image author | http://author.example.com | | Image caption | Test caption image | And I upload "badges/tests/behat/badge.png" file to "Image" filemanager And I press "Create badge" @@ -180,7 +174,6 @@ Feature: Add badges to the system | language | ca | | description | Test badge description | | image | badges/tests/behat/badge.png | - | imageauthorurl | http://imtheauthor.example.com | | imagecaption | My caption image | | issuercontact | testuser@example.com | And the following "core_badges > Criterias" exist: @@ -195,7 +188,6 @@ Feature: Add badges to the system | Version | secondversion | | Language | English | | Description | Modified test badge description | - | Image author | http://author.example.com | | Image caption | Test caption image | | Tags | Math, History | | Issuer contact | issuer@invalid.cat | diff --git a/badges/tests/behat/backpack.feature b/badges/tests/behat/backpack.feature index 8a152fa991f..9f9d1758ff1 100644 --- a/badges/tests/behat/backpack.feature +++ b/badges/tests/behat/backpack.feature @@ -43,7 +43,6 @@ Feature: Backpack badges | language | en | | description | Test badge description | | image | badges/tests/behat/badge.png | - | imageauthorurl | http://author.example.com | | imagecaption | Test caption image | And the following "core_badges > Criteria" exists: | badge | Test badge verify backpack | @@ -72,7 +71,6 @@ Feature: Backpack badges | language | en | | description | Test badge description | | image | badges/tests/behat/badge.png | - | imageauthorurl | http://author.example.com | | imagecaption | Test caption image | And the following "core_badges > Criteria" exists: | badge | Test badge verify backpack | diff --git a/badges/tests/behat/badge_navigation.feature b/badges/tests/behat/badge_navigation.feature index c2dff101ec1..1ec71a78800 100644 --- a/badges/tests/behat/badge_navigation.feature +++ b/badges/tests/behat/badge_navigation.feature @@ -25,7 +25,6 @@ Feature: Test tertiary navigation as various users | language | ca | | description | Testing course badge description | | image | badges/tests/behat/badge.png | - | imageauthorurl | http://author.example.com | | imagecaption | Test caption image | # Create a site badge. And the following "core_badges > Badge" exists: @@ -35,7 +34,6 @@ Feature: Test tertiary navigation as various users | language | ca | | description | Testing site badge description | | image | badges/tests/behat/badge.png | - | imageauthorurl | http://author.example.com | | imagecaption | Test caption image | And the following "core_badges > Criterias" exist: | badge | role | diff --git a/badges/tests/behat/manage_badges.feature b/badges/tests/behat/manage_badges.feature index 6266610e888..210fb15274c 100644 --- a/badges/tests/behat/manage_badges.feature +++ b/badges/tests/behat/manage_badges.feature @@ -12,7 +12,6 @@ Feature: Manage badges | language | en | | description | Test badge description | | image | badges/tests/behat/badge.png | - | imageauthorurl | http://author.example.com | | imagecaption | Test caption image | Scenario: Copy a badge @@ -154,7 +153,6 @@ Feature: Manage badges | language | en | | description | Test badge description | | image | badges/tests/behat/badge.png | - | imageauthorurl | http://author.example.com | | imagecaption | Test caption image | And I log in as "admin" And I navigate to "Badges > Add a new badge" in site administration diff --git a/badges/tests/behat/nobadge_navigation.feature b/badges/tests/behat/nobadge_navigation.feature index 633137fe9a3..9e0f7f8f8f2 100644 --- a/badges/tests/behat/nobadge_navigation.feature +++ b/badges/tests/behat/nobadge_navigation.feature @@ -25,7 +25,6 @@ Feature: Badges not shown when there are no existing badges. | Version | 1.1 | | Language | Basque | | Description | Testing course badge description | - | Image author | http://author.example.com | | Image caption | Test caption image | And I upload "badges/tests/behat/badge.png" file to "Image" filemanager And I click on "Create badge" "button" diff --git a/badges/tests/behat/view_badge.feature b/badges/tests/behat/view_badge.feature index bb1bcddf34d..7be8131ad57 100644 --- a/badges/tests/behat/view_badge.feature +++ b/badges/tests/behat/view_badge.feature @@ -16,7 +16,6 @@ Feature: Display badges | language | ca | | description | Testing system badge description | | image | badges/tests/behat/badge.png | - | imageauthorurl | http://author.example.com | | imagecaption | My caption image | And the following "core_badges > Criterias" exist: | badge | role | diff --git a/badges/tests/classes/badges_testcase.php b/badges/tests/classes/badges_testcase.php index f7f2c53872e..91c5a265d9f 100644 --- a/badges/tests/classes/badges_testcase.php +++ b/badges/tests/classes/badges_testcase.php @@ -85,9 +85,6 @@ abstract class badges_testcase extends \advanced_testcase { $fordb->message = "Test message body"; $fordb->attachment = 1; $fordb->notification = 0; - $fordb->imageauthorname = "Image Author 1"; - $fordb->imageauthoremail = "author@example.com"; - $fordb->imageauthorurl = "http://author-url.example.com"; $fordb->imagecaption = "Test caption image"; $fordb->status = BADGE_STATUS_INACTIVE; diff --git a/badges/tests/external/external_test.php b/badges/tests/external/external_test.php index 1c63973ffd0..dbc0e13b57a 100644 --- a/badges/tests/external/external_test.php +++ b/badges/tests/external/external_test.php @@ -98,9 +98,6 @@ final class external_test extends externallib_advanced_testcase { $badge->status = BADGE_STATUS_ACTIVE; $badge->version = '1'; $badge->language = 'en'; - $badge->imageauthorname = 'Image author'; - $badge->imageauthoremail = 'imageauthor@example.com'; - $badge->imageauthorurl = 'http://image-author-url.domain.co.nz'; $badge->imagecaption = 'Caption'; $badgeid = $DB->insert_record('badge', $badge, true); diff --git a/badges/tests/external/get_badge_test.php b/badges/tests/external/get_badge_test.php index 0ace6cd5bac..5d53965f6fa 100644 --- a/badges/tests/external/get_badge_test.php +++ b/badges/tests/external/get_badge_test.php @@ -69,9 +69,6 @@ final class get_badge_test extends externallib_advanced_testcase { $badge->status = BADGE_STATUS_ACTIVE; $badge->version = '1'; $badge->language = 'en'; - $badge->imageauthorname = 'Image author'; - $badge->imageauthoremail = 'imageauthor@example.com'; - $badge->imageauthorurl = 'http://image-author-url.domain.co.nz'; $badge->imagecaption = 'Caption'; $badgeid = $DB->insert_record('badge', $badge, true); diff --git a/badges/tests/external/get_user_badge_by_hash_test.php b/badges/tests/external/get_user_badge_by_hash_test.php index 8eb3845e774..d5910dd5d46 100644 --- a/badges/tests/external/get_user_badge_by_hash_test.php +++ b/badges/tests/external/get_user_badge_by_hash_test.php @@ -77,9 +77,6 @@ final class get_user_badge_by_hash_test extends externallib_advanced_testcase { $badge->status = BADGE_STATUS_ACTIVE; $badge->version = '1'; $badge->language = 'en'; - $badge->imageauthorname = 'Image author'; - $badge->imageauthoremail = 'imageauthor@example.com'; - $badge->imageauthorurl = 'http://image-author-url.domain.co.nz'; $badge->imagecaption = 'Caption'; $badgeid = $DB->insert_record('badge', $badge, true); diff --git a/badges/tests/generator/lib.php b/badges/tests/generator/lib.php index 7d4ab149e5e..569f4e76215 100644 --- a/badges/tests/generator/lib.php +++ b/badges/tests/generator/lib.php @@ -69,9 +69,6 @@ class core_badges_generator extends component_generator_base { 'status' => BADGE_STATUS_ACTIVE, 'version' => OPEN_BADGES_V2, 'language' => 'en', - 'imageauthorname' => 'Image author', - 'imageauthoremail' => 'author@example.com', - 'imageauthorurl' => 'http://image.example.com/', 'imagecaption' => 'Image caption' ], $record); diff --git a/badges/tests/output/manage_badge_action_bar_test.php b/badges/tests/output/manage_badge_action_bar_test.php index 8567648b14a..b7c1a2466b8 100644 --- a/badges/tests/output/manage_badge_action_bar_test.php +++ b/badges/tests/output/manage_badge_action_bar_test.php @@ -118,9 +118,6 @@ final class manage_badge_action_bar_test extends \advanced_testcase { $badge->status = BADGE_STATUS_ACTIVE; $badge->version = '1'; $badge->language = 'en'; - $badge->imageauthorname = 'Image author'; - $badge->imageauthoremail = 'imageauthor@example.com'; - $badge->imageauthorurl = 'http://image-author-url.domain.co.nz'; $badge->imagecaption = 'Caption'; $coursebadgeid = $DB->insert_record('badge', $badge, true); $badge = new \core_badges\badge($coursebadgeid); diff --git a/badges/tests/privacy/provider_test.php b/badges/tests/privacy/provider_test.php index 11d914e3402..9fdceb2ca7b 100644 --- a/badges/tests/privacy/provider_test.php +++ b/badges/tests/privacy/provider_test.php @@ -342,9 +342,6 @@ final class provider_test extends provider_testcase { $this->assertEquals($b1->name, $data->name); $this->assertEquals($b1->version, $data->version); $this->assertEquals($b1->language, $data->language); - $this->assertEquals($b1->imageauthorname, $data->imageauthorname); - $this->assertEquals($b1->imageauthoremail, $data->imageauthoremail); - $this->assertEquals($b1->imageauthorurl, $data->imageauthorurl); $this->assertEquals($b1->imagecaption, $data->imagecaption); $this->assertNotEmpty($data->issued); $this->assertEmpty($data->manual_award); @@ -640,9 +637,6 @@ final class provider_test extends provider_testcase { 'status' => BADGE_STATUS_ACTIVE, 'version' => OPEN_BADGES_V2, 'language' => 'en', - 'imageauthorname' => 'Image author', - 'imageauthoremail' => 'author@example.com', - 'imageauthorurl' => 'http://image.example.com/', 'imagecaption' => 'Image caption' ], $params); $record->id = $DB->insert_record('badge', $record); diff --git a/lang/en/badges.php b/lang/en/badges.php index fa22b9eb0b2..7a1c6d63725 100644 --- a/lang/en/badges.php +++ b/lang/en/badges.php @@ -367,12 +367,6 @@ $string['hidden'] = 'Hidden'; $string['hiddenbadge'] = 'Unfortunately, the badge owner has not made this information available.'; $string['hostedurl'] = 'External URL'; $string['hostedurldescription'] = 'External URL where the badge is hosted'; -$string['imageauthoremail'] = 'Image author\'s email'; -$string['imageauthoremail_help'] = 'If specified, the email address of the badge image author is displayed on the badge page.'; -$string['imageauthorname'] = 'Image author\'s name'; -$string['imageauthorname_help'] = 'If specified, the name of the badge image author is displayed on the badge page.'; -$string['imageauthorurl'] = 'Image author\'s URL'; -$string['imageauthorurl_help'] = 'If specified, a link to the badge image author\'s website is displayed on the badge page. The URL should have a prefix http:// or https://.'; $string['invalidurl'] = 'Invalid URL'; $string['issuancedetails'] = 'Badge expiry'; $string['issuedbadge'] = 'Issued badge information'; @@ -601,3 +595,11 @@ $string['backpackemail_help'] = 'The email address associated with your backpack $string['error:cannotact'] = 'Cannot activate the badge. '; $string['error:duplicatename'] = 'Badge with such name already exists in the system.'; $string['reviewbadge'] = 'Changes in badge access'; + +// Deprecated since Moodle 5.0. +$string['imageauthoremail'] = 'Image author\'s email'; +$string['imageauthoremail_help'] = 'If specified, the email address of the badge image author is displayed on the badge page.'; +$string['imageauthorname'] = 'Image author\'s name'; +$string['imageauthorname_help'] = 'If specified, the name of the badge image author is displayed on the badge page.'; +$string['imageauthorurl'] = 'Image author\'s URL'; +$string['imageauthorurl_help'] = 'If specified, a link to the badge image author\'s website is displayed on the badge page. The URL should have a prefix http:// or https://.'; diff --git a/lang/en/deprecated.txt b/lang/en/deprecated.txt index 07336231c2e..52975470338 100644 --- a/lang/en/deprecated.txt +++ b/lang/en/deprecated.txt @@ -150,3 +150,9 @@ sitecommnews,core_hub sitecommnews_help,core_hub sitecommnewsyes,core_hub cc_import_req_php5,core_imscc +imageauthoremail,core_badges +imageauthoremail_help,core_badges +imageauthorname,core_badges +imageauthorname_help,core_badges +imageauthorurl,core_badges +imageauthorurl_help,core_badges diff --git a/lib/badgeslib.php b/lib/badgeslib.php index 510e118e160..62e3e7681fe 100644 --- a/lib/badgeslib.php +++ b/lib/badgeslib.php @@ -124,7 +124,6 @@ define('OPEN_BADGES_V2_TYPE_ASSERTION', 'Assertion'); define('OPEN_BADGES_V2_TYPE_BADGE', 'BadgeClass'); define('OPEN_BADGES_V2_TYPE_ISSUER', 'Issuer'); define('OPEN_BADGES_V2_TYPE_ENDORSEMENT', 'Endorsement'); -define('OPEN_BADGES_V2_TYPE_AUTHOR', 'Author'); define('BACKPACK_MOVE_UP', -1); define('BACKPACK_MOVE_DOWN', 1); @@ -445,9 +444,6 @@ function badges_prepare_badge_for_external(stdClass $badge, stdClass $user): obj 'dateexpire' => $badge->dateexpire, 'version' => $badge->version, 'language' => $badge->language, - 'imageauthorname' => $badge->imageauthorname, - 'imageauthoremail' => $badge->imageauthoremail, - 'imageauthorurl' => $badge->imageauthorurl, 'imagecaption' => $badge->imagecaption, ]; } diff --git a/lib/db/install.xml b/lib/db/install.xml index 6cef0858a37..c2f3622a06c 100644 --- a/lib/db/install.xml +++ b/lib/db/install.xml @@ -3192,9 +3192,6 @@ - - - diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 1cdcc28b500..b8eeffe40d4 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -1392,5 +1392,25 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint(true, 2025012400.01); } + if ($oldversion < 2025013100.01) { + // Remove imageauthorname, imageauthoremail and imageauthorurl fields for badges. + $table = new xmldb_table('badge'); + $fields = [ + 'imageauthorname', + 'imageauthoremail', + 'imageauthorurl', + ]; + + foreach ($fields as $field) { + $field = new xmldb_field($field); + if ($dbman->field_exists($table, $field)) { + $dbman->drop_field($table, $field); + } + } + + // Main savepoint reached. + upgrade_main_savepoint(true, 2025013100.01); + } + return true; } diff --git a/version.php b/version.php index 2e218ac513f..5e4479ac7af 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2025013100.00; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2025013100.01; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes. $release = '5.0dev (Build: 20250131)'; // Human-friendly version name