MyBB Community Forums

Full Version: At Home Polls (Formerly Poll Box) v2.2.1
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
[Image: logo_homepoll.jpg]

My Website: http://kerfufflealliance.com

A plugin that allows a fully-functional MyBB poll to be displayed on your home pages. Now includes two versions:

Standard: A standard MyBB plugin that displays a poll on your Index and Portal pages. This version has no dependencies (other than MyBB 1.6).

Advanced Sidebox (ASB): Requires Advanced Sidebox 2.0.5 or later (found here: https://github.com/WildcardSearch/Advanced-Sidebox). This module allows you to display a sidebox-optimized poll in a sidebox on any page. This integrates directly with Advanced Sidebox (there's no MyBB plugin to install).

Download

GitHub: https://github.com/Tanweth/Poll-Box
MyBB Mods Page (v2.2 now validated): http://mods.mybb.com/view/at-home-polls

Features
  • Identify the poll to show either by pid (to show a specific poll), or fid (to show the latest poll in the given forum or forums).
  • If the member hasn't voted yet, it will display voting options. Otherwise it will display the results.
  • Includes a link to the original thread of the poll.
  • Inherits permissions from the poll's forum, so it won't display for members who aren't supposed to be able to see it.
  • NEW: After users vote, choose either to redirect them back to the page where they voted or to the poll's thread.
  • NEW: Choose whether or not to display latest poll if it is closed.
  • Compact layout optimized for sideboxes (default in ASB edition, available as setting in standard edition).

How to Install

Standard Edition: Upload the files in the Standard directory, and Install & Activate the plugin from the Configuration -> Plugins area of your Admin CP.

ASB Edition: Simply upload what's in the ASB directory, and Advanced Sidebox will automatically install the module.

Upgrading

Standard Edition: Unless otherwise stated above, you can upgrade simply by deactivating the old plugin version, uploading the new version, and reactivating it.

ASB Edition: In your Admin CP, go to Configure > Advanced Sidebox > Manage Modules. Find the line for "Poll," click on the Options link, then click "Delete." Then follow the installation instructions as normal.

If you previously used Poll Box, you may want to remove /inc/languages/english/asb_poll_box.lang.php for tidiness (it's harmless if it stays there).

Setting It Up
  • Advanced Sidebox: As with any sidebox, you must go to Admin CP -> Configuration -> Advanced Sidebox, and drag the "Poll" module to whichever side you want it to display. Then select which scripts (pages) you want the poll to display on in the resulting popup.
  • Standard: The poll should automatically be visible on the Index and Portal pages after activation (though it may not be if the templates for these pages are modified, see the Troubleshooting section below if you're having an issue).
  • Under Settings in the popup (ASB) or the At Home Polls settings group in the Settings section of your Admin CP (Standard), enter the fid(s) for the forum(s) you want the latest poll to be pulled from. You can find the fid in the URL for the forum (/forumdisplay.php?fid=<fid>, or /forum-<fid>.html" if you have search engine-friendly URLs on). If you have Google SEO or some other custom URL rules which make the fid not appear in the URL, you can find it in the URL attached to the New Thread button (/newthread.php?fid=<fid>).
  • If you'd prefer to specify a specific poll to display, you can enter its pid in the second dialog box under Settings. You can find the pid in the "Show Results" URL for the poll (polls.php?action=showresults&pid=<pid>).

Troubleshooting & Customization
  • If you are experiencing issues with the ASB edition, make sure you have the latest version of ASB (2.0.5 at the time of this readme).
  • On the standard edition, simple template edits are made to place the poll box on the Index and Portal pages. If these do not show up for any reason, or if you wish to move the location of the poll box, simply go to the index and portal templates and place the variable {$homepoll} wherever you want it to appear.

Screenshots - ASB Edition

Voting Options

Poll Results

Screenshots - Standard Edition

Voting Options

Standard Layout

Compact Layout

Settings

Changelog

2.2.1 - Added compatibility with ASB v2.1. If you do not use the ASB Edition, there is no reason to upgrade.

2.2
  • Globalized the $homepoll variable on the Standard Edition. Now you can add the poll to any page of your forums by placing "{$homepoll}" in any template (with some exceptions, including the header template). By default it still only displays on Index and Portal, and display on those pages can still be enabled/disabled in settings.
  • Improved the way the redirect back to the page where a poll action was taken is handled. It should now work on any page of the forums without issue. However, the redirect after editing a poll has been removed entirely. That implementation was more complex than I felt was worth to keep it around.
  • Fixed an issue where the pollbar graphic wouldn't appear on the Show Results page on the ASB Edition.
  • Cached the version number to make future upgrades easier (Standard only).

2.1
  • Now when users vote (or do any other poll action), they're redirected to the page where they voted rather than the poll's thread. The original behavior can be restored with a setting. There are two exceptions to this. ASB: The member profile pages. On these pages, the user is redirected to the forum index. Standard: Users are redirected to the forum index when editing the poll, even if they commenced the action from the Portal.
  • Added a setting to disable display of the poll if it is closed.
  • Standard: Fixed some display issues and made other improvements to the compact layout.
  • Standard: Templates are now added to the global template list when applicable, so that they aren't generating unnecessary database queries.
  • Improved the code's compliance with the MyBB Development Standards.
  • General code optimizations.

2.0.3
  • Corrected an issue on the ASB Edition where multiple poll sideboxes on the same page would display the same number of total votes.
  • Added an edit poll link visible to moderators of the poll's forum on both editions. This can be enabled and disabled with a setting on the ASB Edition (it is enabled by default).

2.0.2
  • Changed the way the total votes are displayed on the ASB Edition and compact layout, since it tended to take up two lines when the vote count reached double digits after the 2.0.1 edits.
  • Added an install routine that controls settings to the Standard Edition. This way you can deactivate it for an update without losing your custom settings.

2.0.1 - Made the ASB sidebox (or compact version on Standard) scale better to lower widths:
  • The width of the pollbars is now smaller on the compact version (Standard), and dynamically adjusts to the width of the sidebox (ASB).
  • The "Show Thread" and "Show Results" links now simply say "Thread" and "Results" so that they are more likely to fit on one line (ASB & Standard if compact layout).
  • Percentages are now represented as whole numbers with no decimal places to reduce the amount of space used (ASB & Standard if compact layout).
  • Fixed an issue where a piece of text was directly entered in the template rather than read from the language file.
  • Fixed the name of the settings group (previously called "Polls At Home") (Standard).

2.0
  • Renamed to At Home Polls (from Poll Box).
  • Added a MyBB plugin for those who prefer not to use Advanced Sidebox.
  • Fixed an issue introduced in Advanced Sidebox 2.0.5 whereby template edits would not be saved.
  • Fixed an issue where a postParser error would prevent viewing certain pages if the Poll module was enabled on those pages.
  • Rewrote most descriptions and instructions to be more helpful.
  • Other minor code revisions.
  • Minor changes to the compact layout to improve display.

1.0.2 - Added info on module and all settings to the language file, as this was previously overlooked (*smacks forehead*).

1.0.1 - Added "return true" if the sidebox has something to display, so that it will display for users who set "Show Sideboxes With No Content?" to No in Advanced Sidebox.
I've just finished a first look at the code and a first test run and I think that this is completely awesome, both in concept and implementation.

Beautiful work! Smile
Glad to hear that went well. I tested it a lot, but the thought always occurs to you that as soon as it touches another forum it won't work, or will at least do something quite unexpected. Toungue

Well that was fast. The module wasn't set to return true if it had content to display, which meant that even if it wasn't empty, it would disappear if used on a forum where "Show Sideboxes With No Content?" was set to "No" in Advanced Sidebox. That is now fixed, and both GitHub and the attachment have been updated. Kudos to Wildcard for letting me know about that. Smile

I also added a couple more code comments so that it should be easier to read if you delve into the code.

EDIT: Another quick update. The module and settings information is now in the language file rather than the module file. I just overlooked that when I was creating the language file.
Moved to releases.
are there any additional settings? it does not show up on Add-on Modules...
Hmm. Is the module file (poll_box.php) uploaded to your forum's inc/plugins/asb/modules directory? Is the language file (asb_poll_box.lang.php) uploaded to the inc/languages/english directory? Do all the other modules seem to show up correctly?

Other than those basics, I don't know what to tell you. As long as it is uploaded to the right directory, it should automatically show up in the Add-On Modules list. There are settings for the module (where you can set where to get the poll from), but those are only viewable when you're configuring the module.
yup, both files are in the correct directory... is it because im still using ver 1.7.3?

thanks for the prompt reply btw...
Quite possibly. I designed it using v2.0. I haven't tried it in any earlier versions.
thanks! working now!
i placed 2 polls in the sidebar and both of them show the same total even if one has more than double the votes of the other, is there a remedy for this issue? works fine expect for the total votes...
Pages: 1 2 3 4