News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Modify button for messages in topic search results

Started by GL700Wing, October 06, 2017, 01:55:28 AM

Previous topic - Next topic

GL700Wing

As an Admin I sometimes need to modify multiple messages in a single topic and while I can find the relevant messages using the search function I cannot modify them directly as the only button options available in each message are Reply, Quote and Notify.

Adding the Modify button to each displayed message only requires two minor code changes:

In ./Sources/Search.php
Find:
'can_mark_notify' => in_array($message['id_board'], $boards_can['mark_any_notify']) || in_array(0, $boards_can['mark_any_notify']) && !$context['user']['is_guest'],

Add After:
// Added 'can_modify' for use in search results.
'can_modify' => (!empty($message['is_locked']) || allowedTo('moderate_board')) && (allowedTo('modify_any') || (allowedTo('modify_replies') && $context['user']['started']) || (allowedTo('modify_own') && $message['id_member'] == $user_info['id'] && (empty($modSettings['edit_disable_time']) || !$message['approved'] || $message['poster_time'] + $modSettings['edit_disable_time'] * 60 > time()))),


In ./Themes/default/Search.template.php
Find:
if ($topic['can_reply'] || $topic['can_mark_notify'])
echo '
<div class="quickbuttons_wrap">
<ul class="reset smalltext quickbuttons">';



Add After:
// Added 'can_modify' to search results options.
// If they *can* modify?
if ($topic['can_modify'])
echo '
<li class="modify_button"><a href="', $scripturl, '?action=post;topic=', $topic['id'], ';msg=', $message['id'], '">', $txt['modify'], '</a></li>';

Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Advertisement: