function FormatStr(fString)
on Error resume next if DoHide = true then fString = ReplaceHideTags(fString) if strAllowForumCode = "1" then
fString = extratags(fString)
end if
FormatStr = fString
on Error goto 0
end functionFunction 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%>
<!--#INCLUDE FILE="config.asp"-->
<%DoHide = trueOriginally 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 linesCode:add this line under thatfunction FormatStr(fString)
on Error resume nextCode:if DoHide = true then fString = ReplaceHideTags(fString)
around line 150 find these linesCode:Add this code under thatif strAllowForumCode = "1" then
fString = extratags(fString)
end if
FormatStr = fString
on Error goto 0
end functionCode: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 linesCode:Add this line under that%>
<!--#INCLUDE FILE="config.asp"-->
<%Code:DoHide = true
Thats it
hide tags - [hide] - [/hide] upper or lower case
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);
}
}
}
Code:
if mlev > 0 then
Response.Write " <a href=""Javascript:hideurl();"" tabindex=""-1"">" & getCurrentIcon(strIconEditorCode,"Hide URL","align=""top""") & "</a>" & vbNewLine
end if
Code:
Const strIconEditorHideUrl = "icon_editor_hide_url.gif|23|22"
if mlev > 0 then
Response.Write " <a href=""Javascript:hideurl();"" tabindex=""-1"">" & getCurrentIcon(strIconEditorURL,"Hide URL","align=""top""") & "</a>" & vbNewLine
end ifOriginally posted by Carefree<
Your icon names need to be the same, David. You cannot use "strIconEditorCode" in one instance and use "strIconEditorHideUrl" in another.