Hide links from guest users.

Snitz™ Forums 2000
https://forum.snitz.com/forumTopic/Posts/68170?pagenum=1
05 November 2025, 09:33

Topic


Ghostman
Hide links from guest users.
30 January 2009, 13:50


I was looking for a mod that would give me the possibility to hide http:// links from guests. The main idea is to add a [hide][/hide] so if i want to hide a url from a guest i would use that code and a guest would see a message like "only registered members can see the links" instead of the links. Can anyone help me with that?
Thanks

<moved from="Help: General / Current Version (v3.4.xx)" by="Shaggy" /><

 

Replies ...


leatherlips
30 January 2009, 20:32


I believe this thread has the information you are looking for:

http://forum.snitz.com/forum/topic.asp?TOPIC_ID=64934<
Ghostman
30 January 2009, 23:41


i have tried that and it's not working.
is there a way to change the spoiler tag to make it hide tag and do what I need?<
cripto9t
31 January 2009, 10:43


I just wrote a function for this. I put it through a few test, and it seems to work fine. The problem with it is, a nonmember can still see the content in "Reply with Quote". I can write a function to deal with this, but I just can't think of a good way to do it.
a. Remove the hidden content for nonmembers and leave the hide tags visible to members. (Problems: members may remove one or more hide tags before posting)

b. Remove hidden content for everyone. (Problem: Member could still cut and paste.)

c. ?
On the other hand this would work great on locked topics.
Here's the code if you want to test it.
inc_func_common.asp

around line 116 find these lines
Code:
function FormatStr(fString)
on Error resume next
add this line under that
Code:
        if DoHide = true then fString = ReplaceHideTags(fString)

around line 150 find these lines
Code:
	if strAllowForumCode = "1" then
fString = extratags(fString)
end if
FormatStr = fString
on Error goto 0
end function
Add this code under that
Code:
Function ReplaceHideTags(fString)
Dim regEx
Dim strMsg

Set regEx = New RegExp
regEx.IgnoreCase = True
regEx.Global = True
regEx.MultiLine = True

'## Message to none members.
'## Use html not forum code.
'## No message __ strMsg = ""
strMsg = "<b><u>You Must Be Logged In to View This Content.</u></b>"

if mLev > 0 then
regEx.Pattern = "\[HIDE\]([\s\S]*?)\[/HIDE\]"
fString = regEx.Replace(fString,"$1")
else
regEx.Pattern = "\[HIDE\][\s\S]*?\[/HIDE\]"
fString = regEx.Replace(fString,strMsg)
end if

Set regEx = Nothing

ReplaceHideTags = fString
End Function

topic.asp

around line 35 find these lines
Code:
%>
<!--#INCLUDE FILE="config.asp"-->
<%
Add this line under that
Code:
DoHide = true


Thats it
hide tags - [hide] - [/hide] upper or lower case<
modifichicci
31 January 2009, 11:30


Maybe adding an if strDBNTUserName <> "" before showing the reply with quote button?<
Ghostman
31 January 2009, 21:47


Originally posted by cripto9t
I just wrote a function for this. I put it through a few test, and it seems to work fine. The problem with it is, a nonmember can still see the content in "Reply with Quote". I can write a function to deal with this, but I just can't think of a good way to do it.
a. Remove the hidden content for nonmembers and leave the hide tags visible to members. (Problems: members may remove one or more hide tags before posting)

b. Remove hidden content for everyone. (Problem: Member could still cut and paste.)

c. ?
On the other hand this would work great on locked topics.
Here's the code if you want to test it.
inc_func_common.asp

around line 116 find these lines
Code:
function FormatStr(fString)
on Error resume next
add this line under that
Code:
        if DoHide = true then fString = ReplaceHideTags(fString)

around line 150 find these lines
Code:
	if strAllowForumCode = "1" then
fString = extratags(fString)
end if
FormatStr = fString
on Error goto 0
end function
Add this code under that
Code:
Function ReplaceHideTags(fString)
Dim regEx
Dim strMsg

Set regEx = New RegExp
regEx.IgnoreCase = True
regEx.Global = True
regEx.MultiLine = True

'## Message to none members.
'## Use html not forum code.
'## No message __ strMsg = ""
strMsg = "<b><u>You Must Be Logged In to View This Content.</u></b>"

if mLev > 0 then
regEx.Pattern = "\[HIDE\]([\s\S]*?)\[/HIDE\]"
fString = regEx.Replace(fString,"$1")
else
regEx.Pattern = "\[HIDE\][\s\S]*?\[/HIDE\]"
fString = regEx.Replace(fString,strMsg)
end if

Set regEx = Nothing

ReplaceHideTags = fString
End Function

topic.asp

around line 35 find these lines
Code:
%>
<!--#INCLUDE FILE="config.asp"-->
<%
Add this line under that
Code:
DoHide = true


Thats it
hide tags - [hide] - [/hide] upper or lower case

Tested and it works like a charm. Thanks so much.

Can you give a code to add a button to place the tags on the topic response form?<
Classicmotorcycling
01 February 2009, 00:53


If you have the other part working, this should allow you to add a button to be able press a button. You will need to edit 3 files and add an icon to your forum image folder:

inc_code.js:

Code:

Code:

function hideurl() {
var text = getText();
if (helpstat) {
alert("Hide URLs from non-members.\n\nUSE: [hide]This URL is hidden[/hide]");
} else if (basic) {
AddTxt="[hide]" + text + "[/hide]";
AddText(AddTxt);
} else {
if (text) {
txt=prompt("URL to be hidden",text);
} else {
txt=prompt("TURL to be hidden","Text");
}
if (txt!=null) {
AddTxt="[hide]"+txt+"[/hide]";
AddText(AddTxt);
}
}
}

inc_post_buttons.asp:

Code:

Code:

if mlev > 0 then
Response.Write " <a href=""Javascript:hideurl();"" tabindex=""-1"">" & getCurrentIcon(strIconEditorCode,"Hide URL","align=""top""") & "</a>" & vbNewLine
end if

inc_iconfiles.asp"

Code:

Code:

Const strIconEditorHideUrl = "icon_editor_hide_url.gif|23|22"


Quick icon image:
I hope that helps. bigsmile<
Carefree
01 February 2009, 17:08


Your icon names need to be the same, David. You cannot use "strIconEditorCode" in one instance and use "strIconEditorHideUrl" in another. <
Ghostman
01 February 2009, 20:12


the button shows but I click on the button and nothing happens<
Carefree
01 February 2009, 22:44


Ghostman, change the lines for inc_post_buttons.asp to say:
Code:
if mlev > 0 then
Response.Write " <a href=""Javascript:hideurl();"" tabindex=""-1"">" & getCurrentIcon(strIconEditorURL,"Hide URL","align=""top""") & "</a>" & vbNewLine
end if

If the button is showing and nothing happens when you click it, then you must have an error in your "inc_code.js" file. Post a link to it in .txt format and we'll try and fix it.<
Classicmotorcycling
02 February 2009, 04:01


Trouble with quick cut and paste. bigsmile
Originally posted by Carefree
Your icon names need to be the same, David. You cannot use "strIconEditorCode" in one instance and use "strIconEditorHideUrl" in another.
<
Ghostman
02 February 2009, 06:29


ok

here's the links to the code in inc_code.js

http://only.ghostlinks.com.pt/code.txt<
Carefree
02 February 2009, 08:43


Try this<
© 2000-2021 Snitz™ Communications