PredWeb 3D Viewer - Joomla 1.5, 1.7 Module

PredWeb Joomla! 1.5, 1.7 Photo Editor

PredWeb Joomla! Photo Editor

PredWeb 3D Viewer - Stand Alone - Flash-XML-PHP Edition

PredWeb 3D Viewe - Stand Alone - Flash - XML - PHP

PredWeb Joomla! Blog

Modification of mod_poll - always show most recent poll. Joomla 1.5.x

Recently I had to modify the built-in Joomla! 1.5 module for the publication of polls, so it always shows the newest poll. The aim is, if you often use the component for polls, not each time to go to the Module Manager and change the module settings to post the latest poll.
Modification work on the following basis:
If in mod_poll module, in the Module Parameters -> Poll, no poll has been selected to be published, the module will always publish the latest poll. If a particular poll is selected for publication, the module will display the selected one.
To use the modification, you have to change file: root/modules/mod_poll/helper.php
Replace this code on line 24:
$query = 'SELECT id, title,'
.' CASE WHEN CHAR_LENGTH(alias) THEN CONCAT_WS(\':\', id, alias) ELSE id END as slug '
.' FROM #__polls'
.' WHERE id = '.(int) $id
.' AND published = 1'
;

with this code:
$query = 'SELECT id, title,'
.' CASE WHEN CHAR_LENGTH(alias) THEN CONCAT_WS(\':\', id, alias) ELSE id END as slug '
.' FROM #__polls';
if($id === '0'){
$query .=" WHERE id = (SELECT MAX(id) from #__polls)";
}else{
$query .=' WHERE id = '.(int) $id;
}
$query .=' AND published = 1';

And this code on line 44:
$query = 'SELECT id, text' .
' FROM #__poll_data' .
' WHERE pollid = ' . (int) $id .
' AND text <> ""' .
' ORDER BY id';

with this code:
$query = 'SELECT id, text' .
' FROM #__poll_data';
if($id === '0'){
$query .= " WHERE pollid = (SELECT MAX(id) from #__poll_data)";
}else{
$query .= ' WHERE pollid = ' . (int) $id;
}
$query .= ' AND text <> ""' .
' ORDER BY id';

If you wish, you can download the finished file with the changes from here:
http://www.predweb.com/downloads/PredWeb.com_modification_mod_poll.zip
and replace root/modules/mod_poll/helper.php with it.
 

Cart

VirtueMart
Your Cart is currently empty.