Weighted Votes in Polls

Started by M-DVD, April 21, 2009, 12:07:34 PM

Previous topic - Next topic

M-DVD

Link to Mod




MOD Weighted Votes in Polls v1.0
=======================







  • Autor:
M-DVD
  • Version:
1.0
  • Release:
08th April 2009
  • Languages:
  • Compatible With:
SMF 1.1.1 - 1.1.8
SMF 2 Beta 3 & 4 & RC1




Comment this Mod
My MODs
Images
Help support my MODs

Features:

  • With this MOD you can set Weighted Votes in Polls according to Membergroups and by Boards.

  • You can set Weighted Votes for each Membergroups (1 by default) by Boards
    Admin > Forum > Boards > Modify Boards > Modify

  • You can enable/disable display "Normal Results" and/or "Weighted Results".
    SMF 1.1.X: Admin > Configuration > Features and Options > Basic Features
    SMF 2 RC1: Admin > Configuration > Features and Options > General

IMPORTANT RECOMENDATION: You shouldn't change the "weight vote" while a poll is active (no finished). The weighted result will be "false".
Example: before use this MOD, you should close and finish all the poll (old poll) in your forum.

Thanks to donjoe.

Example:

In Board 1: Senator (7), Secretary (5), Normal (1)
In Board 2: Senator (2), Secretary (2), Normal (7)
In Board 3: Senator (1), Secretary (5), Normal (7)







MemberGroupBoard 1Board 2Board 3
==============================
Senator
x 7
x 2
x 1
Secretary
x 2
x 2
x 5
Normal
x 1
x 7
x 7
==========================

Languages (normal & utf-8)


  • English
  • English_British
  • Spanish_Es
  • Spanish_Latin

$txt['mboards_weight_groups'] = 'Weighted Vote in Polls';
$txt['mboards_weight_groups_desc'] = 'Each vote will have worth by <i>Weight</i> voter group.<br />
<i>Note: Weight = 1 by default</i>'
;

$txt['show_title'] = 'Results Normal';
$txt['show_title_weighted'] = 'Results Weighted';
$txt['votes_weighted'] = 'weighted votes';

$txt['weightedvotes_mode'] = 'Poll Results mode';
$txt['weightedvotes_mode01'] = 'Show Results Normal';
$txt['weightedvotes_mode02'] = 'Show Results Weighted';
$txt['weightedvotes_mode03'] = 'Show Both Results';


I welcome new translations here

==========================

Características:

  • Con este MOD puedes fijar Votos Ponderados según el Grupo del Votante y según el Foro.

  • Puedes fijar los votos ponderados para cada grupo y foro (1 por defecto) en:
    Administración > Controles de Temas y Diseño > Foros > Modificar Foros > Modificar

  • Puedes activar/desactivar mostrar "Resultado Normal" y/o "Resultados Ponderados".
    SMF 1.1.X: Administración > Configuración del Foro > Características y Opciones > Características básicas
    SMF 2 RC1: Administración > Configuración del Foro > Características y Opciones > General

RECOMENDACIÓN IMPORTANTE: No debes cambiar los pesos de los votos mientras una encuesta esté activa. El Resultado Ponderado será "falso".
Ejemplo: antes de usar el MOD, debes cerrar y finalizar todas las encuestas existentes.

Fin.

Sudhakar Arjunan

Working on New Mods & Themes for SMF... Will update soon... My Blog page
My Smf forum : Discuss ITAcumens :: My SMF Forum

M-DVD


shanksta13

Looks like a great mod, I just installed it.  One small problem, I'd like to weight the results based on post-count groups, but most of my members are also members of other groups.  I left the "other groups" set to 1, and increased the post-count groups to more weight as the post-count group increased.  However, the weighted poll seems to be using the other groups as an overwrite for the post-count groups.  Any way to solve this?  If it's not clear what I'm saying, I can probably explain it a little better.

M-DVD

Quote from: shanksta13 on April 25, 2009, 01:44:53 PMI can probably explain it a little better.

Yes :P

But maybe this answer your question.

The Weigth Vote is decided as:

    If the user is Moderator Local
    Then
          Use this weight.
    Else
          If the user have Primary Group
          Then
                    Use this weight.
          Else
                    Use the weigth for Group Post Count.

shanksta13

Quote from: M-DVD on April 25, 2009, 02:14:11 PM
Quote from: shanksta13 on April 25, 2009, 01:44:53 PMI can probably explain it a little better.

Yes :P

But maybe this answer your question.

The Weigth Vote is decided as:

    If the user is Moderator Local
    Then
          Use this weight.
    Else
          If the user have Primary Group
          Then
                    Use this weight.
          Else
                    Use the weigth for Group Post Count.

Perfect, now is there any way I can make a custom modification to make Post-Count group the first option?  Or can you add this setting into the admin panel?  It sounds like maybe it's just a matter of switching that last else statement into the first if statement.

M-DVD

Quote from: shanksta13 on April 25, 2009, 02:19:26 PM
Perfect, now is there any way I can make a custom modification to make Post-Count group the first option?  Or can you add this setting into the admin panel?  It sounds like maybe it's just a matter of switching that last else statement into the first if statement.

I feel the current way is the most correct. A user can be "group charter" (example) and he can vote as a "charter" in all the forum. But he is a 'Moderator Local' in a Board. Then his vote would weigh as a Moderator Local here.

But, it's your decision. No problem :)

Seach in Sources/Poll.php

$ind = empty($user_info['is_mod']) ? (empty($user_settings['id_group']) ? $user_info['groups'][1] : $user_settings['id_group']) : '3';


Replace:

$ind = empty($user_settings['id_group']) ? (empty($user_info['is_mod']) ? $user_info['groups'][1] : '3') : $user_settings['id_group'];

shanksta13

Quote from: M-DVD on April 25, 2009, 09:11:17 PM
Quote from: shanksta13 on April 25, 2009, 02:19:26 PM
Perfect, now is there any way I can make a custom modification to make Post-Count group the first option?  Or can you add this setting into the admin panel?  It sounds like maybe it's just a matter of switching that last else statement into the first if statement.

I feel the current way is the most correct. A user can be "group charter" (example) and he can vote as a "charter" in all the forum. But he is a 'Moderator Local' in a Board. Then his vote would weigh as a Moderator Local here.

But, it's your decision. No problem :)

Seach in Sources/Poll.php

$ind = empty($user_info['is_mod']) ? (empty($user_settings['id_group']) ? $user_info['groups'][1] : $user_settings['id_group']) : '3';


Replace:

$ind = empty($user_settings['id_group']) ? (empty($user_info['is_mod']) ? $user_info['groups'][1] : '3') : $user_settings['id_group'];

That didn't seem to have any effect.  I think that's the right line of code, but just to clarify in case, I want the order to be:

1. Post-Count Group
2. Member Group
3. Local Moderator

M-DVD

Quote from: shanksta13 on April 26, 2009, 04:11:30 PM
That didn't seem to have any effect.  I think that's the right line of code, but just to clarify in case, I want the order to be:

1. Post-Count Group
2. Member Group
3. Local Moderator

Ok, I thought you wanted:
1. Primary Group
2. Local Moderator
3. Post-Count Group

In your case:
1. Post-Count Group
2. Member Group
3. Local Moderator

All member has a Post-Count Group, then never will be use the Weight primary group/moderator local.

shanksta13

Quote from: M-DVD on April 26, 2009, 05:09:01 PM
Quote from: shanksta13 on April 26, 2009, 04:11:30 PM
That didn't seem to have any effect.  I think that's the right line of code, but just to clarify in case, I want the order to be:

1. Post-Count Group
2. Member Group
3. Local Moderator

Ok, I thought you wanted:
1. Primary Group
2. Local Moderator
3. Post-Count Group

In your case:
1. Post-Count Group
2. Member Group
3. Local Moderator

All member has a Post-Count Group, then never will be use the Weight primary group/moderator local.

Okay, so is there any easy way to modify the code then to get this effect?

M-DVD

Quote from: shanksta13 on April 27, 2009, 01:36:51 AM
Okay, so is there any easy way to modify the code then to get this effect?

Ok, in this case, only use it:

$ind = $user_info['groups'][1]

emanuele

Quote from: M-DVD on April 21, 2009, 12:07:34 PM
IMPORTANT RECOMENDATION: You shouldn't change the "weight vote" while a poll is active (no finished). The weighted result will be "false".
Example: before use this MOD, you should close and finish all the poll (old poll) in your forum.
Hi, I would like to use this mod on my forum, just one question to have everything clear in my mind.

I would like to weight the votes in only one board.
Should I close anyway all the current polls in the entire forum?


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

shadowfax82

Hello everybody,

I'm the admin of hxxp:clubfordpuma.com/foro [nonactive].  I have a secondary group (members of the club).  What I want to do is to asign weight "2" to the members of the club, and weight "1" to the non-members.

I have just changed the weights in the desired board (previously, I did close all the polls inside it!), but the mod doesn't respond as required.

I need some help to put weighted polls in my forum.

Thanks to everybody :)

Sapinho®

*-* this is the mod i remember... u are the man, m-dvd, i hope u update son this :) congrantz

Advertisement: