News:

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

Main Menu

Locked topic - no reply

Started by AlenNS, July 23, 2008, 10:28:38 AM

Previous topic - Next topic

AlenNS

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.

Bulakbol

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'])
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

AlenNS


greyknight17

Did you edit the Display.template.php file for your own custom theme (it probably has one)?

AlenNS

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.

AlenNS


ccbtimewiz

Do you want the entire box gone?

AlenNS

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.

ccbtimewiz

Sounds simple enough.

Add after the quick box:

if( $context['is_locked'] ) { echo '<div class="windowbg2">This topic is currently locked!</div>'; }

AlenNS

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'] == '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'] == '' ' 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(0145))))
	
	
	
	
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(0246))))
	
	
	
	
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>'; }

ccbtimewiz

It shouldn't matter. Does my code work for you?

AlenNS

Excellent! Thanks a lot!

Is it possible to make admin lock for this?
Or this needs a lot more work?

ccbtimewiz

Depends. How do I define the admin lock?

AlenNS

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.

ccbtimewiz

#14
if( $context['is_locked'] ) { echo '<div class="windowbg2" align="center">'$txt['quick_reply_warning'] ,'</div>'; }

AlenNS

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!

ccbtimewiz


Advertisement: