[BETA] multiple choice voting in polls

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
vilaras
Registered User
Posts: 114
Joined: Wed Feb 19, 2003 11:16 pm
Location: Greece

New version within March

Post by vilaras »

Version 1.2.0 is ready on my computer but NOT out in public yet. The contents of the zip file need to be tested! After I test everything it will show up. Upgrade .txt will be also available.

This is going to be the last version. I've included all the features I thought appropriate.

There was some incompatibility with the Admin_Voting_Mod. There is no solution. You cannot have them both. Choose the one that serves your needs better.

Admin_Voting_Mod uses a field to record the chosen option, it's a single option. When having multiple answers which option is to be recorded in the single field? It would take either a huge number of fields to import into the database, or a quite complicated code modification.

By the way, I 'd like to mention my opinion on recording users' votes:
I don't want to know what each user yotes for, I do not want to have the option to do it. Administrator should be a person to trust and not to fear of.
Users are not stupid, soon they 'll find out the truth and all that will remain will be just an administrator with a deserted forum.
The essay is over, here are the new features to come in s few days:


Features, packed but not tested:

- Option to hide poll results till poll expires

- Hour(s) expiration option (besides the one that is to set Days).
[.
vilaras
Registered User
Posts: 114
Joined: Wed Feb 19, 2003 11:16 pm
Location: Greece

v.1.3.0

Post by vilaras »

v.1.3.0

Version 1.2.0 didn't make it to the public!

New features were added, so v.1.3.0 is out now.

Features added after 1.2.0:

1. Possible to hide Total number of votes (if detailed results are hidden) till the poll expires.
2. In view results screen time left to poll's expirartion is shown.

For features which were added in v. 1.2.0 see previous message.

This is probably the last version. All options I wanted are included. No reason for another version.

Soon it will be submitted for validation.
vilaras
Registered User
Posts: 114
Joined: Wed Feb 19, 2003 11:16 pm
Location: Greece

snapshots

Post by vilaras »

:!: By the way, I'd like to say something about administrators that are willing to know what each user votes for: They shouldn't trust this mod. I'll always be trying to support users' privacy. Maybe my attitude is quite disappointing for some people but my intention was to create a Mod that can be trusted for elections within unions/associations. :!:
Last edited by vilaras on Sat Oct 16, 2004 8:53 pm, edited 2 times in total.
Gix2NV
Registered User
Posts: 18
Joined: Fri Feb 28, 2003 5:56 pm

Post by Gix2NV »

any more on this. Where is this mod available vilaras?

I could use it big time.
User avatar
TheTazDevil
Registered User
Posts: 11
Joined: Wed Jan 01, 2003 6:10 am

Poll Mod

Post by TheTazDevil »

Well the Poll Mod works fine accept no Guests can Vote?

I want anyone to be able to Vote not just members ....
can that be fixed
vilaras
Registered User
Posts: 114
Joined: Wed Feb 19, 2003 11:16 pm
Location: Greece

Post by vilaras »

Gix2NV wrote: any more on this. Where is this mod available vilaras?

I could use it big time.


The link exists on the first post.
Last edited by vilaras on Wed Jun 25, 2003 9:53 pm, edited 1 time in total.
vilaras
Registered User
Posts: 114
Joined: Wed Feb 19, 2003 11:16 pm
Location: Greece

Re: Poll Mod

Post by vilaras »

TheTazDevil wrote: Well the Poll Mod works fine accept no Guests can Vote?

I want anyone to be able to Vote not just members ....
can that be fixed


I will have a look at it but I can't promise anything. Most probably you shouldn't expect any answer on it for the following ten days. I 'll let you know if I make any progress.
User avatar
Suede
Registered User
Posts: 342
Joined: Sat Dec 14, 2002 7:40 pm

Post by Suede »

installed this on a 2.0.3 board - excellent :)

Any way you can think of offhand to state whether a Poll is expired or active in the forum listing?

Thanks again for sharing this wonderful Mod :)
vilaras
Registered User
Posts: 114
Joined: Wed Feb 19, 2003 11:16 pm
Location: Greece

Post by vilaras »

edited - next message covers the subject
Last edited by vilaras on Wed Mar 26, 2003 4:59 pm, edited 1 time in total.
vilaras
Registered User
Posts: 114
Joined: Wed Feb 19, 2003 11:16 pm
Location: Greece

Post by vilaras »

Suede wrote: Any way you can think of offhand to state whether a Poll is expired or active in the forum listing?


I thought this might be easy so I had a look at it and I think I've got a solution for you.
If I understood well, you were asking for something like this:

Image

The picture "locked" appears after a poll expires.

I used an existing icon (just changed its size a little). It's been much easier this way.

You'll have to edit just one file. Copy and paste once and you're ready. :D Of course you should make a backup copy of the file before you edit it. Here is the code for it:

Code: Select all

#
#-----[ OPEN ]---------------------------------------------
#
viewforum.php
#
#-----[ FIND ]---------------------------------------------
#
			$topic_type .= $lang['Topic_Poll'] . ' ';
#
#-----[ REPLACE WITH ]---------------------------------------------
#
			$sql = "SELECT vd.vote_id, vd.vote_text, vd.vote_start, vd.vote_length
				FROM " . VOTE_DESC_TABLE . " vd
				WHERE vd.topic_id = $topic_id";
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, "Could not obtain vote data for this topic", '', __LINE__, __FILE__, $sql);
			}
			if ( $vote_info = $db->sql_fetchrowset($result) )
			{
				$temp1 = ( ( $vote_info[0]['vote_length'] > 0 ) && ( $vote_info[0]['vote_start'] + $vote_info[0]['vote_length'] < time() ) ) ? '<img src="' . $images['folder_locked'] . '" width="16" height="17">' : '';
				$topic_type .= $lang['Topic_Poll'] . $temp1 . ' ';
			}
			else
			{
				$topic_type .= $lang['Topic_Poll'] . ' ';
			}
#
#-----[ SAVE/CLOSE ALL FILES ]---------------------------------------------
#
# EoM



The End!

I'm sorry I can't do it better, I hope it's OK this way.

If you prefer to have the code in a text file, here it is (it's the same text as above), visit the following page and pick up the file:
poll_expired_mod.zip

If you change your mind just restore the back up file or undo the changes :)

* If you don't like this size replace width="16" height="17" with width="18" height="19" so that it gets its original size (though it should be a little smaller in order not to be exactly the same as when used to indicate a locked topic).
Last edited by vilaras on Sun Aug 17, 2003 6:06 pm, edited 1 time in total.
User avatar
Suede
Registered User
Posts: 342
Joined: Sat Dec 14, 2002 7:40 pm

Post by Suede »

yay! Thanks! worked like a charm vilaras :)
vilaras
Registered User
Posts: 114
Joined: Wed Feb 19, 2003 11:16 pm
Location: Greece

Post by vilaras »

Suede wrote: yay! Thanks! worked like a charm vilaras :)

always welcome!
thanks for letting me know it worked :D
vilaras
Registered User
Posts: 114
Joined: Wed Feb 19, 2003 11:16 pm
Location: Greece

Post by vilaras »

Multivote_Mod is not compatible with Admin_Voting_Mod

Here are some phrases stolen* from another forum:

this mod is buggy!!

you havent noticed you cant vote in half the polls around here

You could have said that there's a clash with the Admin Voting MOD!!!!


The problem is that I do not have a single idea on how polls can become useless. I've got no idea on what can be wrong. Unfortunately I don't know even the basics of phpbb. I've just copied and renamed procedures and variables which already existed in the code for other purposes. This is the reason everythiing seemed to work ok from the beginning. Everything was copied. It seems that when this bunch of copies (Multivote_Mod) is combined with Admin_Voting_Mod then strange things happen.
I suggest that you do not use both mods at the same time. Evaluate your needs and choose. Admin_Voting_Mod is a very good Mod. Besides its capability of showing the votes in detail, it has got other useful functions as well. Sorry, you can't have both. You might even get some valuable support from ErDrRon on his Mod, while I cannot help you with my Mod. If you follow what is written in the Mod's text, it is going to work - if not you'll have to start again from the beginning (except if you got EasyMod installed and functioning - in this case it will be installed correctly whether you like it or not :lol: )


* The phrases above come from the very good board phpbbfm.com. I visit other forums from time to time, but I cannot be everywhere present (at least with this username). It is difficult for me to participate (and probably discuss about Multivote_Mod) on more than one board at the same time. Thus, I do not use this username (vilaras) on other boards. Knowing of the negative opinions would be good for the people who might wish to use Multivote_Mod. This is the reason I've "stolen" the phrases above. Sorry!

----------------------------------------------------------------------------

In order to be honest with everybody I'll copy here a couple of paragraphs (concerning the incompatibility between Admin_Voting_Mod and Multivote_Mod) which you have probably read on previous posts of mine. Here they are:

-----------------------------------------------------------------------------
Deriel :
Can I integrate this Mod with Admin Voting Mod ? How?

EDITED: :? No, you cannot. Sorry. If you install both mods you won't be able to record what each user votes. If you do install both mods, you won't face any operational problems, but you 'll be missing one of the Admin_Voting_Mod's capabilities (that of presenting votes in detail).

You 'll have to choose, either the one or the other. If you have already installed them both, spying should be still operational for the single answer polls, but not for the multiple ones (only the last answer might be recorded. In such a case, if you are pleased with the current situation you might not want to upgrade MultiVote_Mod (v 1.0.0) in the future.
The next version of MultiVote_Mod is almost ready and totally incompatible with Admin Voting Mod.

Do you need more details? Here they are: ErDrRon adds a new field to the database table which concerns the voters, while I add a field to the database table that concerns the votes. Our Mods do not interfere one with the other on a database level. But, ...in order to make Multiple Choice Voting possible, I have to alter critical parts of the php code.

There was some incompatibility with the Admin_Voting_Mod. There is no solution. You cannot have them both. Choose the one that serves your needs better.

Admin_Voting_Mod uses a field to record the chosen option, it's a single option. When having multiple answers which option is to be recorded in the single field? It would take either a huge number of fields to import into the database, or a quite complicated code modification.

By the way, I 'd like to mention my opinion on recording users' votes:
I don't want to know what each user yotes for, I do not want to have the option to do it. Administrator should be a person to trust and not to fear of.
Users are not stupid, soon they 'll find out the truth and all that will remain will be just an administrator with a deserted forum.
----------------------------------------------------------------------------
Last edited by vilaras on Thu Mar 27, 2003 6:27 pm, edited 6 times in total.
spin
Registered User
Posts: 33
Joined: Fri Jun 07, 2002 7:53 am
Location: The Netherlands, Nijmegen
Contact:

Post by spin »

The admin voting mod really only changes 1 thing in the existing phpfiles. in posting.php it adds $vote_option_id to the VOTE_USERS_TABLE. Knowing this I had a look at your mod and noticed that you change the contents of this variable before the insert statement comes.

Here is a quick fix for the board side of things.
Install this if you have multivote and admin voting.
I have not yet added multivote to my own boards (but will), so I can't predict the effects it has in the acp, but this should fix polls on the boards atleast.

Code: Select all

Open /posting.php

Find (only in the code if you have multivote) :

		$sql = "SELECT vd.vote_id, vd.vote_max    
			FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr
			WHERE vd.topic_id = $topic_id 
				AND vr.vote_id = vd.vote_id 
				AND vr.vote_option_id = $vote_option_id
			GROUP BY vd.vote_id";

Before Add :
		$vote_option_id_tmp = $vote_option_id;


Find (only in the code if you have admin voting) :
			$sql = "INSERT INTO " . VOTE_USERS_TABLE . " (vote_id, vote_user_id, vote_user_ip, , vote_cast) 
				VALUES ($vote_id, " . $userdata['user_id'] . ", '$user_ip', $vote_option_id)";

Inline Find :
$vote_option_id

Inline Change to :
$vote_option_id_tmp
This would be the quickfix, though I would suggest in a next release, if it comes, you use a different variable in your mod. But that would offcourse be up to you entirelly :)
vilaras
Registered User
Posts: 114
Joined: Wed Feb 19, 2003 11:16 pm
Location: Greece

Post by vilaras »

spin wrote: The admin voting mod really only changes 1 thing in the existing phpfiles. in posting.php it adds $vote_option_id to the VOTE_USERS_TABLE.
..............
This would be the quickfix, though I would suggest in a next release, if it comes, you use a different variable in your mod. But that would offcourse be up to you entirelly

Thanks for working on it. :) It's not something I expected (nor had it in mind), but it's been a pleasant surprise. I've got a pretty long answer, so if you do not have time could come back some other time to go on with it. Don't worry, I'm not going to edit it! :lol:
A.
I agree about the table that The Admin_Voting_Mod uses. But what if users select more than one option? Let's say for a five options poll it would take four more fields to record the results. Let's suppose you have the following question "From the following goods choose the ones you buy every week". If a poll has got 50 options and allows up to 20 questions we are talking about 20 fields alltogether which should be added. Of course it would be possible to record all the answers in a text field, then whenever it is needed, pick up the text from the db, chop it down into pieces and recreate the answers. So, I believe it might get a little complicated to make it all happen the way it should, and of course would demand more power from the proccessor. Don't forget that, usually, in the agreement when you get the space for your site in the Internet, they state "...we have the right to turn off your site if it uses more than 5% or 10%, etc, of the proccessor's power"

B.
The second point is that I intentionally try to make Multivote_mod incompatible with Admin_Voting_Mod. I would like everyone visiting phpBB site to feel secure seeing that his vote will not be visible when he votes in any phpBB board (mine included). For the time being, whenever I am asked about the matter of the voting privacy, I just say "visit phpBB site where you can see the statement that Multivote_mod is incompatible with any spying Mod that might exist". I'm sure that the time of compatibility will come. Your Mod is the proof. I'm not feeling that privacy is in a serious danger yet. My idea for a future version is to add some routine that will be checking the software for "spying" Mods and show some relevant phrase somewhere on the screen. Otherwise no such phrase will appear. Maybe I will fed up with it and I'll stop caring of privacy later, but as long as I need to verify my board's security I 'll keep working on it.

Conclusion:
I'm glad you came up with a solution. I don't like people being sad. You gave them their smile back. If you decide to submit the modifications you suggest as a Mod I'll be glad to support you ( if there is something I can explain about my Mod). For the time being, as I said earlier, I believe you made them more compatible, but I'm feeling that they didn't become totally compatible. Of course if it comes to full compatibility I might want to start working on another "secure" version of Multivote_Mod. Another precondition is that I'll need myself a new "secure" version (in order to start working on a new version).
For the time being, my plans for electronic voting in my association were turned down (today I got the negative answer). People are still afraid to use Internet for the elections of the association. Next elections in my association are to come after two years!
Still, I'm not going to work towards compatibility. I will help you anyway I can, but I will not neither do it or include it in any version. If you want you can make it as a stand alone add-on Mod. :wink: . Or maybe you could cooperate with ErDrRon. He seems to be a very nice person, I think one reason he started Admin_Voting_Mod was because somebody requested for it. It's up to you. :)

The problem for me is the phrase "you cant vote in half the polls around here". I cannot understand if Multivote_Mod is responsible for this and, if yes, how can this happen (what I've done wrong). :?
Last edited by vilaras on Thu Mar 27, 2003 6:45 pm, edited 2 times in total.
Post Reply

Return to “[2.0.x] MODs in Development”