Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=2403)
Fix Session Verification for Polls
Written by: Labradoodle-360 (http://www.simplemachines.org/community/index.php?action=profile;u=182638) |
Current version: 1.0 |
Suitable for: SMF 1.1.11 ONLY |
Link to Mod (http://www.simplemachines.org/community) | Donate (https://www.paypal.com/cgi-bin/webscr&cmd=_s-xclick&hosted_button_id=10240245)
SummaryFix Session Verification for Polls fixes a bug in SMF v1.1.11, as the link to remove polls did not have session verification, this mod simply adds session verification to the link fixing the bug which will not let you delete a poll.
Note that after installing this mod you
must log out for the effect to take place. (Before removing a poll)
Edit was originally written by mizuno151 (http://www.simplemachines.org/community/index.php?action=profile;u=238693)
InstallationPackage Manager should work in most cases. If you need to make any edits, the full list can be obtained from the Parse function on the right..
Useful linksManual Installation Of Mods (http://docs.simplemachines.org/index.php?topic=402)
How Do I Modify Files? (http://www.simplemachines.org/community/index.php?topic=24110.0)
SupportQuestions should be address to the mod support topic (http://www.simplemachines.org/community).
UpdatingUpdates will be added here.
Changelog1.0 - 22 January 2010
First release of Fix Session Verification for Polls
Files modified by Fix Session Verification for Polls./Themes/default/Display.template.php
The parse doesn't apply to the theme I'm using (Morestyle)
My code is as follows:
if ($context['can_remove_poll'])
$moderationButtons[] = '<a href="' . $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . '" onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin_remove_poll.gif" alt="' . $txt['poll_remove'] . '" border="0" />' : $txt['poll_remove']) . '</a>';
What do I change?
Thanks a lot.
Lets take a deeper look into the mod.
./Themes/default/Display.template.php
'remove_poll' => array('test' => 'can_remove_poll', 'text' => 'poll_remove', 'image' => 'admin_remove_poll.gif', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');"', 'url' => $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start']),
'remove_poll' => array('test' => 'can_remove_poll', 'text' => 'poll_remove', 'image' => 'admin_remove_poll.gif', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');"', 'url' => $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id']),
Note the change it makes.
Before: | After: |
' . $context['start'] | ' . $context['start'] . ';sesc=' . $context['session_id'] |
As a response to your question, I would appreciate it if you would further more use the code tags for actual code for easier review.
This code *should* work for you
if ($context['can_remove_poll'])
$moderationButtons[] = '<a href="' . $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . '" onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin_remove_poll.gif" alt="' . $txt['poll_remove'] . '" border="0" />' : $txt['poll_remove']) . '</a>';
if ($context['can_remove_poll'])
$moderationButtons[] = '<a href="' . $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' , $context['session_id'], '" onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin_remove_poll.gif" alt="' . $txt['poll_remove'] . '" border="0" />' : $txt['poll_remove']) . '</a>';
Edit: I fixed an issue in the code I posted back.
Hope this helps,
Labradoodle-360
Ah yes, sorry about that, I always forget to use code tags.
Thanks massively for the speed of help.
I'm afraid that hasn't worked. I've tried copying your amends in twice and it brings this up:
http://www.surgicalaplomb.com/index.php?topic=3953.msg457735#new
Any further ideas?
Thanks
Please screenshot it's effect/or lack of effect as I am not an Administrator.
Labradoodle-360
There should be a template parse error appearing here:
http://www.surgicalaplomb.com/index.php?topic=3953.msg457735#new
The area highlighted is:
658: $moderationButtons[] = '<a href="' . $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.surgicalaplomb.com%2Fgallery%2Ferror.jpg&hash=123014599a4d10cc4a241c5d9c45b709407efe94)
That's the issue, I apologize.
I appreciate the screenshot.
Here is the edit to correct the error and hopefully resolve your issue.
if ($context['can_remove_poll'])
$moderationButtons[] = '<a href="' . $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' , $context['session_id'], '" onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin_remove_poll.gif" alt="' . $txt['poll_remove'] . '" border="0" />' : $txt['poll_remove']) . '</a>';
if ($context['can_remove_poll'])
$moderationButtons[] = '<a href="' . $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id']. '" onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin_remove_poll.gif" alt="' . $txt['poll_remove'] . '" border="0" />' : $txt['poll_remove']) . '</a>';
Labradoodle-360
Wonderful, thanks ever so much.
Not a problem, glad you got it :)
Labradoodle-360
NB. Mod only works if using Forum default Theme!!!
Fix..... Login to Admin / Themes and Layout
Overall forum default: SMF Default Theme
Reset everyone to: Forum defalt
SAVE
- go to topic - remove POLL - reset your forum themes - Job Done! :)
Worked perfectly on my default theme, thanks
Now all I need is an auto page refresh so members don't have to keep hitting F5 all the time. I wonder why SMF does not automatically refresh after every post be default? Seems obvious to me . .
Oh, well
Thanks again - wonderful! Polls all gone!
Well, this is Fix Session Verification for Polls mod support topic, not for other SMF related questions. That's what the main support boards are for.
However, take a peak at this mod: http://custom.simplemachines.org/mods/index.php?mod=1492
That should work for you.
Thanks for using my mod =)
I have tried this mod at least 5 times. It is very consistent. Each time it gives:
An Error Has Occurred!
The package you tried to upload either is not a valid package or has become corrupted.
What version of SMF are you running please?
Please attach your Display.template.php
Quote from: S-M-F Modders Team on September 23, 2010, 10:02:45 PM
Please attach your Display.template.php
sorry but there is no point now, as I have modified that file manually as recommended here
http://www.simplemachines.org/community/index.php?topic=356688.msg2795074#msg2795074
that indeed solved my issue immediately.
I'm having this problem in 1.1.13 :S I can't even parse it because the code isn't even there.
./Themes/default/Display.template.php
'remove_poll' => array('test' => 'can_remove_poll', 'text' => 'poll_remove', 'image' => 'admin_remove_poll.gif', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');"', 'url' => $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start']),
'remove_poll' => array('test' => 'can_remove_poll', 'text' => 'poll_remove', 'image' => 'admin_remove_poll.gif', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');"', 'url' => $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id']),
Quote from: shuban on February 16, 2011, 03:14:33 PM
I'm having this problem in 1.1.13 :S I can't even parse it because the code isn't even there.