Skip to content

Commit

Permalink
MDL-52599 blocks/rss_client: Fix RSS block config page
Browse files Browse the repository at this point in the history
This fixes an error where the RSS block config page would display
'Array' where the multiselect list of feeds should be when
accessed by a user who has not saved any RSS feed urls and yet the
block has been previously configured by another user.
  • Loading branch information
cdsmith-umn authored and danpoltawski committed May 16, 2016
1 parent 65cbefc commit af8cab9
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions blocks/rss_client/edit_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,22 @@ protected function specific_definition($mform) {
$mform->setDefault('config_shownumentries', 5);
}

$rssconfig = unserialize(base64_decode($this->block->instance->configdata));
list($insql, $inparams) = $DB->get_in_or_equal($rssconfig->rssid);

$queryparams = array('', $USER->id);
foreach ($inparams as $paramid) {
$queryparams[] = $paramid;
}
$queryparams[] = '';

$rssfeeds = $DB->get_records_sql_menu('
SELECT id,
CASE WHEN preferredtitle = ? THEN ' . $DB->sql_compare_text('title', 64) .' ELSE preferredtitle END
FROM {block_rss_client}
WHERE userid = ? OR shared = 1
WHERE userid = ? OR shared = 1 OR id '.$insql.'
ORDER BY CASE WHEN preferredtitle = ? THEN ' . $DB->sql_compare_text('title', 64) . ' ELSE preferredtitle END ',
array('', $USER->id, ''));
$queryparams);
if ($rssfeeds) {
$select = $mform->addElement('select', 'config_rssid', get_string('choosefeedlabel', 'block_rss_client'), $rssfeeds);
$select->setMultiple(true);
Expand Down

0 comments on commit af8cab9

Please sign in to comment.