https://www.icyphoenix.com/viewtopic.php?f=28&t=1533&p=11381#p11381 ----------------------------------- Zuker Thu 05 Apr, 2007 16:45 BBCode Hide Message With An Image Buttom ----------------------------------- This is a simple method to have a bbcode Hide message with an image (with the message that says that you must post a reply to view the hidden message). This image will be shown to explain that there is a hidden message: [url=http://img129.imageshack.us/img129/6480/hideyesut3.gif]Example [b]Rename this image as hide_yes.gif and upload to: [color=blue]/images/bbcb_mg/images/[/color][/b] And this image will be shown when users are able to see the hidden message: [url=http://img129.imageshack.us/img129/7103/hidenokt2.gif]Example [b]Rename this image as hide_no.gif and upload to: [color=blue]/images/bbcb_mg/images/[/color][/b] [color=darkgreen][b]Example Images of this hack[/b][/color]: [url=http://img139.imageshack.us/img139/1923/exhiddenhx3.gif]When the message is hidden / [url=http://img129.imageshack.us/img129/5059/exnothiddenim8.gif]When the message is not hidden In [b][color=blue]/includes/bbcode.php[/color][/b] [b]FIND[/b]: [code linenumbers=false] // generate html $html = '
' . $lang['xs_bbc_hide_message'] . ':
'; if(!$show) { return array( 'valid' => true, 'html' => $html . $lang['xs_bbc_hide_message_explain'] . '
', 'allow_nested' => false, ); } else { return array( 'valid' => true, 'start' => $html, 'end' => '' ); }[/code] [b]REPLACE WITH[/b] [code linenumbers=false] // generate html $html = '
' . $lang['xs_bbc_hide_message'] . ':
'; if(!$show) { return array( 'valid' => true, 'html' => $html . '

' . $lang['xs_bbc_hide_message_explain'] . '
', 'allow_nested' => false, ); } else { return array( 'valid' => true, 'start' => $$html . '

', 'end' => '' ); }[/code] With this changes, we have an image with the text of BBcode Hide explain. [hr]But, the BBcode Hide doesn't have a bbcode button on posting.php (on reply). With this changes, you can add this button. [color=darkgreen][b]Example Image of the button[/b][/color]: [url=http://img458.imageshack.us/img458/1566/hidebuttonly5.jpg]Image of the button pressed Follow this instructions: Upload to [b][color=blue]/images/bbcb_mg/images/gif[/color][/b] this images: [img]http://img106.imageshack.us/img106/4094/hide7aq.gif[/img] = (rename this to [i]hide.gif[/i]) [img]http://img106.imageshack.us/img106/6684/hide13lp.gif[/img] = (rename this to [i]hide1.gif[/i]) In [b][color=blue]/languages/lang_xxx/lang_bbcb_mg.php[/color][/b] [b]FIND[/b]: [code linenumbers=false]$lang['bbcb_mg_highlight'] = 'Highlight';[/code] [b]AFTER, ADD[/b] [code linenumbers=false]$lang['bbcb_mg_hide'] = 'Hide a message';[/code] [b]FIND[/b]: [code linenumbers=false]$lang['s_highlight_help'] = [/code] [b]AFTER, ADD[/b] [code linenumbers=false]$lang['s_hide_help'] = 'Hide a text, registered users must reply or thanks topic to view the hidden message: Hidden Message: Sorry, but you must be registered and also post a reply to view this message. ';[/code] In [b][color=blue]/includes/bbcb_mg.php[/color][/b] [b]FIND[/b]: [code linenumbers=false] 'L_BBCB_MG_HIGHLIGHT' => $lang['bbcb_mg_highlight'],[/code] [b]AFTER, ADD[/b] [code linenumbers=false] 'L_BBCB_MG_HIDE' => $lang['bbcb_mg_hide'],[/code] [b]FIND[/b]: [code linenumbers=false] 'L_HIGHLIGHT_HELP' => $lang['s_highlight_help'],[/code] [b]AFTER, ADD[/b] [code linenumbers=false] 'L_HIDE_HELP' => $lang['s_hide_help'],[/code] In [b][color=blue]/languages/lang_xxx/bbcb_mg.js[/color][/b] [b]FIND[/b]: [code linenumbers=false]s_smiley_creator = 'Smiley Creator: [smiley=1]Text[/smiley] insert a smiley with text';[/code] [b]AFTER, ADD[/b] [code linenumbers=false]s_hide_help = 'Hide a text, registered users must reply or thanks topic to view the hidden message: Hidden Message: Sorry, but you must be registered and also post a reply to view this message. ';[/code] [b]FIND[/b]: [code linenumbers=false]var Td = 0;[/code] [b]AFTER ADD[/b]: [code linenumbers=false]var Hide = 0;[/code] [b]FIND[/b]: [code linenumbers=false]'[highlight=]'[/code] [b]AFTER ADD[/b] [code linenumbers=false]'Hidden Message: Sorry, but you must be registered and also post a reply to view this message. ',[/code] [b]FIND[/b]: [code linenumbers=false]function BBCbold()[/code] [b]BEFORE ADD[/b]: [code linenumbers=false]function BBChide() { var txtarea = document.post.message; if ((clientVer >= 4) && is_ie && is_win) { theSelection = document.selection.createRange().text; if (theSelection != '') { document.selection.createRange().text = "Hidden Message: Sorry, but you must be registered and also post a reply to view this message. "; document.post.message.focus(); return; } } else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0)) { //mozWrap(txtarea, "Hidden Message: Sorry, but you must be registered and also post a reply to view this message. "); mozInsert(txtarea, "Hidden Message: Sorry, but you must be registered and also post a reply to view this message. "); return; } if (Hide == 0) { ToAdd = "[hide]"; document.post.hide_img.src = bbcb_mg_img_path + "hide1" + bbcb_mg_img_ext; Hide = 1; } else { ToAdd = "[/hide]"; document.post.hide_img.src = bbcb_mg_img_path + "hide" + bbcb_mg_img_ext; Hide = 0; } PostWrite(ToAdd); }[/code] In [b][color=blue]/templates/mg_themes/bbcb_mg.tpl[/color][/b] [b]FIND[/b]: [code linenumbers=false] {L_BBCB_MG_HIGHLIGHT}[/code] [b]AFTER ADD[/b]: [code linenumbers=false] {L_BBCB_MG_HIDE}[/code] Now, with this changes, we have a new button to use the bbcode hide in the posting page