Search

I have a project that requires a poll. I’ve looked around for something like disqus to satisfy the need but haven’t happened across anything that looks like it can be completely malleable as far as how it looks. Anyway, I searched through the extensions to see if there was anything that made polling easy in that it might take preliminary measures to make sure a user doesn’t submit their opinion more than once. Does anybody have a direction they could point me in?

I was just thinking about using Symphony for polling the other day, admittedly I took the easier route and just used PollDaddy.com for a simple site at work.

I wonder if you could set up a section that would basically store the answers for each question, along with the user’s cookie (notice that there’s a value in Param’s called $cookie-pass) and then use XSLT to display certain things depending on whether it can find a cookie already or not.

Maybe one of the more advanced Symphony users can explain it better, or give you a better method.

$cookie-pass seems to only exist if the user is logged in. Right now what I have worked out is to basically just use front end code to track cookies and display or not display the form based on whether or not the cookies reflect the user has taken the poll already. This is flimsy, but I think if somebody had their mind set on fudging the numbers they’d find a way anyway.

I’m interested in this idea again. I’m thinking about creating some sort of “voting” or “polling” functionality. It would seem like a good idea if I could write a simple cookie similar to what is already done when logged in, and also grab the users IP address?

That way I would create a section that would include their IP address and cookie and use XSL to check to make sure they haven’t voted already? Is that something a simple extension could do? Or how would you guys go about thinking about this?

That way I would create a section that would include their IP address and cookie and use XSL to check to make sure they haven’t voted already? Is that something a simple extension could do? Or how would you guys go about thinking about this?

I think a custom event will suffice to do this.

You could build this with native Symphony tools (Events and Data Sources) but I think writing a custom event would be neater.

If you need to do this with native Symphony components, here’s one way:

  • create a section with IP and Answer (a drop down of possible options say A, B and C)
  • use the Global Parameter Loader extension to create a parameter $ip-address that contains the user’s IP
  • use an Event to post this information into the section
  • use a Data Source to filter the section by the IP — if an entry is returned a user has already voted

But using custom code you’d be able to add an extra level of security to prevent multiple submissions.

I guess events are being executed before the XML is generated but wouldn’t it be neat if one could simply use Xpath in events to select things from the XML or the parameters?

This would reduce the need for custom database modifiers by quite a bit.

Don’t forget that people sitting behind a natting firewall will have the same IP address. It would be annoying to exclude all other employees of a company after one employee has voted!

Thanks everybody. Good points all around. Nick, I think I can totally see how it’d work with the Global Parameter Loader and getting the IP, that’s a good idea.

m_onkey, you do have a good point though about IP addresses. I think that’s why I was thinking something about using cookies. I realize they could clear their cache, but as long as it’s not sensitive information… then it’s not the hugest deal. I wonder if I could use Cookie Monster in some way. Not totally sure I understand what it does yet, but I’ll expiriment around with it.

If anyone else has any suggestions, I’m all ears. Thanks!

You can also use the Global Parameter Loader extension to manage cookies. Use the approach suggested above by Nick, but instead of filtering the section by IP you can filter by the value of the cookie.

How would the cookie be created? Through jQuery or something? Would the value of the cookie be the IP address?

How would the cookie be created? Through jQuery or something?

In your event there is a set_cookie line that will do that.

You can use PHP to set parameters with the Global Parameter Loader, so you can use http://php.net/manual/en/function.setcookie.php. I would put the id’s of polls where a user has cast a vote in a cookie. If your current poll id matches with a poll id in the cookie, display poll results and disallow voting.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details