News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

SMF Poll Mod

Started by clemenzo, June 09, 2007, 11:09:33 AM

Previous topic - Next topic

ChackanPT

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

clemenzo

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!

Godsongz

#82
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?

clemenzo

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.

Godsongz

hehe, umm, yeah...  I guess the simplest solution was the best one :)

Smith Online

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


clemenzo

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.

Smith Online

#87
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

Best Regards,
Smith Online


clemenzo

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.

clemenzo

Version 1.1.1 is released!

- Fixed random poll to exclude expired polls.

Mick.

Wow!  Im very impressed with this mod!  I love it.  Thank you!

Mick.

LOL.   I just realized is hard selecting polls when using the "pretty url" mod.

clemenzo

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?

Mick.

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.

clemenzo

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.

Mick.

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.

MadTurki

#96
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.

clemenzo

Sounds good.. I'll try find some time to add this in.. :)

DHC

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.

clemenzo

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.. :)

Advertisement: