Maintained by Shaun Daubney
A slightly more visually appealing RSS News Feed block for Moodle 2.0+
3k
143
5
Moodle 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9

More visually appealing RSS News Feed block for Moodle. Currently works best with BBC News feeds as it displays the pictures, but will work with any RSS.

Need help to get it to pull through other media content and images from other feed providers. If interested in helping me with this project, please get in touch.

### Contributors

• Thu, Apr 26, 2012, 10:29 AM
Is it possible to change the title of this block and if so how would I go about doing it?
• Thu, Aug 2, 2012, 9:46 PM
Darren, I had the same question and here is my solution - a little late but I only discovered this block a couple of days ago
Feedback + suggestions are welcome.

This will let you edit the title for each RSS Plus block independently. Three files need to be edited, make backups first!

* Add the following line to the language file, if your language is not en then change accordingly.

$string['blocktitle'] = 'RSS feed title'; /blocks/rss_plus/block_rss_plus.php * Replace the specialization function to use a feed title if one has been defined, otherwise use the default ---- Original code ---- function specialization() {$this->title = get_string('remotenewsfeed', 'block_rss_plus');

}

---- Modified code ----
function specialization() {
if (!empty($this->config->title)) {$this->title = $this->config->title; } else {$this->title = get_string('remotenewsfeed', 'block_rss_plus');
}
}

* Add three lines of code so that a title can be added for each RSS plus block
* This is a snippet of the code so that you put the lines in the correct place

---- Original code ----
protected function specific_definition($mform) { global$CFG, $DB,$USER;

// Fields for editing block contents.
$mform->addElement('header', 'configheader', get_string('blocksettings', 'block')); ***** put the new code here *****$mform->addElement('text', 'config_shownumentries', get_string('shownumentrieslabel', 'block_rss_plus'), array('size' => 5));

---- Afterwards your code should look like this ----
protected function specific_definition($mform) { global$CFG, $DB,$USER;

// Fields for editing block contents.
$mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));$mform->addElement('text', 'config_title', get_string('blocktitle', 'block_rss_plus'));
$mform->setDefault('config_title', 'Remote RSS feed');$mform->setType('config_title', PARAM_MULTILANG);

$mform->addElement('text', 'config_shownumentries', get_string('shownumentrieslabel', 'block_rss_plus'), array('size' => 5)); Obviously backup the original files first and try it on a dev server. You may need to purge the cache, but now you can customise the title to your hearts content Shaun - this is a fantastic block, thanks very much for contributing it :D George • Sun, Mar 31, 2013, 8:01 PM George, Thanks a million for this! I can edit the titles now so this rss block surpasses the default in terms of appearance. For some reason though, I cannot get it to pull images from RSS feeds outside of BBC feeds...I've even tried image feeds that provide small images but nothing.... Do you have any idea why it would only be successfully showing images for BBC feeds? • Fri, Aug 2, 2013, 5:37 PM At the moment it pulls through the thumbnails associated with the RSS feed which is only really supported by BBC feeds. I don't know how to make it pull through images from content. • Sun, Dec 22, 2013, 5:31 PM Hi Shaun, I have been looking for something like this as our new site is using your base theme. I have had a close look at the RSS code on the Stuff (Dominion Post Wellington NZ) site and they have thumbnail images within each RSS post. Will your RSS Plus block work with this? Here is the link: http://www.stuff.co.nz/rss/ • Wed, Jan 8, 2014, 1:46 AM Hi Mark, I've just replied by email but here's a summary for everyone else too. Hi Mark, It doesn't work with it (with images) straight off the shelf, although it works without the images. It WILL work with changing just 1 line in the code though. Line 249 of block_rss_plus.php CHANGE foreach ((array)$enclosure->get_thumbnail(1) as $thumbnail) TO foreach ((array)$enclosure->get_link() as \$thumbnail)

Then it works.
• Fri, May 29, 2015, 5:18 AM
Sean,

@set_time_limit(60);

To this:

php_time_limit::raise(60);

php_time_limit::raise will not alter the time limit or max execution time if in CLI mode (which cron always is). As it is now, RSS Plus' cron method leaves my php_max_execution time at 60 for all other jobs.

Thanks,
Brendan

• Mon, Jun 1, 2015, 4:58 PM
Hi Brendan,

Shaun
• Mon, Jun 1, 2015, 8:51 PM
Thanks Shaun. But I made a typo. The class name is core_php_time_limit not php_time_limit. By bad.
• Mon, Jun 1, 2015, 8:56 PM
Fixed
• Tue, Jun 2, 2015, 12:40 AM
Shaun,

Works great, thanks a lot.

I have a hack to this plugin that I would be happy to convert into a feature if you are interested. It adds a "Read more" link to the bottom of each entry in the feed. I guess the way to go would be to add a configuration option for people to show the link or not.

Is that something you would consider committing if I submitted a patch?

Thanks,
Brendan
• Wed, Jun 3, 2015, 8:08 PM
I'd also like to add a feature to make the use of break_up_long_words() on line 225 of block_rss_plus.php optional or configurable.
• Wed, Jun 3, 2015, 8:52 PM
Or maybe implementing a renderer is the way to go. That way you don't introduce any new (maybe complicated) configuration options to administrators while allowing themers the flexibility to control the markup. Again, I am happy to contribute this. Let me know.