Home -> PredWeb Joomla! Blog -> Modification of mod_poll - always show most recent poll. Joomla 1.5.x
Modification of mod_poll - always show most recent poll. Joomla 1.5.x
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.
List All Products |
|
| Lost Password? | |
| Forgot your username? | |
| No account yet? Register | |
|
|
|
| Download Area |





Comments
I will install on my websites.
Yes, it is easy. Just open file "root/modules/mod_poll/tmpl/default.php" and swap lines 37 and 39
RSS feed for comments to this post.