Polls in posts

Download plugins, language packs and stuff.

Polls in posts

Postby FI-DD » Wed Apr 25, 2007 7:31 pm

This plugin lets you add a poll to the short story and/or full story.

If you are showing the short story and the full story at the same time (having {short-story} in the full story template) you can only have one poll.



Example: http://english.cutenews.ru/cuteru/examp ... -news.html



The vote is submitted using AJAX so there's no page reload.



Cookies prevent the user from multiple votes. After voting the user will see the poll results.



Installation:

1. Copy everything to the plugins folder.



2. Put this between the <head></head> tags of your page:

Code: Select all
<?=run_actions('additional_head_data'); ?>


3. To style the form or results open plugins/polls-in-posts.php and add your styling to the first function.



4. To add a poll to your post simply put something like this to your short and/or full story:

Code: Select all
[poll]
Yes
No
Maybe
[/poll]
(One option per line)

5. If you want to close a poll simply change it to
Code: Select all
[endpoll]
Yes ==> 45
No ==> 40
Maybe ==> 26
[/endpoll]
Attachments
polls-in-posts.zip
Polls in posts
(3.63 KiB) Downloaded 682 times
Last edited by FI-DD on Fri Nov 16, 2007 12:09 pm, edited 2 times in total.
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby Heya Im Me » Wed Apr 25, 2007 8:14 pm

Oh man, no way!! Thanks so much FI-DD! Fantastic job :D :D :D :D :D



I love how its AJAX, really great work



-HIM
Heya Im Me
 
Posts: 189
Joined: Wed Feb 01, 2006 4:06 am

Postby PJR » Wed Apr 25, 2007 10:05 pm

Very cool!! Thank you FI-DD!
PJR
 
Posts: 165
Joined: Mon Oct 17, 2005 3:15 pm
Location: Czech republic

Postby scottdallas » Thu Apr 26, 2007 1:15 am

I pooped a little. Yes, thank you more than words.
Everyday I'm tumblin http://scodal.tumblr.com
User avatar
scottdallas
 
Posts: 2209
Joined: Thu May 04, 2006 6:46 pm
Location: US

Postby Saszoo » Thu Apr 26, 2007 6:49 am

Three words:

AWSOME :D
User avatar
Saszoo
 
Posts: 414
Joined: Wed Jun 07, 2006 10:34 pm
Location: Norway

Very nice.

Postby gauss » Thu Apr 26, 2007 9:32 am

thx
User avatar
gauss
 
Posts: 23
Joined: Wed Sep 06, 2006 11:13 am

Postby scottdallas » Fri Apr 27, 2007 7:00 am

I have a few small issues that I wondered about. Nothing that needs immediate attention or anything.. just some small things I noticed and tried to change myself but failed.



Okay first, I changed the style from 'grey' to a hex code color and it just WILL NOT change the color from grey. Here's where I changed it (and cleared cache afterwards just in case):



plugins/polls-in-posts.php

Code: Select all
$output .= ".poll_result_short {padding:1px; border:1px solid black; background-color: #848284}\n";

$output .= ".poll_result_full {padding:1px; border:1px solid black; background-color: #848284}\n";




You can see that I added the hex. Should that do it or am I missing something somewhere else? I couldn't find any instance of colors anywhere in any of the code.



Also, sometimes the font will get switched to Times New Roman (or default browser font) so is there a way to set a permanent font on this? Would I do it in the same area that I'm working with these colors?



And lastly, I noticed after I save a poll that when I go edit it again it shows me how many votes had been added to each option.. but these don't display on my site to my visitors. Is it supposed to? It would be really nice if it did. I can't figure out how something can be written in my {short-story} but it won't show up on the site. You can see it here http://www.scottdizzle.com



Well.. sorry for writing a book. That's just my experience with this. I'm so excited about this thing you have no idea.



edit: Uhoh.. when I use search and it pulls up a poll it gives errors like this:



http://www.scottdizzle.com/search.php?d ... &category=



or



http://www.scottdizzle.com/search.php?d ... &category=



I've been trying to figure out what's wrong.. but I can't seem to nail it. I have a feeling it's to do with one of the filters in search.php.. maybe highlight?



Edit again:



Yep.. I changed line 77 of search.php to:



Code: Select all
//add_filter('news-entry-content', 'Highlight_Search', 999);




and now all errors are gone and polls display properly.
Everyday I'm tumblin http://scodal.tumblr.com
User avatar
scottdallas
 
Posts: 2209
Joined: Thu May 04, 2006 6:46 pm
Location: US

Postby FI-DD » Fri Apr 27, 2007 11:06 am

scottdallas wrote:Okay first, I changed the style from 'grey' to a hex code color and it just WILL NOT change the color from grey.


Are you sure that #848284 is a valid color?

Btw, I successfully changed the example to #c0c0c0:

http://english.cutenews.ru/cuteru/examp ... -news.html



Also, sometimes the font will get switched to Times New Roman (or default browser font) so is there a way to set a permanent font on this? Would I do it in the same area that I'm working with these colors?


Yep, same place, simple CSS - "font-family:myfont" should do it.



And lastly, I noticed after I save a poll that when I go edit it again it shows me how many votes had been added to each option.. but these don't display on my site to my visitors. Is it supposed to? It would be really nice if it did.


Yeah, I noticed that too when voting on your page. Just the percentages is not very usefull.

How and where do you want to show votes per option and total votes? A simple screenshot would be helpfull.
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby scottdallas » Fri Apr 27, 2007 11:20 am

You're right.. bad hex color lol. I tried again and it worked. Stupid me. I must have been working with not enough sleep or something. Font fix works too. Thanks man.



As for the the screenshot to show the votes.. I was thinking something like this:



Image



or anything you could think of that would look better, nicer, or cooler.
Everyday I'm tumblin http://scodal.tumblr.com
User avatar
scottdallas
 
Posts: 2209
Joined: Thu May 04, 2006 6:46 pm
Location: US

Postby FI-DD » Fri Apr 27, 2007 12:51 pm

Updated.



(I didn't add the number of votes to the poll form because I think it would influence the user's choice.)
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby scottdallas » Fri Apr 27, 2007 6:23 pm

Mmmmmm very true! Good thinking. Thanks man, I'll redownload. :D
Everyday I'm tumblin http://scodal.tumblr.com
User avatar
scottdallas
 
Posts: 2209
Joined: Thu May 04, 2006 6:46 pm
Location: US

Postby scottdallas » Sun Apr 29, 2007 7:54 am

Hey FI-DD I hate to be a pest.. but I wondered if you had any trouble with polls in posts getting stuck in 'Saving vote' mode. Sometimes I can't vote (sometimes it's 50/50 if it will work) and Ramon said he tried to vote on www.tastypolls.com and it would just hang there. Could I have maybe forgot to add something in the code? Perhaps a server issue? I use PHP 4 and MySQL 4.1 on Linux servers.



I'm gonna see if your example page gives me any troubles.
Everyday I'm tumblin http://scodal.tumblr.com
User avatar
scottdallas
 
Posts: 2209
Joined: Thu May 04, 2006 6:46 pm
Location: US

Postby Heya Im Me » Tue May 01, 2007 7:32 am

Hey Scott,



I checked with my error console and it seems to be a security issue that I had trouble with on the AJAX comments pagination:

Error: uncaught exception: Permission denied to call method XMLHttpRequest.open



I fooled around with the javascript file a bit and I got it to work. I'll post what I did later today since I'm about to head to bed.



-HIM
Heya Im Me
 
Posts: 189
Joined: Wed Feb 01, 2006 4:06 am

Postby scottdallas » Tue May 01, 2007 4:11 pm

Thanks Heya Im Me! I would've never figured that out. I'll be waiting to hear what you came up with. I don't seem to have this problem with ajax comment pagination but maybe I do and just didn't notice it yet.
Everyday I'm tumblin http://scodal.tumblr.com
User avatar
scottdallas
 
Posts: 2209
Joined: Thu May 04, 2006 6:46 pm
Location: US

Postby FI-DD » Tue May 01, 2007 5:45 pm

Heya Im Me wrote:Error: uncaught exception: Permission denied to call method XMLHttpRequest.open


Yes, that's the error I get when voting on tastypolls.com. No idea what's wrong. :?
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Next

Return to Additional Downloads



Who is online

Users browsing this forum: No registered users and 0 guests

cron