Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: clemenzo on June 09, 2007, 11:09:33 AM

Title: SMF Poll Mod
Post by: clemenzo on June 09, 2007, 11:09:33 AM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=765)

This mod will rotate 10 colours to the poll bars and allow voting from SSI block on default theme of SMF.

To use for this mod for custom theme, please unzip the mod archive and upload the poll folder and its content to your theme's images folder.

To show a poll in tinyportal block, add a block of type "phpbox" and enter the one of the following:

ssi_showPoll(X); - For a single fixed poll where X is a topic number.
random_poll(); - For a random poll from all boards accessible by user.
random_poll(Y); - For a random poll from all boards except Y where Y is a board number.
random_poll(array(Y, Z)); - For a random poll from all boards except Y, Z where Y and Z are board numbers.
random_poll(array(A, B, C), 'include'); - For a random poll from A, B, C where A, B and C are board numbers. Users unable to see board A would still be unable to see the poll from board A.


Demo
======

Default theme:

http://dev.voixbox.com/index.php?theme=1
http://dev.voixbox.com/index.php?theme=1&topic=2


Custom theme:

http://www.voixbox.com
http://www.voixbox.com/index.php?topic=15182.0
Title: Re: SMF Poll Mod
Post by: fangweile on June 09, 2007, 09:50:01 PM
thank you very much, this is really great smf enhancement.
Title: Re: SMF Poll Mod
Post by: clemenzo on June 09, 2007, 10:33:12 PM
Thank you for using it! Full credit can't go to me alone, I have only originated the rotating color poll bars logic and graphics. The rest of the voting codes came from Thurnok at tinyportal.net.

Though slicing the big code chunks before packaging them took me quite a while..
Title: Re: SMF Poll Mod
Post by: jdvarner on June 09, 2007, 10:50:12 PM
hey clemenzo,

this one rocks! thank you!
Title: Re: SMF Poll Mod
Post by: fangweile on June 09, 2007, 11:33:21 PM
It is really works in my forum, great work clemenzo
Title: Re: SMF Poll Mod
Post by: wilsy on June 10, 2007, 06:06:37 AM
Hi Clemenzo,

I have added to a TP block and it looks fine - but when I try to submit a vote from the block it returns an internal server error 500?

Everything else seems to be fine.

I am wondering if its because I have set the poll to let the members choose three options?

Regards,

Wilsy.
Title: Re: SMF Poll Mod
Post by: wilsy on June 10, 2007, 06:10:35 AM
QuoteI am wondering if its because I have set the poll to let the members choose three options?

Just set it to a poll with only one option and still get the error.

Regards,

Wilsy.
Title: Re: SMF Poll Mod
Post by: clemenzo on June 10, 2007, 09:20:01 AM
Did your installation complete without any error? Have you tried voting with the default SMF theme?
Title: Re: SMF Poll Mod
Post by: wilsy on June 10, 2007, 09:28:10 AM
Hi Clemenzo,

Yes, it all went in without error and the same error comes up when you try to vote from the block on the default theme.

I have attached my ssi.php in case it's of use to you.

Thanks Clemenzo.

Regards,

Wilsy.
Title: Re: SMF Poll Mod
Post by: clemenzo on June 10, 2007, 11:58:13 AM
Are you able to provide details of those error from your web server log? Any detail on the error in your SMF error log?
Title: Re: SMF Poll Mod
Post by: wilsy on June 10, 2007, 12:19:27 PM
Hi Clemenzo,

Yes, as below: -

Database Error: No database selected
File: /home/rewindla/public_html/forum/Sources/Subs.php
Line: 3364

I have attached the subs.php file.

Regards,

Wilsy.
Title: Re: SMF Poll Mod
Post by: clemenzo on June 10, 2007, 01:26:59 PM
I am not sure what could have caused the error. Do you have a development site which is like a clone to your main site?

If yes, you may want try to disable the Flashchat integration before voting from block again?
Title: Re: SMF Poll Mod
Post by: wilsy on June 10, 2007, 03:09:34 PM
Hi Clemenzo,

No dev site I'm afraid  :(

No worries - it's well outside of my very basic skills to contribute to solving this one. Hopefully someone else will come across the same error and can shed some light.

In the meantime I'll just keep the block switched off - thanks for taking a look though  :D

Regards,

Wilsy.
Title: Re: SMF Poll Mod
Post by: vosje505 on June 10, 2007, 06:44:50 PM
great mod :D thx 8)
Title: Re: SMF Poll Mod
Post by: clemenzo on June 10, 2007, 09:34:27 PM
Quote from: wilsy on June 10, 2007, 03:09:34 PM
Hi Clemenzo,

No dev site I'm afraid  :(

No worries - it's well outside of my very basic skills to contribute to solving this one. Hopefully someone else will come across the same error and can shed some light.

In the meantime I'll just keep the block switched off - thanks for taking a look though  :D

Regards,

Wilsy.

I think there is probably some conflicts with your existing mods in your SSI.php. Hence I suggested you disable all those mods one at a time and try voting from the block each.

My php knowledge is just as limited..
Title: Re: SMF Poll Mod
Post by: Giddeaon on June 11, 2007, 06:17:06 PM
Great mod - works flawlessly. 

as a side note - i would suggest adding a note to the readme about copying the "poll" folder to the themes image folder if you use a different theme than default. 
Title: Re: SMF Poll Mod
Post by: clemenzo on June 11, 2007, 08:58:09 PM
Quote from: Giddeaon on June 11, 2007, 06:17:06 PM
Great mod - works flawlessly. 

as a side note - i would suggest adding a note to the readme about copying the "poll" folder to the themes image folder if you use a different theme than default. 
Good point!
Title: Re: SMF Poll Mod
Post by: [Lucien] on June 12, 2007, 02:54:55 AM
I have the same problem, Internal Server Error when trying to vote...  :(
Title: Re: SMF Poll Mod
Post by: clemenzo on June 12, 2007, 10:04:39 AM
Quote from: somze on June 12, 2007, 02:54:55 AM
I have the same problem, Internal Server Error when trying to vote...  :(
What other mods have you installed?
Title: Re: SMF Poll Mod
Post by: [Lucien] on June 12, 2007, 10:29:00 AM
Quote from: clemenzo on June 12, 2007, 10:04:39 AM
Quote from: somze on June 12, 2007, 02:54:55 AM
I have the same problem, Internal Server Error when trying to vote... :(
What other mods have you installed?

Some Mods :)

1. Profil Moderator Managment 1.0.0   [ Uninstall ] [ List Files ] [ Delete ] 
2. Change Theme Permission 1.0   [ Uninstall ] [ List Files ] [ Delete ] 
3. Pretty URLs - Base 0.6  [ Apply Mod ] [ List Files ] [ Delete ] 
4. Use [color] Tags in [code] Mod 1.0  [ Apply Mod ] [ List Files ] [ Delete ] 
5. Youtube Field by Alan S 1.0   [ Uninstall ] [ List Files ] [ Delete ] 
6. Tagging System 1.0.3   [ Uninstall ] [ List Files ] [ Delete ] 
7. Seo 4 SMF 0.2.9.8  [ Apply Mod ] [ List Files ] [ Delete ] 
8. Custom Profile Field Mod 3.16   [ Uninstall ] [ List Files ] [ Delete ] 
9. Custom BBCode 2.00   [ Uninstall ] [ List Files ] [ Delete ] 
10.  Permission Mod 1.01   [ Uninstall ] [ List Files ] [ Delete ] 
11. Country Flags 1.0.1   [ Uninstall ] [ List Files ] [ Delete ] 
12. Board Viewers Mod 1.1   [ Uninstall ] [ List Files ] [ Delete ] 
13. Ad Managment 2.3   [ Uninstall ] [ List Files ] [ Delete ] 
14. SMF Poll Mod 1.0   [ Uninstall ] [ List Files ] [ Delete ] 
15. YouTube BBC Tag (XHTML Compliant) 1.0   [ Uninstall ] [ List Files ] [ Delete ] 
16. Display Age and Location next to posts 1.0   [ Uninstall ] [ List Files ] [ Delete ] 
17. Gender On Registration 1.0   [ Uninstall ] [ List Files ] [ Delete ] 
18. Advanced Visual Verification 1.1.2   [ Uninstall ] [ List Files ] [ Delete ] 
19. SMF Radio 1.1   [ Uninstall ] [ List Files ] [ Delete ] 
20. Profile User Action 1.1   [ Uninstall ] [ List Files ] [ Delete ] 
21. Member Color Link 2.0.0   [ Uninstall ] [ List Files ] [ Delete ] 
22. MySpace Field 2.4  [ Apply Mod ] [ List Files ] [ Delete ] 
23. Topic Ratings 1.03   [ Uninstall ] [ List Files ] [ Delete ] 
24. Wrap Text Around Image 1.0   [ Uninstall ] [ List Files ] [ Delete ] 
25. Gallery 2 Integration 1.0beta3.1   [ Uninstall ] [ List Files ] [ Delete ] 
26. Profile Comments 1.2.1   [ Uninstall ] [ List Files ] [ Delete ] 
27. GoogleVideo BBCode by Yakuza 0.1   [ Uninstall ] [ List Files ] [ Delete ] 
28. vMulticolor-Stars Mod 0.99   [ Uninstall ] [ List Files ] [ Delete ] 
29. FlashChat Integration 1.0   [ Uninstall ] [ List Files ] [ Delete ] 
30. Avatars at Index Mod 1.4  [ Apply Mod ] [ List Files ] [ Delete ] 
31. TinyPortal 0.983   [ Uninstall ] [ List Files ] [ Delete ] 
32. Streaming 3 4.2.2b   [ Uninstall ] [ List Files ] [ Delete ] 
33. TopicStarter Mod 1.0  [ Apply Mod ] [ List Files ] [ Delete ] 
34. Reason For Editing Mod 1.14   [ Uninstall ] [ List Files ] [ Delete ] 
35. SMF Arcade E2.3.0   [ Uninstall ] [ List Files ] [ Delete ] 
[/code]
Title: Re: SMF Poll Mod
Post by: clemenzo on June 12, 2007, 12:34:16 PM
Quote from: somze on June 12, 2007, 10:29:00 AM
Quote from: clemenzo on June 12, 2007, 10:04:39 AM
Quote from: somze on June 12, 2007, 02:54:55 AM
I have the same problem, Internal Server Error when trying to vote... :(
What other mods have you installed?

Some Mods :)

1. Profil Moderator Managment 1.0.0   [ Uninstall ] [ List Files ] [ Delete ] 
2. Change Theme Permission 1.0   [ Uninstall ] [ List Files ] [ Delete ] 
3. Pretty URLs - Base 0.6  [ Apply Mod ] [ List Files ] [ Delete ] 
4. Use [color] Tags in [code] Mod 1.0  [ Apply Mod ] [ List Files ] [ Delete ] 
5. Youtube Field by Alan S 1.0   [ Uninstall ] [ List Files ] [ Delete ] 
6. Tagging System 1.0.3   [ Uninstall ] [ List Files ] [ Delete ] 
7. Seo 4 SMF 0.2.9.8  [ Apply Mod ] [ List Files ] [ Delete ] 
8. Custom Profile Field Mod 3.16   [ Uninstall ] [ List Files ] [ Delete ] 
9. Custom BBCode 2.00   [ Uninstall ] [ List Files ] [ Delete ] 
10.  Permission Mod 1.01   [ Uninstall ] [ List Files ] [ Delete ] 
11. Country Flags 1.0.1   [ Uninstall ] [ List Files ] [ Delete ] 
12. Board Viewers Mod 1.1   [ Uninstall ] [ List Files ] [ Delete ] 
13. Ad Managment 2.3   [ Uninstall ] [ List Files ] [ Delete ] 
14. SMF Poll Mod 1.0   [ Uninstall ] [ List Files ] [ Delete ] 
15. YouTube BBC Tag (XHTML Compliant) 1.0   [ Uninstall ] [ List Files ] [ Delete ] 
16. Display Age and Location next to posts 1.0   [ Uninstall ] [ List Files ] [ Delete ] 
17. Gender On Registration 1.0   [ Uninstall ] [ List Files ] [ Delete ] 
18. Advanced Visual Verification 1.1.2   [ Uninstall ] [ List Files ] [ Delete ] 
19. SMF Radio 1.1   [ Uninstall ] [ List Files ] [ Delete ] 
20. Profile User Action 1.1   [ Uninstall ] [ List Files ] [ Delete ] 
21. Member Color Link 2.0.0   [ Uninstall ] [ List Files ] [ Delete ] 
22. MySpace Field 2.4  [ Apply Mod ] [ List Files ] [ Delete ] 
23. Topic Ratings 1.03   [ Uninstall ] [ List Files ] [ Delete ] 
24. Wrap Text Around Image 1.0   [ Uninstall ] [ List Files ] [ Delete ] 
25. Gallery 2 Integration 1.0beta3.1   [ Uninstall ] [ List Files ] [ Delete ] 
26. Profile Comments 1.2.1   [ Uninstall ] [ List Files ] [ Delete ] 
27. GoogleVideo BBCode by Yakuza 0.1   [ Uninstall ] [ List Files ] [ Delete ] 
28. vMulticolor-Stars Mod 0.99   [ Uninstall ] [ List Files ] [ Delete ] 
29. FlashChat Integration 1.0   [ Uninstall ] [ List Files ] [ Delete ] 
30. Avatars at Index Mod 1.4  [ Apply Mod ] [ List Files ] [ Delete ] 
31. TinyPortal 0.983   [ Uninstall ] [ List Files ] [ Delete ] 
32. Streaming 3 4.2.2b   [ Uninstall ] [ List Files ] [ Delete ] 
33. TopicStarter Mod 1.0  [ Apply Mod ] [ List Files ] [ Delete ] 
34. Reason For Editing Mod 1.14   [ Uninstall ] [ List Files ] [ Delete ] 
35. SMF Arcade E2.3.0   [ Uninstall ] [ List Files ] [ Delete ] 
[/code]

What a list! Let me look into it. Can you provide more details of the error such as logged in your web server and SMF forum log?
Title: Re: SMF Poll Mod
Post by: [Lucien] on June 12, 2007, 12:54:58 PM
Yeah it's one hell of a list LOL  :D

But this is the error SMF gives me, i hope it's good for you :)

http://....../forum/index.php?ssi_function=pollVote 
Databasefout: No database selected
Bestand: /var/www/html/forum/Sources/Subs.php
Regel: 3451
Title: Re: SMF Poll Mod
Post by: clemenzo on June 13, 2007, 11:08:24 AM
Quote from: somze on June 12, 2007, 12:54:58 PM
Yeah it's one hell of a list LOL  :D

But this is the error SMF gives me, i hope it's good for you :)

http://....../forum/index.php?ssi_function=pollVote 
Databasefout: No database selected
Bestand: /var/www/html/forum/Sources/Subs.php
Regel: 3451


Could you provide me your Subs.php file? Thanks!
Title: Re: SMF Poll Mod
Post by: qubbah on June 13, 2007, 11:12:57 AM
where can i setting only fovourite poll on show in the block and not only one time...every time my user refresh their page, they can see the polling block and can make a same poll for same question  for second time
Title: Re: SMF Poll Mod
Post by: qubbah on June 13, 2007, 11:17:20 AM
another things..

is there any option that i can fine all polling statistic take make it by my users....
Title: Re: SMF Poll Mod
Post by: qubbah on June 13, 2007, 11:34:53 AM
Quote from: clemenzo on June 09, 2007, 11:09:33 AM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=765)

This mod will rotate 10 colours to the poll bars and allow voting from SSI block on default theme of SMF.

To show poll in tinyportal block, add a phpbox and type "ssi_showPoll(X);" into block body where X is a topic number.

Demo
======

Default theme:

http://dev.voixbox.com/index.php?theme=1
http://dev.voixbox.com/index.php?theme=1&topic=2


Custom theme:

http://www.voixbox.com
http://www.voixbox.com/index.php?topic=15182.0


when i used this "ssi_showPoll(X);" with php block this msg appeard

Parse error: syntax error, unexpected $end in /home/myforum/public_html/v3/Sources/Load.php(1735) : eval()'d code(35) : eval()'d code on line 1
Title: Re: SMF Poll Mod
Post by: qubbah on June 13, 2007, 12:07:33 PM
how about the theme has no own display.template like dilberm?...
Title: Re: SMF Poll Mod
Post by: clemenzo on June 14, 2007, 09:11:30 AM
Quote from: qubbah on June 13, 2007, 11:12:57 AM
where can i setting only fovourite poll on show in the block and not only one time...every time my user refresh their page, they can see the polling block and can make a same poll for same question  for second time
I think if you set the poll to allow multiple votes and check to allow vote change when a poll is created, it would allow users to vote more than once? This ia SMF feature, not of this mod.
Title: Re: SMF Poll Mod
Post by: clemenzo on June 14, 2007, 09:13:20 AM
Quote from: qubbah on June 13, 2007, 11:17:20 AM
another things..

is there any option that i can fine all polling statistic take make it by my users....
Do you mean who voted what? If yes, not this mod.
Title: Re: SMF Poll Mod
Post by: clemenzo on June 14, 2007, 09:17:06 AM
Quote from: qubbah on June 13, 2007, 11:34:53 AM
Quote from: clemenzo on June 09, 2007, 11:09:33 AM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=765)

This mod will rotate 10 colours to the poll bars and allow voting from SSI block on default theme of SMF.

To show poll in tinyportal block, add a phpbox and type "ssi_showPoll(X);" into block body where X is a topic number.

Demo
======

Default theme:

http://dev.voixbox.com/index.php?theme=1
http://dev.voixbox.com/index.php?theme=1&topic=2


Custom theme:

http://www.voixbox.com
http://www.voixbox.com/index.php?topic=15182.0


when i used this "ssi_showPoll(X);" with php block this msg appeard

Parse error: syntax error, unexpected $end in /home/myforum/public_html/v3/Sources/Load.php(1735) : eval()'d code(35) : eval()'d code on line 1

Did you replace "X" with a topic number where your poll resides? In my examples, I would have used ssi_showPoll(2); or ssi_showPoll(15182.0);.
Title: Re: SMF Poll Mod
Post by: clemenzo on June 14, 2007, 09:18:44 AM
Quote from: qubbah on June 13, 2007, 12:07:33 PM
how about the theme has no own display.template like dilberm?...
Then your custom theme would fall back on the display.template of the default SMF theme.
Title: Re: SMF Poll Mod
Post by: clemenzo on June 14, 2007, 10:07:48 AM
Quote from: wilsy on June 10, 2007, 03:09:34 PM
Hi Clemenzo,

No dev site I'm afraid  :(

No worries - it's well outside of my very basic skills to contribute to solving this one. Hopefully someone else will come across the same error and can shed some light.

In the meantime I'll just keep the block switched off - thanks for taking a look though  :D

Regards,

Wilsy.

Would you be able to provide me an account added to a group at your site such that only this group can see the poll block? This would allow me to investigate further..
Title: Re: SMF Poll Mod
Post by: mforum on June 14, 2007, 10:14:30 AM
Quote from: wilsy on June 10, 2007, 12:19:27 PM
Hi Clemenzo,

Yes, as below: -

Database Error: No database selected
File: /home/rewindla/public_html/forum/Sources/Subs.php
Line: 3364

I have attached the subs.php file.

Regards,

Wilsy.

I have exactly the same problem ....  :(
Title: Re: SMF Poll Mod
Post by: clemenzo on June 14, 2007, 11:43:09 PM
Quote from: mforum on June 14, 2007, 10:14:30 AM
Quote from: wilsy on June 10, 2007, 12:19:27 PM
Hi Clemenzo,

Yes, as below: -

Database Error: No database selected
File: /home/rewindla/public_html/forum/Sources/Subs.php
Line: 3364

I have attached the subs.php file.

Regards,

Wilsy.

I have exactly the same problem ....  :(

Can you provide your list of mods used?
Title: Re: SMF Poll Mod
Post by: mforum on June 15, 2007, 02:59:17 AM
1.Tiny Portal 098
2.Board post limit
3.Read topic permission 104
4.pm on registration 102
5.Global announcements 1.00
6.Google video bbcode by yakuza
7.Youtube bbcode by yakuza
8.Hide tag 1.2.7
9.Hide tag bbc image 1.00
10. Users online today mod 1.4.0
11.Language drop 1.2
12.User email system 1.3
13.Country flags 1.0.1
14.Mini clip game bbc tag 0.1
15.Merge double posts 1.0.8
16. SMF Arcade 1.3.1 MOD E 1.5.2
17.Save pm as html 1.0.2
18.vReportBoard mod 0.99
19.Email Flash 2.0
20.Flashchat intergration 1.0
21.Inline attachments 1.0.4.2
22.SMF Poll mod 1.0


It must be a conflict with another mod, cause when i tried smf poll on my test site with a few mods installed, worked fine .......
I hope you can find the problem and fix it, is really a great mod ....  :(
Title: Re: SMF Poll Mod
Post by: clemenzo on June 16, 2007, 02:48:25 AM
Quote from: mforum on June 15, 2007, 02:59:17 AM
1.Tiny Portal 098
2.Board post limit
3.Read topic permission 104
4.pm on registration 102
5.Global announcements 1.00
6.Google video bbcode by yakuza
7.Youtube bbcode by yakuza
8.Hide tag 1.2.7
9.Hide tag bbc image 1.00
10. Users online today mod 1.4.0
11.Language drop 1.2
12.User email system 1.3
13.Country flags 1.0.1
14.Mini clip game bbc tag 0.1
15.Merge double posts 1.0.8
16. SMF Arcade 1.3.1 MOD E 1.5.2
17.Save pm as html 1.0.2
18.vReportBoard mod 0.99
19.Email Flash 2.0
20.Flashchat intergration 1.0
21.Inline attachments 1.0.4.2
22.SMF Poll mod 1.0


It must be a conflict with another mod, cause when i tried smf poll on my test site with a few mods installed, worked fine .......
I hope you can find the problem and fix it, is really a great mod ....  :(

I'll try my best.. am really busy lately.. I am suspecting conflict lies with Flashchat mod. If you can do me a favour, try installing this chat mod at your test site and see if voting from block still works..
Title: Re: SMF Poll Mod
Post by: mforum on June 16, 2007, 09:17:15 AM
Quote from: clemenzo on June 16, 2007, 02:48:25 AM
I'll try my best.. am really busy lately.. I am suspecting conflict lies with Flashchat mod. If you can do me a favour, try installing this chat mod at your test site and see if voting from block still works..

The time i installed flashchat mod, voting from block stoped working ....  ::)

error in log
Database error: No database selected
File: C:\apache2triad\htdocs\forum\Sources\Subs.php
Line: 3218


subs.php
// Get the FlashChat database config (for the prefix)
include($boarddir . '/chat/inc/config.srv.php');
// Load all the users currently in the chat
$result = db_query("
SELECT
fc.userid, fc.state, fc.color, fc.lang, fc.roomid,
fr.name AS roomName, fr.ispublic,
mem.realName, mem.memberName, mem.showOnline, mg.onlineColor,
mg.ID_GROUP, mg.groupName
FROM {$GLOBALS['fc_config']['db']['pref']}connections AS fc
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = fc.userid)
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))
LEFT JOIN {$GLOBALS['fc_config']['db']['pref']}rooms AS fr ON (fc.roomid = fr.id)
WHERE fc.userid IS NOT NULL
AND mem.ID_MEMBER != 0
  LINE 3218 => ORDER BY mem.realName ASC", __FILE__, __LINE__);

$context['users_chat'] = array();
$context['list_users_chat'] = array();
$context['num_chat'] = mysql_num_rows($result);

// Loop through all users in chat
while ($row = mysql_fetch_assoc($result))
{


Hope that helps ....  :-\
Title: Re: SMF Poll Mod
Post by: clemenzo on June 17, 2007, 05:28:08 AM
Thanks, this confirms my doubt. I'll look into it but no promise that I can fix it..
Title: Re: SMF Poll Mod
Post by: dimdom on June 18, 2007, 01:00:22 PM
Excellent mod!

But there is a problem in IE7. It "centers" the poll text in TP block....

What must i do to be shown correctly as in Firefox (text to the left)?

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg240.imageshack.us%2Fimg240%2F6913%2F59201637dv0.jpg&hash=d2194373404db7ba919aff21f7880393efce5d74) (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg517.imageshack.us%2Fimg517%2F9854%2F91898591oe6.jpg&hash=8a9b27e43efd85bebb8b0173dcca3f8689b5533a)
Title: Re: SMF Poll Mod
Post by: clemenzo on June 18, 2007, 08:40:31 PM
Quote from: dimdom on June 18, 2007, 01:00:22 PM
Excellent mod!

But there is a problem in IE7. It "centers" the poll text in TP block....

What must i do to be shown correctly as in Firefox (text to the left)?

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg240.imageshack.us%2Fimg240%2F6913%2F59201637dv0.jpg&hash=d2194373404db7ba919aff21f7880393efce5d74) (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg517.imageshack.us%2Fimg517%2F9854%2F91898591oe6.jpg&hash=8a9b27e43efd85bebb8b0173dcca3f8689b5533a)

I do not have this issue on my site. Could your theme be causing the problem? Try using another theme and see if the problem persists. You can try using IE7 to visit my site.
Title: Re: SMF Poll Mod
Post by: dimdom on June 19, 2007, 06:02:07 AM
Hi clemenzo,

I use two themes. Same problem. But the same happens with the core (default) theme.

I visited your site. And you are right, the problem doesnt show there.

Maybe i must add something to the php code of the TP block...

If you visit my site (picture in my signature) you will see that the I have another TP block on the right (called Media Center) that shows the same odd behaviour in IE7...
Title: Re: SMF Poll Mod
Post by: clemenzo on June 19, 2007, 07:49:27 AM
This is strange. I do not encounter alignment issue when using IE7 on your site.
Title: Re: SMF Poll Mod
Post by: clemenzo on June 19, 2007, 09:05:53 AM
Quote from: wilsy on June 10, 2007, 12:19:27 PM
Hi Clemenzo,

Yes, as below: -

Database Error: No database selected
File: /home/rewindla/public_html/forum/Sources/Subs.php
Line: 3364

I have attached the subs.php file.

Regards,

Wilsy.

I think I fixed it! The problem lies in subs.php. Somehow, the query is not getting a connection and hence the error. Note that this fix would cause the mod uninstall to fail. I would probably inform the mod owner about this so that a fixed mod can be released. To fix this temporarily (keep a backup of your original subs.php):

Search:

// --- Begin FlashChat Integration ---
// Only bother grabbing the data if we need it (ie. we're on the board
// index, or the information will be shown at the top of the forum).
// !!! $modSettings['fc_showUserCount'] just needs the count, not the whole query!
if (!empty($modSettings['fc_showUsers']) || !empty($modSettings['fc_showUserCount']) || (empty($context['current_action']) || $context['current_action'] == 'boardindex' || $context['current_action'] == 'forum'))
{
global $boarddir, $db_prefix;
// Get the FlashChat database config (for the prefix)
include($boarddir . '/chat/inc/config.srv.php');
// Load all the users currently in the chat
$result = db_query("
SELECT
fc.userid, fc.state, fc.color, fc.lang, fc.roomid,
fr.name AS roomName, fr.ispublic,
mem.realName, mem.memberName, mem.showOnline, mg.onlineColor,
mg.ID_GROUP, mg.groupName
FROM {$GLOBALS['fc_config']['db']['pref']}connections AS fc
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = fc.userid)
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))
LEFT JOIN {$GLOBALS['fc_config']['db']['pref']}rooms AS fr ON (fc.roomid = fr.id)
WHERE fc.userid IS NOT NULL
AND mem.ID_MEMBER != 0
ORDER BY mem.realName ASC", __FILE__, __LINE__);


Replace:

// --- Begin FlashChat Integration ---
// Only bother grabbing the data if we need it (ie. we're on the board
// index, or the information will be shown at the top of the forum).
// !!! $modSettings['fc_showUserCount'] just needs the count, not the whole query!
if (!empty($modSettings['fc_showUsers']) || !empty($modSettings['fc_showUserCount']) || (empty($context['current_action']) || $context['current_action'] == 'boardindex' || $context['current_action'] == 'forum'))
{
global $boarddir, $db_prefix, $db_name;
// Get the FlashChat database config (for the prefix)
include($boarddir . '/chat/inc/config.srv.php');
// Get the proper database prefix (including database name)
$fc_prefix = is_numeric(substr($GLOBALS['fc_config']['db']['pref'], 0, 1)) ? $db_name . '.' . $GLOBALS['fc_config']['db']['pref'] : '`' . $db_name . '`.' . $GLOBALS['fc_config']['db']['pref'];
// Load all the users currently in the chat
$result = db_query("
SELECT
fc.userid, fc.state, fc.color, fc.lang, fc.roomid,
fr.name AS roomName, fr.ispublic,
mem.realName, mem.memberName, mem.showOnline, mg.onlineColor,
mg.ID_GROUP, mg.groupName
FROM {$fc_prefix}connections AS fc
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = fc.userid)
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))
LEFT JOIN {$fc_prefix}rooms AS fr ON (fc.roomid = fr.id)
WHERE fc.userid IS NOT NULL
AND mem.ID_MEMBER != 0
ORDER BY mem.realName ASC", __FILE__, __LINE__);


Hope this helps.. Apologies for the delay!
Title: Re: SMF Poll Mod
Post by: dimdom on June 19, 2007, 11:36:04 AM
Quote from: clemenzo on June 19, 2007, 07:49:27 AM
This is strange. I do not encounter alignment issue when using IE7 on your site.

OK, here is what I found out...
When the php block lies in the left side, it displays correctly. When i move it to the right side, the text becomes centered...

Strange but true.
Title: Re: SMF Poll Mod
Post by: clemenzo on June 19, 2007, 09:01:25 PM
What is the url to your default theme? Can you show me a poll block on the right?
Title: Re: SMF Poll Mod
Post by: dimdom on June 20, 2007, 04:21:20 AM
Hi once again.

I set up a test SMF so I could test your and some others useful mods.

Your mod works without problems there both in IE7 and Firefox.

That leads me to the conclusion that some other block in my main forum's right panel may cause the strange behaviour.

It has nothing to do with your excellent mod.

Title: Re: SMF Poll Mod
Post by: clemenzo on June 20, 2007, 04:24:23 AM
Quote from: dimdom on June 20, 2007, 04:21:20 AM
Hi once again.

I set up a test SMF so I could test your and some others useful mods.

Your mod works without problems there both in IE7 and Firefox.

That leads me to the conclusion that some other block in my main forum's right panel may cause the strange behaviour.

It has nothing to do with your excellent mod.



Cool! Your issue would take some time, adding a mod at a time and refreshing your main screen till you found the cause.

Glad you find my mod useful!
Title: Re: SMF Poll Mod
Post by: Col on June 20, 2007, 11:23:06 AM
Quote from: clemenzo on June 19, 2007, 09:05:53 AM
I think I fixed it! The problem lies in subs.php. Somehow, the query is not getting a connection and hence the error. Note that this fix would cause the mod uninstall to fail. I would probably inform the mod owner about this so that a fixed mod can be released. To fix this temporarily (keep a backup of your original subs.php):

Hi Clemenzo,

I think your code is the answer to my problems too: http://www.simplemachines.org/community/index.php?topic=139769.msg1127402#msg1127402 I reported pretty much the same problem and possible cause, but I'm no coder. I'll give your solution ago! :)
Title: Re: SMF Poll Mod
Post by: Col on June 20, 2007, 11:41:28 AM
Your code has indeed resolved the problem for me.

Thanks for posting the solution.
Title: Re: SMF Poll Mod
Post by: clemenzo on June 20, 2007, 12:30:38 PM
My pleasure!
Title: Re: SMF Poll Mod
Post by: clemenzo on June 25, 2007, 11:55:17 AM
Version 1.01 supports SMF 1.1.3 now..
Title: Re: SMF Poll Mod
Post by: fangweile on June 28, 2007, 10:18:21 PM
thanks I am coming here to check if it is update to support SMF 1.1.3, thanks clemenzo
Title: Re: SMF Poll Mod
Post by: wilsy on June 30, 2007, 03:07:55 AM
...for those with the RSS Feed Poster and YouTube mods - Clemenzo's code fixed the compatibility issues (re Flashchat) with those as well :)

Regards,

Wilsy.
Title: Re: SMF Poll Mod
Post by: Mannie_Fine on July 04, 2007, 10:15:27 AM
Hello,
It seems to work for me, only in the tp block i don't see the colors, just the same color bars. In the forum it shows the color.
see it at my site
http://art.spliffcanvas.net
as a matter of fact when i compare it to wilsey's site mine looks alot off  :-\
Title: Re: SMF Poll Mod
Post by: clemenzo on July 11, 2007, 08:21:25 AM
I assume you got it fixed? I see it running fine at your site now.. :)
Title: Re: SMF Poll Mod
Post by: Mannie_Fine on July 11, 2007, 08:25:18 AM
Yes it's fixed now ;). It didn't updated the SSI.php , works like a charm now
Title: Re: SMF Poll Mod
Post by: srm on September 03, 2007, 06:44:21 PM
Hey guys,

I had this mod installed earlier and it worked fine. Then the admin went in and did nothing but change the number between the () to update the block to a different poll then it started giving an error after that.

then i uninstalled it and re-installed it "succesfully" and tried over again and still getting the same error appearing in the block

here is ther error:

QuoteParse error: parse error, unexpected $ in /home/httpd/vhosts/jaggermafia.com/httpdocs/Sources/Load.php(1735) : eval()'d code(35) : eval()'d code on line 1

Does anyone know why this is?
Title: Re: SMF Poll Mod
Post by: srm on September 03, 2007, 10:08:30 PM
bump
Title: Re: SMF Poll Mod
Post by: Vinspire on September 03, 2007, 11:00:10 PM
Great mod , good job clemenzo. Your mod definitely make SMF poll system look more attractive :)
Title: Re: SMF Poll Mod
Post by: srm on September 04, 2007, 08:45:36 AM
Quote from: clemenzo on June 14, 2007, 09:17:06 AM
Quote from: qubbah on June 13, 2007, 11:34:53 AM
Quote from: clemenzo on June 09, 2007, 11:09:33 AM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=765)

This mod will rotate 10 colours to the poll bars and allow voting from SSI block on default theme of SMF.

To show poll in tinyportal block, add a phpbox and type "ssi_showPoll(X);" into block body where X is a topic number.

Demo
======

Default theme:

http://dev.voixbox.com/index.php?theme=1
http://dev.voixbox.com/index.php?theme=1&topic=2


Custom theme:

http://www.voixbox.com
http://www.voixbox.com/index.php?topic=15182.0


when i used this "ssi_showPoll(X);" with php block this msg appeard

Parse error: syntax error, unexpected $end in /home/myforum/public_html/v3/Sources/Load.php(1735) : eval()'d code(35) : eval()'d code on line 1

Did you replace "X" with a topic number where your poll resides? In my examples, I would have used ssi_showPoll(2); or ssi_showPoll(15182.0);.


Hi, Im getting this same error here and I do have the poll number between the paranthasees exactly right.

Hlep
Title: Re: SMF Poll Mod
Post by: srm on September 05, 2007, 09:49:10 PM
Quote from: srm on September 04, 2007, 08:45:36 AM
Quote from: clemenzo on June 14, 2007, 09:17:06 AM
Quote from: qubbah on June 13, 2007, 11:34:53 AM
Quote from: clemenzo on June 09, 2007, 11:09:33 AM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=765)

This mod will rotate 10 colours to the poll bars and allow voting from SSI block on default theme of SMF.

To show poll in tinyportal block, add a phpbox and type "ssi_showPoll(X);" into block body where X is a topic number.

Demo
======

Default theme:

http://dev.voixbox.com/index.php?theme=1
http://dev.voixbox.com/index.php?theme=1&topic=2


Custom theme:

http://www.voixbox.com
http://www.voixbox.com/index.php?topic=15182.0


when i used this "ssi_showPoll(X);" with php block this msg appeard

Parse error: syntax error, unexpected $end in /home/myforum/public_html/v3/Sources/Load.php(1735) : eval()'d code(35) : eval()'d code on line 1

Did you replace "X" with a topic number where your poll resides? In my examples, I would have used ssi_showPoll(2); or ssi_showPoll(15182.0);.


Hi, Im getting this same error here and I do have the poll number between the paranthasees exactly right.

Hlep

could someone please help me with this problem..It's very important.
Title: Re: SMF Poll Mod
Post by: srm on September 06, 2007, 05:17:37 PM
Jesus Christ , Buddah , Darth Vador wtf?
Title: Re: SMF Poll Mod
Post by: srm on September 09, 2007, 09:45:50 AM
I guess nobody here either doesnt know how to resolve this issue or they are just too careless to so.
Title: Re: SMF Poll Mod
Post by: Golin on September 15, 2007, 08:34:38 AM
Quote from: srm on September 09, 2007, 09:45:50 AM
I guess nobody here either doesnt know how to resolve this issue or they are just too careless to so.
No, the author of the mod just hasn't been online since last week.

But I would like to add another error, incase he does get online :)

I get, even after altering Subs.php as suggested:

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 40961 bytes) in /www/s/t/o/domainname.eu/public_html/aof/Sources/Subs.php on line 2733

Modlist:

1.   FlashChat Integration  ---->>> this one caused the error
2.   RSS Feed Poster
3.   Users Online Today Mod
4.   SMF Gallery Lite
5.   TinyPortal
6.   RSS Feed Icon
7.   Group on Registration
8.   TinyPortal
9.   Reason For Editing Mod
10.   WoW Character Profiles
11.   Itemstats BBC Tag (XHTML Compliant)
12.   Custom Action Mod
13.   Ultimate Shoutbox
14.   SMF Shoutbox
15.   SMF 1.1.2 Update Package
16.   SMF 1.1.1 Update Package
17.   PaypalDonations
18.   WoW-Itemstats 1.25.5
19.   SMF 1.0.11 / 1.1.3 Update
20.   Welcome Topic Mod
21.   SMF Poll Mod

subs.php attached


edit: solved by removing the FlashChat mod
Title: Re: SMF Poll Mod
Post by: srm on September 16, 2007, 09:22:09 AM
Im glad you solved it.

Any ideas yet whats causing my problem?
Title: Re: SMF Poll Mod
Post by: asdas2 on September 16, 2007, 10:05:07 AM
Installing this package will perform the following actions:  Type Action Description
1. Extract Tree ./Themes/default/images/poll 
2. Execute Modification ./Sources/Display.php Test successful
3. Execute Modification ./Themes/default/Display.template.php Test failed  
4. Execute Modification ./Themes/default/Display.template.php Test successful
5. Execute Modification ./Themes/default/Display.template.php Test successful
6. Execute Modification ./Themes/default/Display.template.php Test successful
7. Execute Modification ./SSI.php Test successful
8. Execute Modification ./SSI.php Test successful
9. Execute Modification ./SSI.php Test successful
10. Execute Modification ./SSI.php Test successful
11. Execute Modification ./SSI.php Test successful
12. Execute Modification ./SSI.php Test successful
13. Execute Modification ./SSI.php Test successful
14. Execute Modification ./SSI.php Test successful
15. Execute Modification ./SSI.php Test successful
16. Execute Modification ./SSI.php Test successful
17. Execute Modification ./SSI.php Test successful
Title: Re: SMF Poll Mod
Post by: Golin on September 16, 2007, 03:03:23 PM
Quote from: srm on September 16, 2007, 09:22:09 AM
Im glad you solved it.

Any ideas yet whats causing my problem?

Nope, I'm not a coder. What I usually do is check the error code and look for clues there. What it points to etc. I also try a search on the error code, try this site first, or else just Google it or parts of it.

I hope for you the author will be online soon, was last active on 3 sept.
Title: Re: SMF Poll Mod
Post by: clemenzo on September 23, 2007, 12:01:28 AM
Can those of you who are unable to run the mod successfully as least provide a link to your site? I cannot visualize what you see..
Title: Re: SMF Poll Mod
Post by: asdas2 on September 23, 2007, 02:09:28 AM
my link was in my siggy . anywayz its www.chillparadise.com
Title: Re: SMF Poll Mod
Post by: clemenzo on September 23, 2007, 11:22:53 AM
Quote from: asdas2 on September 23, 2007, 02:09:28 AM
my link was in my siggy . anywayz its www.chillparadise.com

Not sure if you have other mods that have altered your ./Themes/default/Display.template.php file. Anyway, this mod applies 4 changes in that file and from your log, the first one failed.

You can try open up the file and check the part that is supposed to be searched and replaced. Make a backup before you make any changes.

Find and replace:
// Are they not allowed to vote but allowed to view the options?
if ($context['poll']['show_results'] || !$context['allow_vote'])
{
echo '
<table>
<tr>
<td style="padding-top: 2ex;">
<table border="0" cellpadding="0" cellspacing="0">';

// Show each option with its corresponding percentage bar.
foreach ($context['poll']['options'] as $option)
echo '
<tr>
<td style="padding-right: 2ex;', $option['voted_this'] ? 'font-weight: bold;' : '', '">', $option['option'], '</td>', $context['allow_poll_view'] ? '
<td nowrap="nowrap">' . $option['bar'] . ' ' . $option['votes'] . ' (' . $option['percent'] . '%)</td>' : '', '
</tr>';

echo '
</table>
</td>
<td valign="bottom" style="padding-left: 15px;">';


With:
// Are they not allowed to vote but allowed to view the options?
if ($context['poll']['show_results'] || !$context['allow_vote'])
{
echo '
<table>
<tr>
<td style="padding-top: 2ex;">
<table border="0" cellpadding="0" cellspacing="1" width="100%">';

// Show each option with its corresponding percentage bar.
foreach ($context['poll']['options'] as $option)
echo '
<tr>
<td style="padding-right: 2ex;', $option['voted_this'] ? 'font-weight: bold;' : '', '" class="smalltext">', $option['option'], '</td>', $context['allow_poll_view'] ? '
<td nowrap="nowrap" class="smalltext">' . $option['bar'] . '</td>
<td nowrap="nowrap" class="smalltext">' . $option['votes']. ' (' . $option['percent'] . '%)</td>' : '', '
</tr>';

echo '
</table>
</td>
<td valign="bottom" style="padding-left: 15px;" class="smalltext">';
Title: Re: SMF Poll Mod
Post by: ChackanPT on September 25, 2007, 12:05:22 PM
Quote from: clemenzo on September 25, 2007, 11:48:37 AM
Quote from: Chackan on September 25, 2007, 11:35:24 AM
http://www.otherworld-portal.com (http://www.otherworld-portal.com)

SMF File    Your Version   Current Version
SMF Package   SMF 1.1.4   SMF 1.1.4
Sources                      1.1.4          1.1.4
Default Template        1.1.2          1.1.2
Language Files           1.1.2           1.1.2
Current Templates   1.1            1.1

Dunno if this helps :S
Can we move the discussion to the SMF Poll mod page at http://www.simplemachines.org/community/index.php?topic=176062.0 ?

I hope you are using version 1.01 of the poll mod.. :)

Yes. Actually i even tried to install version 1.0 :S
Title: Re: SMF Poll Mod
Post by: clemenzo on September 25, 2007, 12:13:35 PM
Quote from: ChackanPT on September 25, 2007, 12:05:22 PM
Quote from: clemenzo on September 25, 2007, 11:48:37 AM
Quote from: Chackan on September 25, 2007, 11:35:24 AM
http://www.otherworld-portal.com (http://www.otherworld-portal.com)

SMF File    Your Version   Current Version
SMF Package   SMF 1.1.4   SMF 1.1.4
Sources                      1.1.4          1.1.4
Default Template        1.1.2          1.1.2
Language Files           1.1.2           1.1.2
Current Templates   1.1            1.1

Dunno if this helps :S
Can we move the discussion to the SMF Poll mod page at http://www.simplemachines.org/community/index.php?topic=176062.0 ?

I hope you are using version 1.01 of the poll mod.. :)

