Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Thema gestartet von: Kirby in November 14, 2004, 12:22:21 VORMITTAG

Titel: Moderation Form instead of images in Topic Display
Beitrag von: Kirby in November 14, 2004, 12:22:21 VORMITTAG
I know there are a few people who don't like the moderation images (ex. Sticky/Lock buttons) in the topic display. I looked at MessageIndex's quick mod form and found a better way to represent those (similar to Invision's mod form). Add this somewhere in your Display.template.php, preferrably in the mod options function.
<form action="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], '" method="post" name="topicForm" style="margin: 0;">
<input type="hidden" name="topics[]" value="', $context['current_topic'] ,'">
<select name="qaction"', $context['can_move'] ? ' onchange="document.topicForm.moveItTo.disabled = (this.options[this.selectedIndex].value != \'move\');"' : '', '>
<option value="" style="font-weight: bold;">Moderation Options</option>
', $context['can_remove'] ? '<option value="remove">Delete Topic</option>' : '', '
', $context['can_lock'] ? '<option value="lock">Lock Topic</option>' : '', '
', $context['can_sticky'] ? '<option value="sticky">Pin Topic</option>' : '', '
', $context['can_move'] ? '<option value="move">Move Topic to: </option>' : '', '
', $context['can_merge'] ? '<option value="merge">Merge Topic</option>' : '', '
</select>';
if ($context['can_move'])
{
echo '
<select id="moveItTo" name="move_to" disabled="disabled">';
foreach ($context['jump_to'] as $category)
foreach ($category['boards'] as $board)
{
if (!$board['is_current'])
echo '
<option value="', $board['id'], '"', !empty($board['selected']) ? ' selected="selected"' : '', '>', str_repeat('-', $board['child_level'] + 1), ' ', $board['name'], '</option>';
}
echo '
</select>';
}
echo '
        <input type="submit" class="forminput" value="', $txt['quick_mod_go'], '">
<input type="hidden" name="sc" value="' . $context['session_id'] . '" />
</form>';


Example:

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.lod-squared.net%2Fkirbu%2FUntitled-1.gif&hash=acb1ab0108ddb3f74826494bb954948d1978cfa8)
(No that is not Invision, it is SMF... I just made an Invision skin for a forum that requested it)
Titel: Re: Moderation Form instead of images in Topic Display
Beitrag von: A.M.A in November 14, 2004, 06:18:11 VORMITTAG
Nice tip .. here how I did it, add the code above in Display.template.php after
function theme_show_mod_buttons()
{
global $context, $settings, $options, $txt, $scripturl, $modSettings;

put ( echo ' ) as the first line to the code above .. and finally delete it this:
$moderationButtons = array();

if ($context['can_move'])
$moderationButtons[] = '<a href="' . $scripturl . '?action=movetopic;topic=' . $context['current_topic'] . '.0">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin_move.gif" alt="' . $txt[132] . '" border="0" />' : $txt[132]) . '</a>';
if ($context['can_delete'])
$moderationButtons[] = '<a href="' . $scripturl . '?action=removetopic2;topic=' . $context['current_topic'] . '.0;sesc=' . $context['session_id'] . '" onclick="return confirm(\'' . $txt[162] . '\');">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin_rem.gif" alt="' . $txt[63] . '" border="0" />' : $txt[63]) . '</a>';
if ($context['can_lock'])
$moderationButtons[] = '<a href="' . $scripturl . '?action=lock;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin_lock.gif" alt="' . (empty($context['is_locked']) ? $txt['smf279'] : $txt['smf280']) . '" border="0" />' : (empty($context['is_locked']) ? $txt['smf279'] : $txt['smf280'])) . '</a>';
if ($context['can_sticky'])
$moderationButtons[] = '<a href="' . $scripturl . '?action=sticky;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin_sticky.gif" alt="' . (empty($context['is_sticky']) ? $txt['smf277'] : $txt['smf278']) . '" border="0" />' : (empty($context['is_sticky']) ? $txt['smf277'] : $txt['smf278'])) . '</a>';
if ($context['can_merge'])
$moderationButtons[] = '<a href="' . $scripturl . '?action=mergetopics;board=' . $context['current_board'] . '.0;from=' . $context['current_topic'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/merge.gif" alt="' . $txt['smf252'] . '" border="0" />' : $txt['smf252']) . '</a>';
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['calendar_post'])
$moderationButtons[] = '<a href="' . $scripturl . '?action=post;calendar;msg=' . $context['topic_first_message'] . ';topic=' . $context['current_topic'] . '.0;sesc=' . $context['session_id'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/linktocal.gif" alt="' . $txt['calendar37'] . '" border="0" />' : $txt['calendar37']) . '</a>';

if ($context['can_remove_post'] && !empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1)
$moderationButtons[] = $settings['use_image_buttons'] ? '<input type="image" name="submit" src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/delete_selected.gif" alt="' . $txt['quickmod_delete_selected'] . '" onclick="return confirm(\'' . $txt['quickmod_confirm'] . '\');" />' : '<a href="javascript:document.quickModForm.submit();" onclick="return confirm(\'' . $txt['quickmod_confirm'] . '\');">' . $txt['quickmod_delete_selected'] . '</a>';

return implode($context['menu_separator'], $moderationButtons);
Titel: Re: Moderation Form instead of images in Topic Display
Beitrag von: Kirby in November 14, 2004, 01:55:24 NACHMITTAGS
Thats actually how I did it too :P
ZitatAdd this somewhere in your Display.template.php, preferrably in the mod options function.
Thanks ^_^
Titel: Re: Moderation Form instead of images in Topic Display
Beitrag von: codenaught in November 14, 2004, 02:16:00 NACHMITTAGS
Nice change! I just am having problems with the move topic to: box. When I select that the box is not enabled, thus not letting me to click on it. Are you sure there is nothing wrong with that part of it?
Titel: Re: Moderation Form instead of images in Topic Display
Beitrag von: Kirby in November 14, 2004, 02:47:07 NACHMITTAGS
Thats odd... be sure to copy every bit of the code. I'm pretty sure the JavaScript is in there...
Titel: Re: Moderation Form instead of images in Topic Display
Beitrag von: suren in Januar 17, 2005, 08:40:31 VORMITTAG
Zitat von: akabugeyes in November 14, 2004, 02:16:00 NACHMITTAGS
Nice change! I just am having problems with the move topic to: box. When I select that the box is not enabled, thus not letting me to click on it. Are you sure there is nothing wrong with that part of it?

i'm getting the same error & also javascript error
Titel: Re: Moderation Form instead of images in Topic Display
Beitrag von: Kirby in Januar 17, 2005, 01:38:12 NACHMITTAGS
Oops... replace document.topicForm.moveItTo with document.getElementById("moveItTo")
Titel: Re: Moderation Form instead of images in Topic Display
Beitrag von: mytreo in Januar 17, 2005, 05:30:32 NACHMITTAGS
How does one remove a poll or post the topic to calendar with this mod?

Thanks

Chris
Titel: Re: Moderation Form instead of images in Topic Display
Beitrag von: Kirby in Januar 17, 2005, 05:35:08 NACHMITTAGS
It isn't in there yet, but my enhanced default theme has it (its a complete redo of what I posted).
Titel: Re: Moderation Form instead of images in Topic Display
Beitrag von: mytreo in Januar 17, 2005, 05:50:47 NACHMITTAGS
Ooh sounds good, so where is your enhanced default theme? :)
Titel: Re: Moderation Form instead of images in Topic Display
Beitrag von: Nidoking in Januar 18, 2005, 12:11:43 VORMITTAG
Zitat von: mytreo in Januar 17, 2005, 05:50:47 NACHMITTAGS
Ooh sounds good, so where is your enhanced default theme? :)
Probably under construction.
Titel: Re: Moderation Form instead of images in Topic Display
Beitrag von: Kirby in Januar 18, 2005, 09:21:15 VORMITTAG
yeah, its under heavy construction and will have a whole bunch of old yabb se mods in it...
Titel: Re: Moderation Form instead of images in Topic Display
Beitrag von: helenbpd in Januar 21, 2005, 07:16:22 VORMITTAG
Kirby,

This is a fabulous mod.  One question, though - is there a way to hide the menu from anyone who can't use it (i.e., members & guests)?  I installed it, and when I log out and read as a guest, the dropdown is still there, albeit just with the option "moderation options", but the go! button is still there and clickable.  (Selecting it simply takes you back to the index.)

How to hide it to spare confusion to guests & members?  (Or did I install it incorrectly somehow?)

Thanks!
Titel: Re: Moderation Form instead of images in Topic Display
Beitrag von: helenbpd in Januar 21, 2005, 12:49:52 NACHMITTAGS
Fiddling with this a little more.

On my board (still RC2, based on default template), the

$context['can_remove']
had to be changed to
$context['can_delete']

Also, the Merge option doesn't work for me, either, & I'm not sure what to change.  It just returns me to the messages index with no intermediate page asking what to merge where.

Also, there doesn't seem to be a confirmation page built in, as there was with the buttons.  ("Do you really want to remove/sticky/etc this topic?") 

(I wish I knew PHP code or I'd just make these changes myself, sorry to bug you!  I don't want to totally mess things up by fiddling too much.)


Titel: Re: Moderation Form instead of images in Topic Display
Beitrag von: Kirby in Januar 21, 2005, 01:55:49 NACHMITTAGS
I'll get back to you on this... I really have improved over this one in my IPB theme/default "enhanced" theme and I'll put up the code soon.
Titel: Re: Moderation Form instead of images in Topic Display
Beitrag von: helenbpd in Januar 22, 2005, 10:06:26 VORMITTAG
Thanks Kirby!  I'll keep an eye out, it's a great mod idea.
Titel: Re: Moderation Form instead of images in Topic Display
Beitrag von: Midgard in Februar 13, 2005, 11:07:52 VORMITTAG
I need this script for ordering/sorting

-For memberslist
-For message index
Titel: Re: Moderation Form instead of images in Topic Display
Beitrag von: rojamaia in August 27, 2005, 11:53:17 VORMITTAG


hi everyone!

is there an update on this?  this looks like a good mod
Titel: Re: Moderation Form instead of images in Topic Display
Beitrag von: Kirby in August 28, 2005, 12:19:27 VORMITTAG
This should still work.
Titel: Re: Moderation Form instead of images in Topic Display
Beitrag von: Eleglin in Juli 29, 2007, 08:49:06 VORMITTAG
Where are the options for calendar post or remove polls ?!
It's not compatible with SMF 1.1 (or it doesn't work with my theme : it appears, but the options don't work) ...
Can someone enhance it for SMF 1.1.x, please ? It should be fine.
Titel: Re: Moderation Form instead of images in Topic Display
Beitrag von: SilverKnight in Januar 03, 2009, 06:48:07 NACHMITTAGS
Is there a updated version of this? i want this, but im not sure of it by Eleglin's comment, and it's in the tips and tricks list....