Customizing SMF > Now Available

Hide the content of [code] tags from guests

(1/5) > >>

Jokerâ„¢:
I was personally having the problem on my forum that people were posting links in code tag which was visible to guests, so as to overcome this problem we can now hide the whole data in code tag from guests.

To do so, you just have to make following edits;

In Themes\Default\Languages\Modification.english.php

Find:

--- Code: ---?>
--- End code ---

Add Before:

--- Code: ---$txt['something'] = 'Only registered users can see contents.';
$txt['blabla'] = 'Please click here to <a target="_blank" href="' . $scripturl . '?action=register"">Register</a> or <a target="_blank" href="' . $scripturl . '?action=login">Login</a>';
--- End code ---


In Sources/Subs.php

Find:
--- Code: --- 'tag' => 'code',
'type' => 'unparsed_content',
'content' => '<div class="codeheader">' . $txt['code'] . ': <a href="javascript:void(0);" onclick="return smfSelectText(this);" class="codeoperation">' . $txt['code_select'] . '</a></div><code class="bbc_code">$1</code>',
--- End code ---

Replace it with:

--- Code: --- 'tag' => 'code',
'type' => 'unparsed_content',
'content' => $user_info['is_guest'] ? '<div class="codeheader">' . $txt['code'] . ': </div><code class="bbc_code">' . $txt['something'] . ' ' . $txt['blabla'] . '</code>' :  '<div class="codeheader">' . $txt['code'] . ': <a href="javascript:void(0);" onclick="return smfSelectText(this);" class="codeoperation">' . $txt['code_select'] . '</a></div><code class="bbc_code">$1</code>',
--- End code ---


You can change text strings as you like.


This trick is available as mod also, here.

Illori:
this might be better on the tips board. it is a nice idea for some forums.

tesser:
arantor had a mod that works for RC3 but it also works on RC4  that did the  hide code  from guests  ;D lucky me i have it now his site is gone.

Jokerâ„¢:

--- Quote from: tesser on January 09, 2011, 01:07:43 PM ---arantor had a mod that works for RC3 but it also works on RC4  that did the  hide code  from guests  ;D lucky me i have it now his site is gone.

--- End quote ---
I must have missed that mod.


For working demo of code above you can open any non-sticky post from this board.

Illori:
might be slightly more professional to add a space in the code replacement

--- Code: ---Only registered users can see contents.Please click here to Register or Login
--- End code ---
and replace with

--- Code: ---Only registered users can see this content. Please click here to Register or Login.
--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version