• Welcome to Simple Machines Community Forum. Please login or sign up.
January 17, 2022, 02:23:56 PM

News:

SMF 2.0.19 has been released! Please update. Read more.


Who Voted What?

Started by Søren Bjerg, August 30, 2006, 09:25:16 PM

Previous topic - Next topic

corruptor

Quote from: Vinspire on September 13, 2006, 01:00:58 PM
Quote from: usvi4me on September 13, 2006, 10:57:14 AM
Quote from: Søren Bjerg on September 13, 2006, 01:51:11 AM
I think I might have gotten it now... you're using a custom theme, right? In that case, it probably hasn't added the modifications to the Display.template.php in your theme directory.

Try seeing if it works as supposed to with the default theme :).

If it doesn't, I'm afraid I'm as cluesless as to why it's not working, as you are :/.

This mod does not install properly when you use a theme other than default.
I have the Amber theme as default.  In permissions the view result option shows up.  When checked for a group, no dropdown boxes are displayed - yet the option in Permissions is there.
I uninstalled the mod, set up the forum with the default theme and re-installed the mod. YES, it works.  Then re-installed the theme and the post result dropdowns are GONE.

Any suggestions as to what I need to change for the AMBER theme ?

Almost every mods won't work perfectly in a custom theme. You need to modify the file manually.

I can't find the thread about how to make mods work with custom theme  :-\

This is the single most frustrating fact about mods!
There needs to be a way simplify this by using a standard or keeping things consitant.
I tried to modify the files manually but got errors. I am not a programmer, and reading lines of code is not fun to me. (my problem, I know)
I am scared I will mess up a working site... (yes I make backups)
If anyone can help, I would love you forever for it. ( i know, you are all excited about that!  ::)  )

usvi4me


Quote

This is the single most frustrating fact about mods!
There needs to be a way simplify this by using a standard or keeping things consitant.
I tried to modify the files manually but got errors. I am not a programmer, and reading lines of code is not fun to me. (my problem, I know)
I am scared I will mess up a working site... (yes I make backups)
If anyone can help, I would love you forever for it. ( i know, you are all excited about that!  ::)  )

For now this is my resolution as I really WANT this mod.

When I need to look at a poll and find out who voted what, I set the server mode in maintenance for a few minutes, change to the default theme and check the results.  Then ofcourse I have to remember to set it back to MY preferred theme and take it out of maintenance mode.

Maybe Soren will find us a fix ......

corruptor

My purpose is a little different. I intend to use this mod to show availability of other players for an event.
For example,
Poll: Who is available for scrim tonight?
Available ----------------------------------100% joe, jim, josh, jack
Not available-----0%

So I need this to work in my theme as it matches the site. Plus all the editing I have done to the theme, grrr.

I really would like this mod as well. There are others that I have to live without since they only work with default mod. Again, this is soooo frustrating.

Vinspire

September 13, 2006, 01:49:22 PM #23 Last Edit: September 13, 2006, 01:59:19 PM by Vinspire
Quote from: corruptor on September 13, 2006, 01:08:26 PM
This is the single most frustrating fact about mods!
There needs to be a way simplify this by using a standard or keeping things consitant.
I tried to modify the files manually but got errors. I am not a programmer, and reading lines of code is not fun to me. (my problem, I know)
I am scared I will mess up a working site... (yes I make backups)
If anyone can help, I would love you forever for it. ( i know, you are all excited about that!  ::)  )

Quote from: usvi4me on September 13, 2006, 01:37:54 PM
For now this is my resolution as I really WANT this mod.

When I need to look at a poll and find out who voted what, I set the server mode in maintenance for a few minutes, change to the default theme and check the results.  Then ofcourse I have to remember to set it back to MY preferred theme and take it out of maintenance mode.

Maybe Soren will find us a fix ......

The thing is this is not Soren fault. He can't modified every single themes in SMF Board you know ?  :-\

Anyway, I've highlighted out what you guys need to do.

