{"id":15688329,"url":"https://github.com/luwes/craft-polls","last_synced_at":"2025-07-18T03:33:24.284Z","repository":{"id":146460571,"uuid":"68004058","full_name":"luwes/craft-polls","owner":"luwes","description":":bar_chart: A fully featured polls plugin for Craft CMS.","archived":false,"fork":false,"pushed_at":"2018-07-02T13:33:24.000Z","size":90,"stargazers_count":8,"open_issues_count":5,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-07T21:02:33.209Z","etag":null,"topics":["craft-plugin","craftcms","poll"],"latest_commit_sha":null,"homepage":"https://wesleyluyten.com/projects/craft-cms-polls","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/luwes.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2016-09-12T11:42:44.000Z","updated_at":"2023-06-28T14:41:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"f55b6765-49e3-4f67-9fe5-f1d139d29cf5","html_url":"https://github.com/luwes/craft-polls","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/luwes/craft-polls","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luwes%2Fcraft-polls","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luwes%2Fcraft-polls/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luwes%2Fcraft-polls/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luwes%2Fcraft-polls/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luwes","download_url":"https://codeload.github.com/luwes/craft-polls/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luwes%2Fcraft-polls/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265696557,"owners_count":23812786,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["craft-plugin","craftcms","poll"],"created_at":"2024-10-03T17:58:03.543Z","updated_at":"2025-07-18T03:33:24.264Z","avatar_url":"https://github.com/luwes.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Craft CMS Polls plugin\n\nA fully featured polls plugin for [Craft CMS](https://craftcms.com/). Including translatable questions and options, custom fields for answer options, anonymous voting or login required, a bar graph in the answers admin section, other option for free text input.\n\nA license for commercial use and more information can be found at [wesleyluyten.com/projects/craft-cms-polls](https://wesleyluyten.com/projects/craft-cms-polls)\n\n### Important \nThe source of this plugin is shared but it's not free to use on commercial websites, please consult the [LICENSE](LICENSE.md \"Craft CMS Polls plugin license\") before using this plugin.\n\n### Requirements\n- Craft 2.4+  \n- PHP 5.4+  \n\n### Install\n1. Download and unzip Polls plugin zip file.  \n2. Drop polls plugin folder in craft/plugins.  \n3. Go to Admin / Settings / Plugins and click install.  \n\n### Update\n1. Download and unzip Polls plugin zip file.  \n2. Replace craft/plugins/polls folder by the one that you have downloaded.  \n\n### Quick start\n\nTo add a basic poll form to your website insert this code in your template.\n\n``` twig\n{{ craft.polls.form({ \n    pollResponse: pollResponse|default(null)\n}) }}\n```\n\n\u003e You can also write your own HTML by copying the contents of [templates/forms/basic.html](templates/forms/basic.html) in your own template and tweaking as you see fit.\n\n##### Parameters\n\n###### questions\nLimit the questions that get added to the form. For example: `questions: craft.polls.questions({ pollId: 1 })`\n\n###### pollResponse\nThis parameter is a route variable send back from the Polls_AnswersController which returns information when the form is submitted. In case it fails this variable holds the errors, when the submission is a success it returns the answers and answeredQuestions.\n\n\n### Templating Reference\n\n#### craft.polls.questions\nYou can access your site’s poll questions from your templates via craft.polls.questions. It returns an ElementCriteriaModel object. This is a simplified example, for a more full and robust solution refer to the html in [templates/forms/basic.html](templates/forms/basic.html)\n\n``` twig\n\u003cform class=\"poll-form\" method=\"post\" accept-charset=\"UTF-8\"\u003e\n\t{{ getCsrfInput() }}\n\t\u003cinput type=\"hidden\" name=\"action\" value=\"polls/answers/saveAnswers\"\u003e\n\t{% for question in craft.polls.questions %}\n\t\t\u003ch1\u003e{{ question.title }}\u003c/h1\u003e\n\t\t\u003cdiv class=\"poll-options\"\u003e\n\t\t\t{% for option in question.options %}\n\t\t\t\t\u003cdiv class=\"poll-option {{ option.kind }}\"\u003e\n\t\t\t\t\t\u003clabel\u003e\n\t\t\t\t\t\t\u003cinput type=\"hidden\" value=\"\" name=\"{{ option.optionInputName }}\"\u003e \n\t\t\t\t\t\t\u003cinput class=\"poll-option-input {{ option.kind }}\" type=\"radio\" value=\"{{ option.id }}\" name=\"{{ option.optionInputName }}\" {% if option.selected %} checked=\"checked\"{% endif %}\u003e \n\t\t\t\t\t\t{{ option.label }}\n\t\t\t\t\t\u003c/label\u003e\n\t\t\t\t\u003c/div\u003e\n\t\t\t{% endfor %}\n\t\t\u003c/div\u003e\n\t{% endfor %}\n\t\u003cbutton type=\"submit\"\u003eVote\u003c/button\u003e\n\u003c/form\u003e\n```\n\n##### Parameters\n\n###### poll\nOnly fetch questions that belong to a given poll(s). Accepted values include a poll handle, an array of poll handles.\n\n###### pollId\nOnly fetch questions that belong to a given poll(s), referenced by its ID.\n\n\n#### craft.polls.getAllPolls()\nReturns an array of Polls_PollModel objects representing each of your site’s polls.\n``` twig\n{% set polls = craft.polls.getAllPolls() %}\n```\n\n#### craft.polls.getTotalPolls()\nReturns the total number of polls your site has.\n``` twig\n{% set total = craft.polls.getTotalPolls() %}\n```\n\n#### craft.polls.getPollById( pollId )\nReturns a Polls_PollModel object representing a section in your site, by its ID.\n``` twig\n{% set poll = craft.polls.getPollById(pollId) %}\n```\n\n#### craft.polls.getPollByHandle( pollHandle )\nReturns a Polls_PollModel object representing a poll in your site, by its handle.\n``` twig\n{% set poll = craft.polls.getPollByHandle(pollHandle) %}\n```\n\n#### craft.polls.hasAnswered( questions )\nReturns true if the user/guest has answered all the questions.\n``` twig\n{% if craft.polls.hasAnswered(questions) %}\n\t\u003ca class=\"poll-results-link\" href=\"#\"\u003eResults\u003c/a\u003e\n{% endif %}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluwes%2Fcraft-polls","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluwes%2Fcraft-polls","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluwes%2Fcraft-polls/lists"}