Customizing SMF > Modifications and Packages

Who Voted What?

<< < (93/94) > >>

Illori:
find


--- Code: (display.template.php) ---echo '' . $option['bar'] . ' ' . $option['votes'] . ' (' . $option['percent'] . '%)<br />';
--- End code ---

--- Code: (replace) ---echo '' . $option['bar_ndt'] . ' ' . $option['votes'] . ' (' . $option['percent'] . '%)<br />';
--- End code ---

Acer1:
This Mod for SMF 2.0.1 ????

H-J Kaabii:
I was wondering (using relevant modifications to code to optimise for 2.0 Gold upwards) how I could incorporate the code from Display.template.php into the theme I'm using, Bright Forest. The theme's Display.template.php for some reason does not include
--- Code: --- if ($context['allow_poll_view'])
echo '
', $option['bar_ndt'], '
<span class="percentage">', $option['votes'], ' (', $option['percent'], '%)</span>';
--- End code ---
but I'm unsure if this is because the theme calls up the default theme's code or for some other reason.

Sapozhnik:

--- Quote from: rbeuker on February 23, 2011, 03:15:52 PM ---I have got it working on a patched RC4 version--I'm not sure if it'd also work on RC5.

USE AT YOUR OWN RISK!!

Check the contents of the modification.xml file and find the section that changes the Display.template.php file.
Below's the code I've used:


--- Code: ---  <file name="$themedir/Display.template.php">
    <operation>
      <search position="replace"><![CDATA[ // Show each option with its corresponding percentage bar.
foreach ($context['poll']['options'] as $option)
{
echo '
<dt class="middletext', $option['voted_this'] ? ' voted' : '', '">', $option['option'], '</dt>
<dd class="middletext statsbar', $option['voted_this'] ? ' voted' : '', '">';

if ($context['allow_poll_view'])
echo '
', $option['bar_ndt'], '
<span class="percentage">', $option['votes'], ' (', $option['percent'], '%)</span>';

echo '
</dd>';
}

]]></search>
      <add><![CDATA[ // Show each option with its corresponding percentage bar.
foreach ($context['poll']['options'] as $option)
{
if (!allowedTo('poll_view_voters') || $modSettings['whovotedwhatMode'] == 'disabled')
{
echo '
<dt class="middletext', $option['voted_this'] ? ' voted' : '', '">', $option['option'], '</dt>
<dd class="middletext statsbar', $option['voted_this'] ? ' voted' : '', '">';

if ($context['allow_poll_view'])
echo '
', $option['bar_ndt'], '
<span class="percentage">', $option['votes'], ' (', $option['percent'], '%)</span>';

echo '
</dd>';
}
else
{
switch ($modSettings['whovotedwhatMode'])
{
case 'select':
echo '
<dt class="middletext', $option['voted_this'] ? ' voted' : '', '">', $option['option'], '</dt>
<dd class="middletext statsbar">';
if ($context['allow_poll_view'])
{
echo '' . $option['bar'] . ' ' . $option['votes'] . ' (' . $option['percent'] . '%)' . ' ' . '<select id="jumpto" name="voters' . $option['ID_OPTION'] . '" 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 selected="selected" value="">----------------------</option>';
              }
              echo '
                  </select>';
}
else
{
echo '';
}
echo '</dd>';
break;
case 'table':
echo '
<dt class="middletext', $option['voted_this'] ? ' voted' : '', '">', $option['option'], '</dt>
<dd class="middletext statsbar">';
if ($context['allow_poll_view'])
{
echo '' . $option['bar'] . ' ' . $option['votes'] . ' (' . $option['percent'] . '%)<br />';
if (!empty($context['poll']['options'][$option['ID_OPTION']]['voters']))
              {
                foreach ($context['poll']['options'][$option['ID_OPTION']]['voters'] as $voter)
                {
                  echo '<small><a href="?action=profile;u=' . $voter['ID_MEMBER'] . '">', $voter['realName'], '</a></small> ';
                }
              }
}
else
{
echo '';
}
echo '</dd>';
break;
}
}
}
 
]]></add>
    </operation>
  </file>

--- End code ---

In the package-info.xml file you can change "RC2" to your Forum version (RC3, RC4 or RC5).

I have not changed the wvwDB.php file.

Put all 3 files into a zip file and try installing it using the package manager.

Good luck! :)

--- End quote ---

Thanks a lot.
Package for SMF 2.0.2 is attached
 
Important!!!
     Activate: Features and options -> "Who Voted What? mode"
      Permission: Set permission for users group

Illori:
this mod does not have a license so you are not allowed to update it without permission from the author. so your attachment has been removed.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version