What you need to do to get it to work on other theme is modified Display.template.php and Modifications.english.php

P/S : Remember to make a backup copy of this file before you modified it :)

Display.template.php

Search for

![CDATA[ // Show each option with its corresponding percentage bar.
foreach ($context['poll']['options'] as $option)
echo '
<tr>
<td style="padding-right: 2ex;', $option['voted_this'] ? 'font-weight: bold;' : '', '">', $option['option'], '</td>', $context['allow_poll_view'] ? '
<td nowrap="nowrap">' . $option['bar'] . ' ' . $option['votes'] . ' (' . $option['percent'] . '%)</td>' : '', '
</tr>';


Replace that code with this

![CDATA[ // Show each option with its corresponding percentage bar.
foreach ($context['poll']['options'] as $option)
{
echo '
<tr>
<td style="padding-right: 2ex;', $option['voted_this'] ? 'font-weight: bold;' : '', '">', $option['option'], '</td>', $context['allow_poll_view'] ? '
<td nowrap="nowrap">' . $option['bar'] . ' ' . $option['votes'] . ' (' . $option['percent'] . '%)</td>' : '', '';
        // [Who Voted What?]
        if (allowedTo('poll_view_voters'))
        {
          echo '
  <td style="padding-left: 2ex;">
                    <select name="voters' . $option['ID_OPTION'] . '" id="jumpto" onchange="if (this.selectedIndex > 0 &amp;&amp; this.options[this.selectedIndex].value) window.location.href = smf_scripturl + this.options[this.selectedIndex].value.substr(smf_scripturl.indexOf(\'?\') == -1 || this.options[this.selectedIndex].value.substr(0, 1) != \'?\' ? 0 : 1);" style="width: 150px;">';
          if (!empty($context['poll']['options'][$option['ID_OPTION']]['voters']))
          {
            echo '
                      <option selected="selected" value="#">' . $txt['poll_view_voters_expand_to_view'] . '</option>
                      <option disabled="disabled" value="">----------------------</option>';
            foreach ($context['poll']['options'][$option['ID_OPTION']]['voters'] as $voter)
            {
              echo '
                      <option value="?action=profile;u=' . $voter['ID_MEMBER'] . '"> => ' . $voter['realName'] . '</option>';
            }
            echo '
                      <option disabled="disabled" value="">----------------------</option>
                      <option disabled="disabled" value="">' . $txt['poll_view_voters_expanded_help1'] . '</option>
                      <option disabled="disabled" value="">' . $txt['poll_view_voters_expanded_help2'] . '</option>';

          } else
          {
            echo '
                      <option disabled="disabled" selected="selected" value="">----------------------</option>';
          }
          echo '
                    </select>
                  </td>
          ';
        }
        echo '
</tr>';
}


Then go to your theme language folder look for Modifications.english.php file

Search

position="end"

Add this code before that code

![CDATA[// [Who Voted What?]
$txt['poll_view_voters_expand_to_view'] = 'Expand to view:';
$txt['poll_view_voters_expanded_help1'] = 'Select a name to view';
$txt['poll_view_voters_expanded_help2'] = 'the member\'s profile...';
$txt['cannot_poll_view_voters'] = 'Sorry, you\'re not allowed to view which members voted for what option in the poll.';
$txt['permissionname_poll_view_voters'] = 'View voters';
$txt['permissionhelp_poll_view_voters'] = 'This permission allows people to see which members voted for what option in a poll.';

corruptor

Well I tried this, but I gete a php error.

The problem is, there is no "Modifications.english.php" in any of the 5 themes I have. This only exist in the default theme.

I even tried putting a copy in my theme folder.

I did confirm it does work fine with my default theme. Nice mod. I would like to see the name listed instead of a pull down.

Thanks for your help man, but I am about to give up...

Vinspire

Quote from: corruptor on September 13, 2006, 02:23:07 PM
Well I tried this, but I gete a php error.

The problem is, there is no "Modifications.english.php" in any of the 5 themes I have. This only exist in the default theme.

I even tried putting a copy in my theme folder.

I did confirm it does work fine with my default theme. Nice mod. I would like to see the name listed instead of a pull down.

Thanks for your help man, but I am about to give up...

What is the error ? No "Modifications.english.php" then create one file with that name put in the code and create a "language" folder under ur theme .... After that copy and put in "Modifications.english.php" onto that folder.

Søren Bjerg

I'm afraid the (great) advice Vinspire has been giving is about as much advice I could give to get it running with a custom theme as well.

As for having the names listed on the page instead of the select box, I did play around with ways of displaying it such in a neat way, but it didn't work out too nicely for me, so I ended up with the select box.
RUNE HORDES dot INFO - SMF 1.1.10 w/ Custom Profile Mod... and various permissions hooks and template changes (new topic form).

Vinspire

Quote from: Søren Bjerg on September 13, 2006, 02:33:17 PM
I'm afraid the (great) advice Vinspire has been giving is about as much advice I could give to get it running with a custom theme as well.

As for having the names listed on the page instead of the select box, I did play around with ways of displaying it such in a neat way, but it didn't work out too nicely for me, so I ended up with the select box.

Soren, I like the way you put it in the "dropdown menu" ... It is awesome. look superneat  ;D

I prefer it more than having it listed out straight away coz if there is too many ppls casting the vote than all my poll would look super messy  >:(

corruptor

hxxp:www.theindelible.com/files/phperror.png [nonactive]

not sure why it faile on an else statement...

usvi4me

I did get it to work with the amber theme.  Thank you.

Created a languages directory in the amber theme directory.
Since the default theme was working, i just copied the  modifications.english.php file in the Amber/Languages directory.

The Amber Display.template.php did not have the [Data so i searched for "Show each option with its corresponding percentage bar" and replaced with the text as posted earlier.

Thank you, thank you ....
         
                        
                     

J!ass

Got a problem with the permissions.
I set the permission for "regular users" as I have to, that they can see the voters but nothing appers.

The two Admins can see the voters.

HecKel

Hi!

I like this mod :) But, is any change to enhance this to be more eye candy? For exemple, like VBulletin boards!

Another idea, why not create a new poll type? If the votes were public, so anybody can see who voted what, else, only who can moderate that board can see that! (like VBulletin too)

HecKel
Quote from: Eliana Tamerin on August 23, 2008, 04:10:10 PM
SMF 7 is where it gets good. That has time travel. You can go back and post before the guy who flamed you. :P

Søren Bjerg

I did try various ways of displaying the names of the voters in a pretty manner, but this was what I ended up with eventually.

Might work on it a bit sometime in near/distant future.
RUNE HORDES dot INFO - SMF 1.1.10 w/ Custom Profile Mod... and various permissions hooks and template changes (new topic form).

littleone

I have this installed and gave my moderator membergroup the permissions to see however they cant see who voted what.  So my question is what is the problem?  (I can see them though ;) )

Søren Bjerg

If the permissions are set up properly and you're using the default theme, I have no idea what could be causing it to malfunction for you.
RUNE HORDES dot INFO - SMF 1.1.10 w/ Custom Profile Mod... and various permissions hooks and template changes (new topic form).

littleone

Yup the permission is enabled and I am on default theme

Vinspire

Quote from: littleone on October 28, 2006, 08:28:02 PM
Yup the permission is enabled and I am on default theme

Is your forummers on SMF default theme too ?

littleone

Thats the only theme I have enabled.

MoreBloodWine

Two thumbs up on this one... I integrated it just fine into my custom theme... all works as expected for now...
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


lemur21

Hello,

With 1.1 Final out -- is there an ETA on when the 1.1 compatible version of this mod will be ready?

This is probably my favorite mod, and we use the polls on my board for a ton of research...

Thanks!!

Chris

Advertisement: