Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: AlenNS on July 23, 2008, 10:28:38 AM

Title: Locked topic - no reply
Post by: AlenNS on July 23, 2008, 10:28:38 AM
When I lock some topic and check on test account there is quick reply box with warning that topic is locked and only admins and mods can answer ( No.1 on picture ) and text box ( No.2 on piture ).

I want to remove that box when topic is locked and leave only warning that topic is locked.
Title: Re: Locked topic - no reply
Post by: Bulakbol on July 24, 2008, 02:26:17 AM
Disable quick reply. :) Or edit your Display.template.php and look for
if ($context['can_reply'] && !empty($options['display_quick_reply']))
Code (replace) Select
if (($context['can_reply'] && !empty($options['display_quick_reply'])) && !$context['is_locked'])
Title: Re: Locked topic - no reply
Post by: AlenNS on July 24, 2008, 07:24:38 AM
Didn't helped. :(
Title: Re: Locked topic - no reply
Post by: greyknight17 on July 26, 2008, 12:31:24 PM
Did you edit the Display.template.php file for your own custom theme (it probably has one)?
Title: Re: Locked topic - no reply
Post by: AlenNS on July 26, 2008, 12:58:32 PM
I didn't changed both of these lines.

if ($context['can_reply'] && !empty($options['display_quick_reply']))

When I changed, the quick reply box disappeared but there is no warning that topic is locked.

I'm using Babylon theme.
Title: Re: Locked topic - no reply
Post by: AlenNS on July 28, 2008, 07:40:11 PM
Bump.
Title: Re: Locked topic - no reply
Post by: ccbtimewiz on July 28, 2008, 08:10:09 PM
Do you want the entire box gone?
Title: Re: Locked topic - no reply
Post by: AlenNS on July 28, 2008, 08:20:10 PM
With the code that JohnyB gave me entire box disappeared. But what I want is to have a box with warning that topic is locked.

At place of quick reply but just to be simple divider nothing special.
Title: Re: Locked topic - no reply
Post by: ccbtimewiz on July 28, 2008, 08:27:33 PM
Sounds simple enough.

Add after the quick box:

if( $context['is_locked'] ) { echo '<div class="windowbg2">This topic is currently locked!</div>'; }
Title: Re: Locked topic - no reply
Post by: AlenNS on July 28, 2008, 08:41:58 PM
That's it. I was putting that code on wrong place, inside the quick reply box.
Can this part of code make some problems if it isn't removed?

Quote<td class="windowbg" width="25%" valign="top">', $txt['quick_reply_desc'], $context['is_locked'] ? '<br /><br /><b><font color="ffffcc">' . $txt['quick_reply_warning'] . '</font></b>' : '', '</td>

if (($context['can_reply'] && !empty($options['display_quick_reply'])) && !$context['is_locked'])
{
echo '
<a name="quickreply"></a>
<table border="0" cellspacing="1" cellpadding="3" class="bordercolor" width="100%" style="clear: both;">
<tr>
<td colspan="2" class="catbg"><a href="javascript:oQuickReply.swap();"><img src="', $settings['images_url'], '/', $options['display_quick_reply'] == 2 ? 'collapse' : 'expand', '.gif" alt="+" border="0" id="quickReplyExpand" /></a> <a href="javascript:oQuickReply.swap();">', $txt['quick_reply'], '</a></td>
</tr>
<tr id="quickReplyOptions"', $options['display_quick_reply'] == 2 ? '' : ' style="display: none"', '>
<td class="windowbg" width="25%" valign="top">', $txt['quick_reply_desc'], $context['is_locked'] ? '<br /><br /><b><font color="ffffcc">' . $txt['quick_reply_warning'] . '</font></b>' : '', '</td>
<td class="windowbg" width="90%" align="center">
<form action="', $scripturl, '?action=post2" method="post" accept-charset="', $context['character_set'], '" name="postmodify" id="postmodify" onsubmit="submitonce(this);" style="margin: 0;">
<input type="hidden" name="topic" value="', $context['current_topic'], '" />
<input type="hidden" name="subject" value="', $context['response_prefix'], $context['subject'], '" />
<input type="hidden" name="icon" value="xx" />
<input type="hidden" name="notify" value="', $context['is_marked_notify'] || !empty($options['auto_notify']) ? '1' : '0', '" />
<input type="hidden" name="goback" value="', empty($options['return_to_post']) ? '0' : '1', '" />
<input type="hidden" name="num_replies" value="', $context['num_replies'], '" />';

// Start of WYSIWYG Quick Reply
echo '<table border="0" cellpadding="3" width="100%">
<tr class="windowbg">
<td valign="top" align="center">';

// Only show bbcode bar if BBCodes are enabled, AND if its a quick reply mode with bbcode bar
if ($context['show_bbc'] && (in_array($options['wysiwyg_quick_reply'], array(0, 1, 4, 5))))
echo template_control_richedit($context['post_box_name'], 'bbc').'<br />';

// Only show smilies if smiliesare enabled AND if its a quick reply mode with smilies
if (!empty($context['smileys']['postform']) && (in_array($options['wysiwyg_quick_reply'], array(0, 2, 4, 6))))
echo template_control_richedit($context['post_box_name'], 'smileys').'<br />';

// Show the quick reply (WYSIWYG vs NON-WYSIWYG dealt with already decided in source file)
echo template_control_richedit($context['post_box_name'], 'message'), '
</td>
</tr>
</table>';
// End of WYSIWYG Quick Reply

echo '
<input type="submit" name="post" value="', $txt['post'], '" onclick="return submitThisOnce(this);" accesskey="s" tabindex="2" />
<input type="submit" name="preview" value="', $txt['preview'], '" onclick="return submitThisOnce(this);" accesskey="p" tabindex="4" />';
if ($context['show_spellchecking'])
echo '
<input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'postmodify\', \'message\');" />';
echo '
<input type="hidden" name="sc" value="', $context['session_id'], '" />
<input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />
</form>
</td>
</tr>
</table>';
}
//Topic is locked?
if( $context['is_locked'] ) { echo '<div class="windowbg2">This topic is currently locked!</div>'; }
Title: Re: Locked topic - no reply
Post by: ccbtimewiz on July 28, 2008, 08:45:53 PM
It shouldn't matter. Does my code work for you?
Title: Re: Locked topic - no reply
Post by: AlenNS on July 28, 2008, 08:48:17 PM
Excellent! Thanks a lot!

Is it possible to make admin lock for this?
Or this needs a lot more work?
Title: Re: Locked topic - no reply
Post by: ccbtimewiz on July 28, 2008, 08:49:03 PM
Depends. How do I define the admin lock?
Title: Re: Locked topic - no reply
Post by: AlenNS on July 28, 2008, 08:56:46 PM
Well, I've looked this mod you gave me a link so maybe something like that.

P.S. How can I add this ( $txt['quick_reply_warning'] ) here ( if( $context['is_locked'] ) { echo '<div class="windowbg2" align="center">This topic is currently locked!</div>'; } )

When I try, I am getting template parse error.
Title: Re: Locked topic - no reply
Post by: ccbtimewiz on July 28, 2008, 09:08:45 PM
if( $context['is_locked'] ) { echo '<div class="windowbg2" align="center">', $txt['quick_reply_warning'] ,'</div>'; }
Title: Re: Locked topic - no reply
Post by: AlenNS on July 28, 2008, 09:17:50 PM
I've putted the same code, but I've got an error.
Both of us forgot } on the end of the code. :)

Thanks for everything! :)

Now it's great!
Title: Re: Locked topic - no reply
Post by: ccbtimewiz on July 28, 2008, 09:18:52 PM
Anytime.  :)