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

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.

Comments  

 
+1 #4 arton 2011-11-09 12:36
Thank you for the extension.
I will install on my websites.
Quote
 
 
0 #3 RE: Modification of mod_poll - always show most recent poll. Joomla 1.5.xpredte4a 2011-07-01 02:42
Quoting dumbsim:
Hi! I've searched over the internet without finding a solution and maybe you can help me. In my website the buttons of mod_poll are inverted. The first one is Result and the second is Vote. I need to exchange them. Can you help me?

Yes, it is easy. Just open file "root/modules/mod_poll/tmpl/default.php" and swap lines 37 and 39
Quote
 
 
-1 #2 Need Help! 2011-05-03 16:15
Hi! I've searched over the internet without finding a solution and maybe you can help me. In my website the buttons of mod_poll are inverted. The first one is Result and the second is Vote. I need to exchange them. Can you help me?
Quote
 
 
-1 #1 Thanks! 2010-05-16 11:51
It works great!
Quote
 

Add comment


Security code
Refresh

Cart

VirtueMart
Your Cart is currently empty.