vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Miscellaneous Hacks - Advanced Poll Options (https://vborg.vbsupport.ru/showthread.php?t=324148)

MarkFL 01-07-2017 10:00 PM

Advanced Poll Options
 
1 Attachment(s)
This product is the result of a request from SilverBoy posted here:

vBulletin 4 Request - Poll checks

Overview:

This product allows you to designate certain usergroups whose members will have access to the advanced poll voting permission options that you select as active. These advanced options are on a per poll basis, that is, each poll can have its own set of advanced permission settings. The setting from which you can choose are:

Minimum Post Count: Users will be required to have at least the designated number of posts before being able to vote on polls.
Minimum Length Of Membership: Users will be required to have been a member of the forum for at least the designated number of days before being able to vote on polls.
Recent Post Requirement: Users will have to have posted during the last number of designated days before being able to vote on polls.
Reputation Points: Users will be required to have at least the designated number of reputation points before being able to vote on polls.
Infraction Points: Users will be required to have no more than the designated number of infraction points before being able to vote on polls.
User Groups: Users will be required to be a member of at least one of the designated usergroups before being allowed to vote on polls.

As of version 2.0, you now have global settings that will apply to all polls, and can only be overridden by users with access to the advanced options.

A user who has access to these advanced options, will see them when creating/editing a poll as follows:

https://vborg.vbsupport.ru/attachmen...1&d=1486924606

Updates:

Version 1.0.1:
  • Minor bug fixes.

Version 1.1:
  • Product now overrides usergroup and forum permissions to allow members of designated usergroups to vote.

Version 1.2:
  • When editing polls, entries with 0 as value display as blank.

Version 1.3:
  • Added setting to allow for selecting managing usergroups who can restrict poll voting by usergroup.

Version 1.4:
  • Added "Infraction Points" as an advanced poll option.

Version 1.5:
  • Added the option to require users to reply first to the poll thread before being allowed to vote.

Version 2.0:
  • Added settings for global options, that can only be overridden by users with access to the per poll advanced options.

Compatibility:

Tested and working on VB 4.2.x and may work on all 4.x versions of vBulletin.

Backup/Warning:

This product does alter your database, however it is always good practice to make regular backups and you should make a backup before installing ANY new mod.

As always, products are USE AT YOUR OWN RISK. I will provide support and do my best to help but no absolute guarantee is offered.

To Install:
  • Download and extract the attached .zip file.
  • Follow AdminCP -> Plugins & Products -> Manage Products -> Add/Import Product.
  • Click on "Choose File" and browse to the product .xml file that was packaged in the .zip file.
  • Click "Import."
  • You MUST enable the product in the settings before it will function.
  • Configure the remaining settings to your liking. Each setting has a detailed explanation of its use.

https://vborg.vbsupport.ru/attachmen...1&d=1486924606

Support for this product can be found here:

SilverBoy 01-08-2017 05:32 PM

Good job my friend :)

MarkFL 01-08-2017 05:37 PM

If you'd like any changes, please let me know. :)

SilverBoy 01-08-2017 05:40 PM

OK, let me test it and tell you if there is any thing ;)

MarkFL 01-08-2017 05:42 PM

I should have mentioned, all of the text on the new advanced options (the titles and descriptions) is phrased so you can translate, or change it as you see fit. Just look for global phrases that begin with:

markfl_advancedpolls

:D

SilverBoy 01-08-2017 05:44 PM

Don't worry about this ;)
I have translated my forum till vb1.1.3 and 1.1.5 days (2001) ^_^

SilverBoy 01-08-2017 07:08 PM

I tried to add a poll, and use only usergroups option and let other options blank, then I get this MySql error

PHP Code:

Database error in vBulletin 4.2.3:

Invalid SQL:

            
INSERT INTO advancedpolls
                
(
                    
pollidpostcountmembershiprecentpostreputation usergroups
                
)
            
VALUES
                
(
                    
5230000'4,2,16,15,35,6,5,13,1,3,47,46,7,14'
                
);

MySQL Error   You have an error in your SQL syntaxcheck the manual that corresponds to your MySQL server version for the right syntax to use near 'usergroups
                )
            VALUES
                (
                    523, 0, 0, 0, 0, '
4,2,16,15,35,6,5,13,' at line 3
Error Number  : 1064
Request Date  : Sunday, January 8th 2017 @ 09:06:35 PM
Error Date    : Sunday, January 8th 2017 @ 09:06:35 PM
Script        : http://www.manshor.net/forum/poll.php?do=postpoll&t=260571
Referrer      : http://www.manshor.net/forum/poll.php?t=260571&polloptions=5
IP Address    : 169.255.108.131
Username      : ���� �������
Classname     : vB_Database_MySQLi
MySQL Version : 5.5.52-cll

Stack Trace:

#0 vB_Database->halt() called in [path]/includes/class_core.php on line 1403
#1 vB_Database_MySQLi->execute_query() called in [path]/includes/class_core.php on line 444
#2 vB_Database->query_write() called in [path]/poll.php(339) : eval()'
d code on line 26
#3 eval() called in [path]/poll.php on line 339 


SilverBoy 01-08-2017 07:36 PM

I found the bug ..

in (Save Advanced Options For New Poll) plugin you forget to add (,) between reputation and usergroups.
the code must be like this
PHP Code:

$vbulletin->db->query_write("
            INSERT INTO " 
TABLE_PREFIX "advancedpolls
                (
                    pollid, postcount, membership, recentpost, reputation, usergroups 


SilverBoy 01-08-2017 07:41 PM

Another issue, when trying to delete any thread even if it didn't have a poll I get an error message
PHP Code:

 Fatal errorCall to a member function query_write() on null in /home/manshor/public_html/forum/includes/class_dm_threadpost.php(1545) : eval()'d code on line 1 


SilverBoy 01-08-2017 08:07 PM

Another issue, the system didn't let unregistered users to vote on the poll even if I add unregistered group to the group list that can vote if I disabled it in the usergroup global options (usergoup seetings) and in forum permissions.


All times are GMT. The time now is 02:48 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01178 seconds
  • Memory Usage 1,760KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete