Hide links from guest users. - نوشته شده در (1784 Views)
Starting Member
Ghostman
مطلب: 6
6
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" /><
 پیش‌فرض مرتب‌سازی برای تاریخ DESC به معنی جدیدترین است  
 تعداد در صفحه 
نوشته شده در
Senior Member
leatherlips
مطلب: 1838
1838
I believe this thread has the information you are looking for:

http://forum.snitz.com/forum/topic.asp?TOPIC_ID=64934<
نوشته شده در
Starting Member
Ghostman
مطلب: 6
6
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?<
نوشته شده در
Average Member
cripto9t
مطلب: 881
881
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<
    _-/Cripto9t\-_
نوشته شده در
Average Member
modifichicci
مطلب: 787
787
Maybe adding an if strDBNTUserName <> "" before showing the reply with quote button?<
نوشته شده در
Starting Member
Ghostman
مطلب: 6
6
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?<
نوشته شده در
Development Team Leader
Classicmotorcycling
مطلب: 2085
2085
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<
Cheers,

David Greening
نوشته شده در
Advanced Member
Carefree
مطلب: 4224
4224
Your icon names need to be the same, David. You cannot use "strIconEditorCode" in one instance and use "strIconEditorHideUrl" in another. <
نوشته شده در
Starting Member
Ghostman
مطلب: 6
6
the button shows but I click on the button and nothing happens<
نوشته شده در
Advanced Member
Carefree
مطلب: 4224
4224
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.<
نوشته شده در
Development Team Leader
Classicmotorcycling
مطلب: 2085
2085
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.
<
Cheers,

David Greening
شما باید یک متن وارد کنید