Yes. Actually i even tried to install version 1.0 :S
What other mods have you installed?
Title: Re: SMF Poll Mod
Post by: ChackanPT on September 25, 2007, 12:16:45 PM
Only the 1.1.4 update and tiny portal
Title: Re: SMF Poll Mod
Post by: clemenzo on September 25, 2007, 12:20:27 PM
Quote from: ChackanPT on September 25, 2007, 12:16:45 PM
Only the 1.1.4 update and tiny portal
Have you used this mod before? Could you PM me your email address? I can send you a copy of what I just used to test out.
Title: Re: SMF Poll Mod
Post by: ChackanPT on September 25, 2007, 12:23:21 PM
Nop, never used it before. Pm sent!
Title: Re: SMF Poll Mod
Post by: clemenzo on September 25, 2007, 08:35:52 PM
Quote from: ChackanPT
Now i get this error:
"1. Extract Tree ./Themes/default/images/poll
2. Execute Modification ./Sources/Display.php Test successful
3. Execute Modification ./Themes/default/Display.template.php Test successful
4. Execute Modification ./Themes/default/Display.template.php Test successful
5. Execute Modification ./Themes/default/Display.template.php Test successful
6. Execute Modification ./Themes/default/Display.template.php Test successful
7. Execute Modification ./SSI.php Test failed
8. Execute Modification ./SSI.php Test successful
9. Execute Modification ./SSI.php Test successful
10. Execute Modification ./SSI.php Test successful
11. Execute Modification ./SSI.php Test successful
12. Execute Modification ./SSI.php Test failed
13. Execute Modification ./SSI.php Test successful
14. Execute Modification ./SSI.php Test successful
15. Execute Modification ./SSI.php Test successful
16. Execute Modification ./SSI.php Test successful
17. Execute Modification ./SSI.php Test successful"

I checked that the SSI.php file was unchanged between SMF 1.1.3 and 1.1.4. Could you email me your SSI.php file? Thanks
Title: Re: SMF Poll Mod
Post by: ChackanPT on September 25, 2007, 10:01:49 PM
Sent. I can't find enough thanking for this :S
Title: Re: SMF Poll Mod
Post by: clemenzo on September 26, 2007, 09:19:16 AM
Quote from: ChackanPT on September 25, 2007, 10:01:49 PM
Sent. I can't find enough thanking for this :S
From your SSI.php, I believe you have tried to add this poll mod manually as per the original instructions from tinyportal. However, you probably forgot to undo them totally after you remove it.

I have sent you your cleansed SSI.php, hopefully it works for you.
Title: Re: SMF Poll Mod
Post by: ChackanPT on September 26, 2007, 09:33:18 AM
Also, the bars that show the voting progression are gone :S

Ok, the size i good. Only problem are the bars :O
Title: Re: SMF Poll Mod
Post by: clemenzo on September 26, 2007, 09:45:06 AM
Quote from: ChackanPT on September 26, 2007, 09:33:18 AM
Alright, installed it, but the poll looks weird and too big. Is there a way to shrink it or something? :S

Also, the bars that show the voting progression are gone :S
You need to unzip the mod and upload the poll folder that contains the bar images into your custom theme images folder. The default theme should have that images loaded when you installed the mod. I do not understand what you mean by weird and big.. A screenshot after you have uploaded the images would be nice..
Title: Re: SMF Poll Mod
Post by: ChackanPT on September 26, 2007, 09:52:13 AM
Forgot to put it in the folder :S

Okay, it's all working now :D Great mod! Thank you very much for all your work and patiente! I really apreciate it
Title: Re: SMF Poll Mod
Post by: clemenzo on September 26, 2007, 09:58:34 AM
Quote from: ChackanPT on September 26, 2007, 09:52:13 AM
Forgot to put it in the folder :S

Okay, it's all working now :D Great mod! Thank you very much for all your work and patiente! I really apreciate it
Congrats! Thank you for providing the necessary info too!
Title: Re: SMF Poll Mod
Post by: Godsongz on October 12, 2007, 10:04:37 PM
Quote from: clemenzo on June 19, 2007, 09:05:53 AMI think I fixed it! The problem lies in subs.php. Somehow, the query is not getting a connection and hence the error. Note that this fix would cause the mod uninstall to fail. I would probably inform the mod owner about this so that a fixed mod can be released. To fix this temporarily (keep a backup of your original subs.php):

Awesome Clemenzo...  I just installed SMF Poll on Monday, realized the "No database selected" bug was happening on Wednesday, poked around at it for a while before I eventually decided to read this entire thread tonight and found the solution on page 3.  Your "temporary fix" for the FlashChat mod solved my bug too.  Thank you sir!

How do I change it so that it STARTS with colored bars instead of gray, then black, then colors?
Title: Re: SMF Poll Mod
Post by: clemenzo on October 13, 2007, 08:14:26 AM
Quote from: Godsongz on October 12, 2007, 10:04:37 PM
Quote from: clemenzo on June 19, 2007, 09:05:53 AMI think I fixed it! The problem lies in subs.php. Somehow, the query is not getting a connection and hence the error. Note that this fix would cause the mod uninstall to fail. I would probably inform the mod owner about this so that a fixed mod can be released. To fix this temporarily (keep a backup of your original subs.php):

Awesome Clemenzo...  I just installed SMF Poll on Monday, realized the "No database selected" bug was happening on Wednesday, poked around at it for a while before I eventually decided to read this entire thread tonight and found the solution on page 3.  Your "temporary fix" for the FlashChat mod solved my bug too.  Thank you sir!

How do I change it so that it STARTS with colored bars instead of gray, then black, then colors?

You can rename the poll bar images in the [theme]/images/poll folder or replace them with your own.
Title: Re: SMF Poll Mod
Post by: Godsongz on October 13, 2007, 04:23:21 PM
hehe, umm, yeah...  I guess the simplest solution was the best one :)
Title: Re: SMF Poll Mod
Post by: Smith Online on October 16, 2007, 12:11:13 PM
Hi Thanks For a superb! mod   ;D

Just one question
in tp block i currently use ssi_showPoll(508); which only shows that one poll. What i would like to do if possible is have polls from a specific board displayed at random after each refresh of the page. The reason for this is i have a board which is were polls only are posted and would like to show them on my tp homepage poll block at random

I hope this is posible

Thanks in Advance

Regards
Smith Online
Title: Re: SMF Poll Mod
Post by: clemenzo on October 17, 2007, 11:57:42 AM
Quote from: Smith Online on October 16, 2007, 12:11:13 PM
Hi Thanks For a superb! mod   ;D

Just one question
in tp block i currently use ssi_showPoll(508); which only shows that one poll. What i would like to do if possible is have polls from a specific board displayed at random after each refresh of the page. The reason for this is i have a board which is were polls only are posted and would like to show them on my tp homepage poll block at random

I hope this is posible

Thanks in Advance

Regards
Smith Online

This mod does not allow random select of poll topic but you can add some php scripts in the same block to achieve this.

Open up your php poll block and replace:


ssi_showPoll(x);


with


require('./Settings.php');

$link = mysql_connect($db_server, $db_user, $db_passwd);
mysql_select_db($db_name, $link);

// Get a random poll topic from all boards
//$poll_topic = random_poll();

// Get a random poll topic from any specified board
$poll_topic = random_poll(array(2));

// Get a random poll topic from multiple boards
// $poll_topic = random_poll(array(2, 3, 4));

if(!empty($poll_topic['ID_TOPIC']))
  ssi_showPoll($poll_topic['ID_TOPIC']);
else
  echo "<p style=\"text-align: center; font-size: small;\">Sorry, no poll found.</p>";

// Functions begin
function random_poll($include_boards = ""){
  global $link,$db_prefix,$boarddir,$boardurl;

  if($include_boards == "") {
    $query = "SELECT ID_TOPIC FROM {$db_prefix}topics WHERE locked = 0 AND id_poll > 0 ORDER BY rand() LIMIT 0,1";
  }
  else {
    $query = "SELECT ID_TOPIC FROM {$db_prefix}topics WHERE locked = 0 AND id_poll > 0 and id_board IN (" . implode(', ', $include_boards) . ") ORDER BY rand() LIMIT 0,1 ";
  }

  $poll_topic = mysql_fetch_array(mysql_query($query));
  return $poll_topic;
}


Remember to set the board ids! Note that this script is still quite raw and can be improved in future. Hope this helps.
Title: Re: SMF Poll Mod
Post by: Smith Online on October 17, 2007, 03:37:28 PM
QuoteQuote from: Smith Online on Yesterday at 17:11:13
Hi Thanks For a superb! mod   

Just one question
in tp block i currently use ssi_showPoll(508); which only shows that one poll. What i would like to do if possible is have polls from a specific board displayed at random after each refresh of the page. The reason for this is i have a board which is were polls only are posted and would like to show them on my tp homepage poll block at random

I hope this is posible

Thanks in Advance

Regards
Smith Online


This mod does not allow random select of poll topic but you can add some php scripts in the same block to achieve this.

Open up your php poll block and replace:


Code:
ssi_showPoll(x);

with


Code:
require('./Settings.php');

$link = mysql_connect($db_server, $db_user, $db_passwd);
mysql_select_db($db_name, $link);

// Get a random poll topic from all boards
//$poll_topic = random_poll();

// Get a random poll topic from any specified board
$poll_topic = random_poll(array(2));

// Get a random poll topic from multiple boards
// $poll_topic = random_poll(array(2, 3, 4));

if(!empty($poll_topic['ID_TOPIC']))
  ssi_showPoll($poll_topic['ID_TOPIC']);
else
  echo "<p style=\"text-align: center; font-size: small;\">Sorry, no poll found.</p>";

// Functions begin
function random_poll($include_boards = ""){
  global $link,$db_prefix,$boarddir,$boardurl;

  if($include_boards == "") {
    $query = "SELECT ID_TOPIC FROM {$db_prefix}topics WHERE locked = 0 AND id_poll > 0 ORDER BY rand() LIMIT 0,1";
  }
  else {
    $query = "SELECT ID_TOPIC FROM {$db_prefix}topics WHERE locked = 0 AND id_poll > 0 and id_board IN (" . implode(', ', $include_boards) . ") ORDER BY rand() LIMIT 0,1 ";
  }

  $poll_topic = mysql_fetch_array(mysql_query($query));
  return $poll_topic;
}


Remember to set the board ids! Note that this script is still quite raw and can be improved in future. Hope this helps.

Once Again Superb works perfect just how i needed it ;)

Thanks Keep up the great work (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fmessenger.msn.com%2FMMM2006-04-19_17.00%2FResource%2Femoticons%2Fthumbs_up.gif&hash=fc4f5fdbe6a7ee2a1cf9429e97e509560548777a)

Best Regards,
Smith Online
Title: Re: SMF Poll Mod
Post by: clemenzo on November 16, 2007, 10:59:04 PM
Version 1.1 is released!

- Added random poll selection for display
- Added logic to ensure users only see polls in accessible boards.
- Added flexibility to manually include or exclude poll from selected boards.
- Added compatibility with SMF 1.1.4.
Title: Re: SMF Poll Mod
Post by: clemenzo on November 18, 2007, 05:13:04 AM
Version 1.1.1 is released!

- Fixed random poll to exclude expired polls.
Title: Re: SMF Poll Mod
Post by: Mick. on November 20, 2007, 02:32:17 PM
Wow!  Im very impressed with this mod!  I love it.  Thank you!
Title: Re: SMF Poll Mod
Post by: Mick. on November 22, 2007, 09:05:17 AM
LOL.   I just realized is hard selecting polls when using the "pretty url" mod.
Title: Re: SMF Poll Mod
Post by: clemenzo on November 22, 2007, 07:27:58 PM
Quote from: BlueDevil on November 22, 2007, 09:05:17 AM
LOL.   I just realized is hard selecting polls when using the "pretty url" mod.
I haven't use the "pretty url" mod but would try take a look.. Can you provide more details?
Title: Re: SMF Poll Mod
Post by: Mick. on November 22, 2007, 07:37:10 PM
Quote from: clemenzo on November 22, 2007, 07:27:58 PM
Quote from: BlueDevil on November 22, 2007, 09:05:17 AM
LOL.   I just realized is hard selecting polls when using the "pretty url" mod.
I haven't use the "pretty url" mod but would try take a look.. Can you provide more details?

Cant see the board ID when choosing what poll to show on a block. Thats about it.
Title: Re: SMF Poll Mod
Post by: clemenzo on November 22, 2007, 08:15:22 PM
Quote from: BlueDevil on November 22, 2007, 07:37:10 PM
Quote from: clemenzo on November 22, 2007, 07:27:58 PM
Quote from: BlueDevil on November 22, 2007, 09:05:17 AM
LOL.   I just realized is hard selecting polls when using the "pretty url" mod.
I haven't use the "pretty url" mod but would try take a look.. Can you provide more details?

Cant see the board ID when choosing what poll to show on a block. Thats about it.

The board ID is usually only required once when you install this mod. Unless you need restrict to certain board, the board id need not be specified. This mod also takes into consideration of the users' permission to see the board.

If you really need the board ids, you may want disable the pretty url mod for a minute to just grab the id or you could get it from the boards table in your database.
Title: Re: SMF Poll Mod
Post by: Mick. on November 22, 2007, 08:33:53 PM
Quote from: clemenzo on November 22, 2007, 08:15:22 PM

If you really need the board ids, you may want disable the pretty url mod for a minute to just grab the id or you could get it from the boards table in your database.

Yep. Thats how i've been doing it.     No biggie.
Title: Re: SMF Poll Mod
Post by: MadTurki on December 28, 2007, 02:00:07 PM
Quote from: clemenzo on November 18, 2007, 05:13:04 AM
Version 1.1.1 is released!

- Fixed random poll to exclude expired polls.

It seems that the random poll still chooses expired polls. Edit: we had some old polls that were set to not expire - my bad!  Also, would it be possible to exclude polls people have voted on?  Maybe as a selectable option (show all or just non-voted)...

That'd be cool.
Title: Re: SMF Poll Mod
Post by: clemenzo on December 30, 2007, 08:57:49 AM
Sounds good.. I'll try find some time to add this in.. :)
Title: Re: SMF Poll Mod
Post by: DHC on January 19, 2008, 05:06:52 PM
I am having no success in downloading the file from the Modifications site. Maybe it is related to the SMF server problem recently, but it would be appreciated if the Modification could be uploaded here.
Title: Re: SMF Poll Mod
Post by: clemenzo on January 20, 2008, 09:10:31 AM
Quote from: DHC on January 19, 2008, 05:06:52 PM
I am having no success in downloading the file from the Modifications site. Maybe it is related to the SMF server problem recently, but it would be appreciated if the Modification could be uploaded here.

Can you try again? I was able to download the mod without uploading yet.. :)
Title: Re: SMF Poll Mod
Post by: DHC on January 20, 2008, 12:49:54 PM
Quote from: clemenzo on January 20, 2008, 09:10:31 AM
Quote from: DHC on January 19, 2008, 05:06:52 PM
I am having no success in downloading the file from the Modifications site. Maybe it is related to the SMF server problem recently, but it would be appreciated if the Modification could be uploaded here.

Can you try again? I was able to download the mod without uploading yet.. :)

I just downloaded it - which worked this time.

Unfortunately, upon installing it, I received THIS message:

QuoteThe package you tried to upload either is not a valid package or has become corrupted.

This is being reported for a number of the Modification that were re-installed following the server problems. PLEASE upload the current version to THIS THREAD.

Thanks!
Title: Re: SMF Poll Mod
Post by: clemenzo on January 21, 2008, 09:04:28 AM
Done! Mod added to mod page (http://custom.simplemachines.org/mods/index.php?mod=765) and first post (http://www.simplemachines.org/community/index.php?topic=176062.msg1121352#msg1121352) of this topic.
Title: Re: SMF Poll Mod
Post by: DHC on January 22, 2008, 04:08:48 PM
Thanks!

It works like a champ!
Title: Re: SMF Poll Mod
Post by: clemenzo on January 23, 2008, 07:25:28 AM
No problem! Thanks for using this mod!
Title: Re: SMF Poll Mod
Post by: madaisy on March 23, 2008, 07:18:15 AM
Sorry but i really don't know what to do after the installation.
I have SMF 1.1.4
Please help me!!
Title: Re: SMF Poll Mod
Post by: clemenzo on March 23, 2008, 07:31:56 AM
Quote from: madaisy on March 23, 2008, 07:18:15 AM
Sorry but i really don't know what to do after the installation.
I have SMF 1.1.4
Please help me!!

What is your site address? Do you use tinyportal?
Title: Re: SMF Poll Mod
Post by: Basie on March 23, 2008, 01:42:17 PM
In the first post, the demo for 'default theme' is not using the default theme.... ???
Title: Re: SMF Poll Mod
Post by: madaisy on March 23, 2008, 03:57:42 PM
Quote from: clemenzo on March 23, 2008, 07:31:56 AM
Quote from: madaisy on March 23, 2008, 07:18:15 AM
Sorry but i really don't know what to do after the installation.
I have SMF 1.1.4
Please help me!!

What is your site address? Do you use tinyportal?
www.extremesubs.it
no tinyportal...
Title: Re: SMF Poll Mod
Post by: clemenzo on March 24, 2008, 08:53:47 PM
Quote from: seek2501 on March 23, 2008, 01:42:17 PM
In the first post, the demo for 'default theme' is not using the default theme.... ???
Can you provide a screenshot of what you see, including the url address in the browser? I just checked and it is still using the default theme..
Title: Re: SMF Poll Mod
Post by: clemenzo on March 24, 2008, 08:56:13 PM
Quote from: madaisy on March 23, 2008, 03:57:42 PM
Quote from: clemenzo on March 23, 2008, 07:31:56 AM
Quote from: madaisy on March 23, 2008, 07:18:15 AM
Sorry but i really don't know what to do after the installation.
I have SMF 1.1.4
Please help me!!

I see that you are using MkPortal. This mod has not been tested with that CMS. Anyway, you should be able to see this mod in action within any poll topic in your forum. If you want to display a poll block within your CMS, you need to use SSI include with a php block to call the poll display function as described in the first post.

What is your site address? Do you use tinyportal?
www.extremesubs.it
no tinyportal...
Title: Re: SMF Poll Mod
Post by: bros on May 04, 2008, 09:02:12 PM
Will this be modified to work with SMF 2.0?
Title: Re: SMF Poll Mod
Post by: clemenzo on May 04, 2008, 09:17:55 PM
Quote from: bros on May 04, 2008, 09:02:12 PM
Will this be modified to work with SMF 2.0?
It should be, after SMF 2.0 final is out.. :)
Title: Re: SMF Poll Mod
Post by: bros on May 05, 2008, 11:05:34 AM
Quote from: clemenzo on May 04, 2008, 09:17:55 PM
Quote from: bros on May 04, 2008, 09:02:12 PM
Will this be modified to work with SMF 2.0?
It should be, after SMF 2.0 final is out.. :)

Awww. I want it for beta 3.1
Title: Re: SMF Poll Mod
Post by: midiof[f] on May 06, 2008, 02:48:45 AM
Modification file for SMF 1.1.5


modification.xml

<?xml version="1.0"?>
<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This is an example modification file for SMF packages.

ATTENTION: If you are trying to install this manually, you should try
the package manager.  If it will not work for you, please take a look
at the following for information on this format:
http://mods.simplemachines.org/docs/manual-install.php

================================================================================

Modification files can be used to modify files so that they do what
your package needs them to do to work properly.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
<id>clemenzo:SMFpoll</id>
<version>1.1.1</version>

<file name="$sourcedir/Display.php">
<operation>
<search position="replace"><![CDATA[ 'bar' => '<span style="white-space: nowrap;"><img src="' . $settings['images_url'] . '/poll_left.gif" alt="" /><img src="' . $settings['images_url'] . '/poll_middle.gif" width="' . $barWide . '" height="12" alt="-" /><img src="' . $settings['images_url'] . '/poll_right.gif" alt="" /></span>',]]></search>
<add><![CDATA[ 'bar' => '<span style="white-space: nowrap;"><img src="' . $settings['images_url'] . '/poll/poll_left_c'. $i%10 . '.gif" alt="" /><img src="' . $settings['images_url'] . '/poll/poll_middle_c' . $i%10 . '.gif" width="' . $barWide . '" height="12" alt="-" /><img src="' . $settings['images_url'] . '/poll/poll_right_c' . $i%10 . '.gif" alt="" /></span>',]]></add>
</operation>
</file>
 
  <file name="$themedir/Display.template.php">
<operation>
<search position="replace"><![CDATA[ // Are they not allowed to vote but allowed to view the options?
if ($context['poll']['show_results'] || !$context['allow_vote'])
{
echo '
<table>
<tr>
<td style="padding-top: 2ex;">
<table border="0" cellpadding="0" cellspacing="0">';

// Show each option with its corresponding percentage bar.
foreach ($context['poll']['options'] as $option)
echo '
<tr>
<td style="padding-right: 2ex;', $option['voted_this'] ? 'font-weight: bold;' : '', '">', $option['option'], '</td>', $context['allow_poll_view'] ? '
<td nowrap="nowrap">' . $option['bar'] . ' ' . $option['votes'] . ' (' . $option['percent'] . '%)</td>' : '', '
</tr>';

echo '
</table>
</td>
<td valign="bottom" style="padding-left: 15px;">';]]></search>
<add><![CDATA[ // Are they not allowed to vote but allowed to view the options?
if ($context['poll']['show_results'] || !$context['allow_vote'])
{
echo '
<table>
<tr>
<td style="padding-top: 2ex;">
<table border="0" cellpadding="0" cellspacing="1" width="100%">';

// Show each option with its corresponding percentage bar.
foreach ($context['poll']['options'] as $option)
echo '
<tr>
<td style="padding-right: 2ex;', $option['voted_this'] ? 'font-weight: bold;' : '', '" class="smalltext">', $option['option'], '</td>', $context['allow_poll_view'] ? '
<td nowrap="nowrap" class="smalltext">' . $option['bar'] . '</td>
<td nowrap="nowrap" class="smalltext">' . $option['votes']. ' (' . $option['percent'] . '%)</td>' : '', '
</tr>';

echo '
</table>
</td>
<td valign="bottom" style="padding-left: 15px;" class="smalltext">';]]></add>
</operation>

<operation>
<search position="replace"><![CDATA[ <tr>
<td colspan="2"><b>' . $txt['smf24'] . ': ' . $context['poll']['total_votes'] . '</b></td>
</tr>' : '', '
</table><br />';
}]]></search>
<add><![CDATA[ <tr>
  <td colspan="2">&nbsp;</td>
</tr>
        <tr>
<td colspan="2" class="smalltext"><b>' . $txt['smf24'] . ': ' . $context['poll']['total_votes'] . '</b></td>
</tr>' : '', '
</table><br />';
}]]></add>
</operation>

<operation>
<search position="replace"><![CDATA[ // They are allowed to vote! Go to it!
else
{
echo '
<form action="', $scripturl, '?action=vote;topic=', $context['current_topic'], '.', $context['start'], ';poll=', $context['poll']['id'], '" method="post" accept-charset="', $context['character_set'], '" style="margin: 0px;">
<table>
<tr>
<td colspan="2">';

// Show a warning if they are allowed more than one option.
if ($context['poll']['allowed_warning'])
echo '
', $context['poll']['allowed_warning'], '
</td>
</tr><tr>
<td>';

// Show each option with its button - a radio likely.
foreach ($context['poll']['options'] as $option)
echo '
', $option['vote_button'], ' ', $option['option'], '<br />';

echo '
</td>
<td valign="bottom" style="padding-left: 15px;">';]]></search>
<add><![CDATA[ // They are allowed to vote! Go to it!
else
{
echo '
<form action="', $scripturl, '?action=vote;topic=', $context['current_topic'], '.', $context['start'], ';poll=', $context['poll']['id'], '" method="post" accept-charset="', $context['character_set'], '" style="margin: 0px;">
<table>
<tr>
<td colspan="2" class="smalltext">';

// Show a warning if they are allowed more than one option.
if ($context['poll']['allowed_warning'])
echo '
', $context['poll']['allowed_warning'], '
</td>
</tr>
<tr>
    <td colspan="2">&nbsp;</td>
  </tr>
          <tr>
<td class="smalltext">';

// Show each option with its button - a radio likely.
foreach ($context['poll']['options'] as $option)
echo '
', $option['vote_button'], ' ', $option['option'], '<br />';

echo '
</td>
<td valign="bottom" style="padding-left: 15px;" class="smalltext">';]]></add>
</operation>

<operation>
<search position="replace"><![CDATA[ </tr><tr>
<td colspan="2"><input type="submit" value="', $txt['smf23'], '" /></td>
</tr>
</table>
<input type="hidden" name="sc" value="', $context['session_id'], '" />
</form>';
}]]></search>
<add><![CDATA[ </tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
          <tr>
<td colspan="2"><input type="submit" value="', $txt['smf23'], '" /></td>
</tr>
</table>
<input type="hidden" name="sc" value="', $context['session_id'], '" />
</form>';
}]]></add>
</operation>
</file>

  <file name="$boarddir/SSI.php">
<operation>
<search position="replace"><![CDATA[ $barWide = $bar == 0 ? 1 : floor(($bar * 5) / 3);]]></search>
<add><![CDATA[ $barWide = $bar == 0 ? 1 : floor(($bar * 5) / 9);]]></add>
</operation>

<operation>
<search position="replace"><![CDATA[ 'bar' => '<span style="white-space: nowrap;"><img src="' . $settings['images_url'] . '/poll_left.gif" alt="" /><img src="' . $settings['images_url'] . '/poll_middle.gif" width="' . $barWide . '" height="12" alt="-" /><img src="' . $settings['images_url'] . '/poll_right.gif" alt="" /></span>',]]></search>
<add><![CDATA[ 'bar' => '<span style="white-space: nowrap;"><img src="' . $settings['images_url'] . '/poll/poll_left_c' . $i%10 . '.gif" alt="" /><img src="' . $settings['images_url'] . '/poll/poll_middle_c' . $i%10 . '.gif" width="' . $barWide . '" height="12" alt="-" /><img src="' . $settings['images_url'] . '/poll/poll_right_c' . $i%10 . '.gif" alt="" /></span>',]]></add>
</operation>

<operation>
<search position="replace"><![CDATA[ <table border="0" cellspacing="1" cellpadding="0" class="ssi_table">
<tr>
<td><b>', $return['question'], '</b></td>
</tr>
<tr>
<td>', $return['allowed_warning'], '</td>
</tr>';]]></search>
<add><![CDATA[ <table border="0" cellspacing="1" cellpadding="0" class="ssi_table" width="100%">
<tr>
<td class="smalltext"><a href="', $boardurl, '/index.php?topic=', $return['topic'], '"><b>', $return['question'], '</b></a></td>
</tr>
<tr>
<td class="smalltext">', $return['allowed_warning'], '</td>
</tr>
        <tr>
  <td>&nbsp;</td>
</tr>';]]></add>
</operation>

<operation>
<search position="replace"><![CDATA[ foreach ($return['options'] as $option)
echo '
<tr>
<td><label for="', $option['id'], '">', $option['vote_button'], ' ', $option['option'], '</label></td>
</tr>';
echo '
<tr>
<td><input type="submit" value="', $txt['smf23'], '" /></td>
</tr>
</table>
<input type="hidden" name="sc" value="', $sc, '" />
</form>';]]></search>
<add><![CDATA[ foreach ($return['options'] as $option)
echo '
<tr>
<td class="smalltext"><label for="', $option['id'], '">', $option['vote_button'], ' ', $option['option'], '</label></td>
</tr>';
echo '
  <tr>
      <td>&nbsp;</td>
    </tr>
<tr>
<td align="center"><input type="submit" value="', $txt['smf23'], '" /></td>
</tr>
</table>
<input type="hidden" name="sc" value="', $sc, '" />
</form>';]]></add>
</operation>

<operation>
<search position="after"><![CDATA[
function ssi_showPoll($topic = null, $output_method = 'echo')
{]]></search>
<add><![CDATA[function random_poll($boards = "", $mode = "exclude"){
  global $db_prefix, $settings, $user_info;

  $boardsAllowed = boardsAllowedTo('poll_view');

  $request = db_query("SELECT t.ID_TOPIC FROM {$db_prefix}topics t, {$db_prefix}boards b, {$db_prefix}polls p WHERE t.locked = 0 AND t.ID_BOARD = b.ID_BOARD AND t.ID_POLL = p.ID_POLL AND p.votingLocked = 0 AND (p.expireTime = 0 OR p.expireTime > unix_timestamp())" . ($boards == "" ? "" : (" AND t.id_board" . ($mode == "exclude" ? " NOT": "") . " IN (" . implode(', ', $boards) . ")")) . " AND $user_info[query_see_board]" . (!in_array(0, $boardsAllowed) ? " AND b.id_board IN (" . implode(', ', $boardsAllowed) . ")" : '') . " ORDER BY rand() LIMIT 0, 1", __FILE__, __LINE__);

  $poll_topic = mysql_fetch_assoc($request);
  mysql_free_result($request);

  if(empty($poll_topic['ID_TOPIC']))
    echo "<p style=\"text-align: center; font-size: small;\">Sorry, no poll found.</p>";
  else
    ssi_showPoll($poll_topic['ID_TOPIC']);
}
]]></add>
</operation>

<operation>
<search position="replace"><![CDATA[ $request = db_query("
SELECT
p.ID_POLL, p.question, p.votingLocked, p.hideResults, p.expireTime, p.maxVotes]]></search>
<add><![CDATA[ $request = db_query("
SELECT
p.ID_POLL, p.question, p.votingLocked, p.hideResults, p.expireTime, p.maxVotes, b.ID_BOARD]]></add>
</operation>

<operation>
<search position="replace"><![CDATA[ $barWide = $bar == 0 ? 1 : floor(($bar * 5) / 3);]]></search>
<add><![CDATA[ $barWide = $bar == 0 ? 1 : floor(($bar * 5) / 9);]]></add>
</operation>

<operation>
<search position="replace"><![CDATA[ 'bar' => '<span style="white-space: nowrap;"><img src="' . $settings['images_url'] . '/poll_left.gif" alt="" /><img src="' . $settings['images_url'] . '/poll_middle.gif" width="' . $barWide . '" height="12" alt="-" /><img src="' . $settings['images_url'] . '/poll_right.gif" alt="" /></span>',]]></search>
<add><![CDATA[ 'bar' => '<span style="white-space: nowrap;"><img src="' . $settings['images_url'] . '/poll/poll_left_c' . $i%10 . '.gif" alt="" /><img src="' . $settings['images_url'] . '/poll/poll_middle_c' . $i%10 . '.gif" width="' . $barWide . '" height="12" alt="-" /><img src="' . $settings['images_url'] . '/poll/poll_right_c' . $i%10 . '.gif" alt="" /></span>',]]></add>
</operation>

<operation>
<search position="replace"><![CDATA[ <table border="0" cellspacing="1" cellpadding="0" class="ssi_table">
<tr>
<td><b>', $return['question'], '</b></td>
</tr>
<tr>
<td>', $return['allowed_warning'], '</td>
</tr>';]]></search>
<add><![CDATA[ <table border="0" cellspacing="1" cellpadding="0" class="ssi_table" width="100%">
<tr>
<td class="smalltext"><a href="', $boardurl, '/index.php?topic=', $return['topic'], '"><b>', $return['question'], '</b></a></td>
</tr>
<tr>
<td class="smalltext">', $return['allowed_warning'], '</td>
</tr>
          <tr>
    <td>&nbsp;</td>
  </tr>';]]></add>
</operation>

<operation>
<search position="replace"><![CDATA[ foreach ($return['options'] as $option)
echo '
<tr>
<td><label for="', $option['id'], '">', $option['vote_button'], ' ', $option['option'], '</label></td>
</tr>';
echo '
<tr>
<td><input type="submit" value="', $txt['smf23'], '" /></td>
</tr>
</table>
<input type="hidden" name="sc" value="', $sc, '" />
</form>';]]></search>
<add><![CDATA[ foreach ($return['options'] as $option)
echo '
<tr>
<td class="smalltext"><label for="', $option['id'], '">', $option['vote_button'], ' ', $option['option'], '</label></td>
</tr>';
echo '
      <tr>
        <td>&nbsp;</td>
      </tr>
<tr>
<td align="center"><input type="submit" value="', $txt['smf23'], '" /></td>
</tr>
</table>
<input type="hidden" name="sc" value="', $sc, '" />
</form>';]]></add>
</operation>

<operation>
<search position="replace"><![CDATA[ echo '
<table border="0" cellspacing="1" cellpadding="0" class="ssi_table">
<tr>
<td colspan="2"><b>', $return['question'], '</b></td>
</tr>';
foreach ($return['options'] as $option)
echo '
<tr>
<td align="right" valign="top">', $option['option'], '</td>
<td align="left">', $option['bar'], ' ', $option['votes'], ' (', $option['percent'], '%)</td>
</tr>';
echo '
<tr>
<td colspan="2"><b>', $txt['smf24'], ': ', $return['total_votes'], '</b></td>
</tr>
</table>';]]></search>
<add><![CDATA[ echo '
<table border="0" cellspacing="1" cellpadding="0" class="ssi_table" width="100%">
<tr>
<td colspan="2" class="smalltext"><a href="', $boardurl, '/index.php?topic=', $return['topic'], '"><b>', $return['question'], '</b></a></td>
</tr>
          <tr>
            <td colspan="2">&nbsp;</td>
          </tr>';
foreach ($return['options'] as $option)
echo '
<tr>
<td colspan="2" class="smalltext" style="border-top: #dddddd 1px dotted;">', $option['option'], '</td>
</tr>
          <tr>
            <td class="smalltext">', $option['bar'], '</td>
            <td align="right" class="smalltext" nowrap="nowrap">', $option['votes'], ' (', $option['percent'], '%)</td>
          </tr>';
echo '
  <tr>
        <td colspan="2" style="border-top: #dddddd 1px dotted;">&nbsp;</td>
      </tr>
<tr>
<td colspan="2" class="smalltext"><b>', $txt['smf24'], ': ', $return['total_votes'], '</b></td>
</tr>
</table>';]]></add>
</operation>

<operation>
<search position="replace"><![CDATA[ // Check if they can vote.
if (!empty($row['expireTime']) && $row['expireTime'] < time())
$allow_vote = false;
elseif ($user_info['is_guest'] || !empty($row['votingLocked']) || !allowedTo('poll_vote', array($row['ID_BOARD'])))
$allow_vote = false;
else
{
$request = db_query("
SELECT ID_MEMBER
FROM {$db_prefix}log_polls
WHERE ID_POLL = $row[ID_POLL]
AND ID_MEMBER = $ID_MEMBER
LIMIT 1", __FILE__, __LINE__);
$allow_vote = mysql_num_rows($request) == 0;
mysql_free_result($request);
}]]></search>
<add><![CDATA[ // Check if they can vote.
if ((!empty($row['expireTime']) && $row['expireTime'] < time()) || $user_info['is_guest'] || !empty($row['votingLocked']) || !allowedTo('poll_vote', $row['ID_BOARD'])){
$allow_vote = false;
} else {
$request = db_query("
SELECT ID_MEMBER
FROM {$db_prefix}log_polls
WHERE ID_POLL = $row[ID_POLL]
AND ID_MEMBER = $ID_MEMBER
LIMIT 1", __FILE__, __LINE__);
$allow_vote = mysql_num_rows($request) == 0;
mysql_free_result($request);
}]]></add>
</operation>
</file>
</modification>
Title: Re: SMF Poll Mod
Post by: clemenzo on May 07, 2008, 10:37:17 AM
Updated for SMF 1.1.5!
Title: Re: SMF Poll Mod
Post by: DistantJ on June 07, 2008, 07:15:32 PM
Hey, I really like this! Good job! I was never quite happy with those one-colour polls. Another one of the many little mods which have gone to make my board more colourful. :)
Title: Re: SMF Poll Mod
Post by: the_shadow on July 06, 2008, 01:56:27 PM
i install this mode but the buttun new pool on my template does't appear!!!! i'm not use a defaut template but a custom...someone have the solution?

thnkx
Title: Re: SMF Poll Mod
Post by: clemenzo on July 07, 2008, 09:00:06 PM
Quote from: the_shadow on July 06, 2008, 01:56:27 PM
i install this mode but the buttun new pool on my template does't appear!!!! i'm not use a defaut template but a custom...someone have the solution?

thnkx

You'll need modify your theme manually.. :) There are already many topics on and I think someone has developed a tool to help you make the changes.
Title: Re: SMF Poll Mod
Post by: the_shadow on July 08, 2008, 04:05:52 PM
the problem is....i don't understand much off this...

To show a poll in tinyportal block, add a block of type "phpbox" and enter the one of the following:

ssi_showPoll(X); - For a single fixed poll where X is a topic number.
random_poll(); - For a random poll from all boards accessible by user.
random_poll(Y); - For a random poll from all boards except Y where Y is a board number.
random_poll(array(Y, Z)); - For a random poll from all boards except Y, Z where Y and Z are board numbers.
random_poll(array(A, B, C), 'include'); - For a random poll from A, B, C where A, B and C are board numbers. Users unable to see board A would still be unable to see the poll from board A.

what this means???'
Title: Re: SMF Poll Mod
Post by: clemenzo on July 09, 2008, 11:10:10 AM
Quote from: the_shadow on July 08, 2008, 04:05:52 PM
the problem is....i don't understand much off this...

To show a poll in tinyportal block, add a block of type "phpbox" and enter the one of the following:

ssi_showPoll(X); - For a single fixed poll where X is a topic number.
random_poll(); - For a random poll from all boards accessible by user.
random_poll(Y); - For a random poll from all boards except Y where Y is a board number.
random_poll(array(Y, Z)); - For a random poll from all boards except Y, Z where Y and Z are board numbers.
random_poll(array(A, B, C), 'include'); - For a random poll from A, B, C where A, B and C are board numbers. Users unable to see board A would still be unable to see the poll from board A.

what this means???'

This is only relevant if you use TinyPortal mod. Else, simply install this mod and you should see the effect in your poll topic.
Title: Re: SMF Poll Mod
Post by: ghof on September 04, 2008, 09:16:12 PM
How do i install smf poll mod on the Musiconica theme?, specially on Display.template.php, im having trouble.
Title: Re: SMF Poll Mod
Post by: clemenzo on September 04, 2008, 09:22:55 PM
Quote from: ghof on September 04, 2008, 09:16:12 PM
How do i install smf poll mod on the Musiconica theme?, specially on Display.template.php, im having trouble.

You'll need to make changes to your theme files manually..
Title: Re: SMF Poll Mod
Post by: Bec on September 05, 2008, 02:49:33 AM
just wondering is there anyway to have the poll on the frontpage and not have it linked up to a post?
Title: Re: SMF Poll Mod
Post by: clemenzo on September 05, 2008, 05:19:40 AM
Quote from: Bec on September 05, 2008, 02:49:33 AM
just wondering is there anyway to have the poll on the frontpage and not have it linked up to a post?
Not this mod but you can definitely find some ready poll in javascript or cgi codes that allows you to link the poll elsewhere.
Title: Re: SMF Poll Mod
Post by: ghof on September 05, 2008, 06:42:39 AM
Quote from: clemenzo on September 04, 2008, 09:22:55 PM
Quote from: ghof on September 04, 2008, 09:16:12 PM
How do i install smf poll mod on the Musiconica theme?, specially on Display.template.php, im having trouble.

You'll need to make changes to your theme files manually..

Uhh, i know that...But the coding are different, what to modify in the file?
Please help me O:)
Title: Re: SMF Poll Mod
Post by: Bec on September 05, 2008, 06:52:49 AM
clemenzo thanks :)
Title: Re: SMF Poll Mod
Post by: offrocker on November 14, 2008, 04:11:04 PM
I have a custom theme (fire from theme shop) and uploaded the unzipped folder to the theme's images folder. I created a new poll and nothing has changed? It doesn't have the color bars? Is there another step?
Title: Re: SMF Poll Mod
Post by: offrocker on November 15, 2008, 12:44:35 PM
Now I've installed the mod and can it under package listings, but now the new poll that  i've created has no bars. Not the grey bars it had before and not the colorful ones from this mod? What's going on? Someone please tell me how to fix this.  :'(
Title: Re: SMF Poll Mod
Post by: TheDisturbedOne on December 06, 2008, 11:52:45 AM
Same here.  I don't know what happened...
Title: Re: SMF Poll Mod
Post by: offrocker on December 15, 2008, 01:46:05 AM
update, poll mod still not working. Is this mod compatible with smf version 2?
Title: Re: SMF Poll Mod
Post by: Ranjeet Malik on December 15, 2008, 02:07:46 PM
Great but will be greatest if the treasurey move along when we scroll the page like ad on  some site
Title: Re: SMF Poll Mod
Post by: Nabil1 on December 17, 2008, 03:58:17 AM
I wonder how to change the Style of the Poll Block , the Font , the Color of Font etc. but where to find the style code?, it's not in style.css , it must be somewhere ! 



Title: Re: SMF Poll Mod
Post by: fangweile on March 23, 2009, 10:10:31 PM
How do I hide poll result to guest in my tinyportal block?
Title: Re: SMF Poll Mod
Post by: tyty1234 on March 23, 2009, 10:15:05 PM
I have a suggestion for this mod.

Can it be possible where you grab a recent poll from a board? Where "X" is the board id, and the function is kinda like the ssi_recentPoll() function, but grabs it from a specified board. Is this possible?
Title: Re: SMF Poll Mod
Post by: RMX100 on June 17, 2009, 11:51:30 PM
dont'n work in smf 2.0 :'(
Title: Re: SMF Poll Mod
Post by: aw06 on September 29, 2009, 09:37:20 AM
Is this clear for SMF 1.1.10 ?
Title: Re: SMF Poll Mod
Post by: Arantor on September 29, 2009, 10:00:16 AM
Yes, this should work in 1.1.10.
Title: Re: SMF Poll Mod
Post by: TurtleKicker on November 12, 2009, 03:05:01 PM
Any chance of an update for SMF2 RC2?
Title: Re: SMF Poll Mod
Post by: Mick. on December 27, 2009, 02:33:21 PM
Quote from: sremick on November 12, 2009, 03:05:01 PM
Any chance of an update for SMF2 RC2?

bump...
Title: Re: SMF Poll Mod
Post by: Arantor on December 27, 2009, 04:29:55 PM
I guess not.
Title: Re: SMF Poll Mod
Post by: aw06 on March 27, 2010, 02:15:02 PM
Quote from: bluedevil on December 27, 2009, 02:33:21 PM
Quote from: sremick on November 12, 2009, 03:05:01 PM
Any chance of an update for SMF2 RC2?

bump...

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.iamletired.com%2Fforums%2Fimages%2Fsmilies%2Fbump.gif&hash=d273efb2b5fc2138fb4981f49d45ddeb7ffe8729)
Title: Re: SMF Poll Mod
Post by: lurkalot on July 06, 2010, 01:24:39 PM
Will this mod work with 1.1.11?

I mean, should it install and uninstall through the package manager without problem?

EDIT:  Please ignore my question, I looked at the package info and assumed 1.1.1 - 1.1.99 just about covered it.  :-[  Works fine.  ;)
Title: Re: SMF Poll Mod
Post by: lurkalot on July 06, 2010, 06:52:37 PM
Anyone know if there's a way to resize and layout images when using this in a Tinyportal 0.9.8 php block?

We use image addresses directly in the poll option boxes so you can see directly what image has what votes etc.

Any help would be appreciated.
Title: Re: SMF Poll Mod
Post by: EgAr on August 26, 2010, 09:56:40 PM
Quote from: aw06 on March 27, 2010, 02:15:02 PM
Quote from: bluedevil on December 27, 2009, 02:33:21 PM
Quote from: sremick on November 12, 2009, 03:05:01 PM
Any chance of an update for SMF2 RC2?

bump...



Any chance of an update for SMF2 RC3?
Title: Re: SMF Poll Mod
Post by: qubbah on October 28, 2010, 01:19:31 PM
Quote from: EgArâ„¢ on August 26, 2010, 09:56:40 PM
Quote from: aw06 on March 27, 2010, 02:15:02 PM
Quote from: bluedevil on December 27, 2009, 02:33:21 PM
Quote from: sremick on November 12, 2009, 03:05:01 PM
Any chance of an update for SMF2 RC2?

bump...



Any chance of an update for SMF2 RC3?

also waiting it...
Title: Re: SMF Poll Mod
Post by: lurkalot on January 16, 2011, 05:17:11 AM
Quote from: EgArâ„¢ on August 26, 2010, 09:56:40 PM

Any chance of an update for SMF2 RC3?


I would also love this to be ported over to SMF2.  Any plans for this please?
Title: Re: SMF Poll Mod
Post by: Manu.G on October 25, 2011, 05:42:40 PM
I would like to see this mod updated :D