http://www.icyphoenix.com/viewtopic.php?f=28&t=6657
-----------------------------------
TuningBEB2008
Thu 05 Nov, 2009 07:55

[MOD IPv1.3.0.*] BBCode Hide Message With An Image Buttom
-----------------------------------
#--------[ BEGIN MODIFICATION ]-------# 

MOD adapted for IP 1.3 by TuningBEB2008 from a mod by Zuker for IP 1.2 [ [url=http://www.icyphoenix.com/viewtopic.php?f=28&t=1533]view post ]

Description:
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

[b]OPEN:[/b]
[b][color=blue]includes/bbcode.php[/color][/b]

[b]FIND:[/b]
[code linenumbers=false]			// generate html
			$html = '<blockquote class="quote"><div class="quote-nouser">' . $lang['xs_bbc_hide_message'] . ':</div><div class="post-text post-text-hide-flow">';
			if(!$show)
			{
				return array(
					'valid' => true,
					'html' => $html . $lang['xs_bbc_hide_message_explain'] . '</div></blockquote>',
					'allow_nested' => false,
				);
			}
			else
			{
				return array(
					'valid' => true,
					'start' => $html,
					'end' => '</div></blockquote>'
				);
			}[/code]

[b]REPLACE WITH:[/b]
[code linenumbers=false]			// generate html
			$html = '<blockquote class="quote"><div class="quote-nouser">' . $lang['xs_bbc_hide_message'] . ':</div><div class="post-text">';
			if(!$show)
			{
				return array(
					'valid' => true,
					'html' => $html . '<center><img src="images/bbcb_mg/images/hide_yes.gif" border="0"/></center><br />' . $lang['xs_bbc_hide_message_explain'] . '</div></blockquote>',
					'allow_nested' => false,
				);
			}
			else
			{
				return array(
					'valid' => true,
					'start' => $$html . '<center><img src="images/bbcb_mg/images/hide_no.gif" border="0"/></center><br />',
					'end' => '</div></blockquote>'
				);
			}[/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://img39.imageshack.us/img39/6564/testhidden.png]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])

[b]OPEN:[/b]
[b][color=blue]languages/lang_english/lang_bbcb_mg.php[/color][/b]

[b]FIND:[/b]
[code linenumbers=false]	'bbcb_mg_highlight' => 'Highlight',[/code]

[b]AFTER, ADD:[/b]
[code linenumbers=false]   'bbcb_mg_hide' => 'Hide a message',[/code]

[b]FIND:[/b]
[code linenumbers=false]$js_lang['s_highlight_help'] = 'Highlight: [highlight=#FFFFAA]text[/highlight]';[/code]

[b]AFTER, ADD:[/b] 
[code linenumbers=false]$js_lang['s_hide_help'] = '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]$js_lang['s_smiley_creator'] = 'Smiley Creator: [smiley=1]Text[/smiley] insert a smiley with text';[/code]

[b]AFTER, ADD:[/b]
[code linenumbers=false]$js_lang['s_hide_help'] = '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]OPEN:[/b]
[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]

[b]OPEN:[/b]
[b][color=blue]templates/common/js/bbcb_mg.js[/color][/b]

[b]FIND:[/b]
[code linenumbers=false]var Td = 0;[/code]

[b]AFTER ADD:[/b]
[code linenumbers=false]var Hide = 0;[/code]

[b]FIND:[/b]
[spoiler]'[highlight=]','[/highlight]',[/spoiler]

[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 BBChl()
{
	var txtarea = document.forms[form_name].elements[text_name];

	if ((clientVer >= 4) && is_ie && is_win)
	{
		theSelection = document.selection.createRange().text;
		if (theSelection != '')
		{
			document.selection.createRange().text = "[highlight=#FFFFAA]" + theSelection + "[/highlight]";
			document.forms[form_name].elements[text_name].focus();
			return;
		}
	}
	else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
	{
		mozInsert(txtarea, "[highlight=#FFFFAA]", "[/highlight]");
		return;
	}
	ToAdd = "[highlight=#FFFFAA]"+" " + "[/highlight]";
	PostWrite(ToAdd);
}[/code]

[b]AFTER, 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]

[b]OPEN:[/b]
[b][color=blue]templates/default/bbcb_mg.tpl[/color][/b]

[b]FIND:[/b]
[code linenumbers=false]					<a href="javascript:BBChl()" ><img src="{BBCB_MG_IMG_PATH}highlight{BBCB_MG_IMG_EXT}" name="highlight" onmouseover="helpline('highlight')" alt="{L_BBCB_MG_HIGHLIGHT}" title="{L_BBCB_MG_HIGHLIGHT}" class="bbimages" /></a>[/code]

[b]AFTER ADD:[/b]
[code linenumbers=false]					<a href="javascript:BBChide()"><img src="{BBCB_MG_IMG_PATH}hide{BBCB_MG_IMG_EXT}" name="hide_img" onMouseOver="helpline('hide')" alt="{L_BBCB_MG_HIDE}" title="{L_BBCB_MG_HIDE}" class="bbimages" /></a>[/code]

Now, with this changes, we have a new button to use the bbcode hide in the posting page

DEMO: [url=http://testicyforummods.site11.com/viewtopic.php?f=1&t=7]http://testicyforummods.site11.com/viewtopic.php?f=1&t=7

[color=red][b]Before adding this MOD to your Icy Phoenix, you should Backup all files related to this MOD.[/b][/color]

#-----[ SAVE/CLOSE ALL FILES ]--------------------------------
#
# EoM  :mrgreen:


-----------------------------------
Aerosmith
Fri 06 Nov, 2009 15:26

Re: [MOD IPv1.3.0.*] BBCode Hide Message With An Image Buttom
-----------------------------------
Thank you very much, this excellent.  :mrblue:  :mrblue: 

Greetings


-----------------------------------
Diegork
Sat 07 Nov, 2009 11:44

Re: [MOD IPv1.3.0.*] BBCode Hide Message With An Image Buttom
-----------------------------------
I have a question, Can I set this mod so it will only need to be registered to view the post?

Thanks.


-----------------------------------
Mighty Gorgon
Sat 07 Nov, 2009 11:48

Re: [MOD IPv1.3.0.*] BBCode Hide Message With An Image Buttom
-----------------------------------
Why don't set appropriate permissions in ACP for that?

Do you want to hide only the first post?


-----------------------------------
Diegork
Sat 07 Nov, 2009 12:03

Re: [MOD IPv1.3.0.*] BBCode Hide Message With An Image Buttom
-----------------------------------
I want to hide the first post, and i want that the users who want see the first post only be registrered, I don´t want that the users need to reply the post to see the post.

PD: In the ACP where are the permissions for the hide mod?

Bye and thanks.


-----------------------------------
Mighty Gorgon
Mon 09 Nov, 2009 12:25

Re: [MOD IPv1.3.0.*] BBCode Hide Message With An Image Buttom
-----------------------------------
[quote user="Diegork" post="45789"]PD: In the ACP where are the permissions for the hide mod?[/quote]
I was meaning forums VIEW and READ permissions...


-----------------------------------
rendimare
Wed 09 Dec, 2009 04:32

Re: [MOD IPv1.3.0.*] BBCode Hide Message With An Image Buttom
-----------------------------------
Thank you very much, this excellent but I really need help with this mod already and could not move from the incluided


-----------------------------------
xmenfile
Thu 21 Jan, 2010 16:22

Re: [MOD IPv1.3.0.*] BBCode Hide Message With An Image Buttom
-----------------------------------
Thank you for this customize .  I just noitce there is an error when hide it.  Let say if you click on Hide button twice, you'll get this [code linenumbers=false]Hidden Message:
Sorry, but you must be registered and also post a reply to view this message.
[/code], then you put anything thing that you want to hide in between.  This way is ok.   But if you hightlight it then click on Hide button, then you'll get this
[code linenumbers=false]Hidden Message:
Sorry, but you must be registered and also post a reply to view this message.
[/code] 

for example:  i want to hide a link that i already typed
[b]htttp://blablablabla.....[/b]

If i highlight it then click on Hide button i'll get this instead
[code linenumbers=false]Hidden Message:
Sorry, but you must be registered and also post a reply to view this message.
[/code]


-----------------------------------
rendimare
Thu 21 Jan, 2010 17:02

Re: [MOD IPv1.3.0.*] BBCode Hide Message With An Image Buttom
-----------------------------------
I'm interested in this mod but I could make it work in any way if someone can throw me a hand with the agradecere selo


-----------------------------------
Ripley
Wed 10 Feb, 2010 18:59

Re: [MOD IPv1.3.0.*] BBCode Hide Message With An Image Buttom
-----------------------------------
I do not have this mod, but when I manually type [code linenumbers=false]Hidden Message:
Sorry, but you must be registered and also post a reply to view this message.
 or [hide=][/hide][/code]
it works like it worked before, when we were at phpbb3...  :shock: But I have no buttons to push in the bbcode bar...
I uploaded hide.gif into image path and did this 

OPEN: 
templates/common/js/bbcb_mg.js 

FIND: 
Code: [Download] [Hide] [Select]
var Td = 0;


AFTER ADD: 
Code: [Download] [Hide] [Select]
var Hide = 0;


FIND: 
Spoiler: [ Show ]


AFTER ADD: 
Code: [Download] [Hide] [Select]
'Hidden Message:
Sorry, but you must be registered and also post a reply to view this message.
',

and that:

OPEN: 
templates/default/bbcb_mg.tpl 

FIND: 

                   [code linenumbers=false] <a href="javascript:BBChl()" ><img src="{BBCB_MG_IMG_PATH}highlight{BBCB_MG_IMG_EXT}" name="highlight" onmouseover="helpline('highlight')" alt="{L_BBCB_MG_HIGHLIGHT}" title="{L_BBCB_MG_HIGHLIGHT}" class="bbimages" /></a>[/code]


AFTER ADD: 
[code linenumbers=false]
                    <a href="javascript:BBChide()"><img src="{BBCB_MG_IMG_PATH}hide{BBCB_MG_IMG_EXT}" name="hide_img" onMouseOver="helpline('hide')" alt="{L_BBCB_MG_HIDE}" title="{L_BBCB_MG_HIDE}" class="bbimages" /></a>[/code]

So now the image appear, but it is not pushable  :mrgreen: 

Tell me please, what should I do to make hide.gif [code linenumbers=false]Hidden Message:
Sorry, but you must be registered and also post a reply to view this message.
[/code] when clicking on it?


-----------------------------------
El_Fenix
Sat 07 Aug, 2010 11:26

Re: [MOD IPv1.3.0.*] BBCode Hide Message With An Image Buttom
-----------------------------------
[b]i use this code in my forum  i think this can be another option for the mod
 with this change you need to select the text to hide
 do all the steps  in the start of this  topic  after you can try  this function
Im not a coder please check this be ok

sorry about my english[/b]

Before Try this change to the mod 
Backup this file
and  the next to do is

[size=12]in  [/size]
[color=#0033FF][size=12]templates/common/js/bbcb_mg.js[/size][/color] 


[b]FIND: [/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]




[b]REPLACE WITH: [/b]


[code linenumbers=false]function BBChide()
{
	var txtarea = document.forms[form_name].elements[text_name];

	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.forms[form_name].elements[text_name].focus();
			return;
		}
	}
	else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
	{
		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.forms[form_name].hide.src = bbcb_mg_img_path + "hide1" + bbcb_mg_img_ext;
		Hide = 1;
	}
	else
	{
		ToAdd = "[/hide]";
		document.forms[form_name].hide.src = bbcb_mg_img_path + "hide" + bbcb_mg_img_ext;
		Hide = 0;
	}
	PostWrite(ToAdd);
}[/code]

take care about the images [code linenumbers=false]hide_no.gif[/code] and
[code linenumbers=false]hide_yes.gif[/code] if be necesary switch the names via ftp


