Hidden Content for Members Only

Snitz™ Forums 2000
https://forum.snitz.com/forumTopic/Posts/68800?pagenum=1
05 November 2025, 03:40

Topic


leatherlips
Hidden Content for Members Only
25 July 2009, 11:53


I was wanting to try to add a feature that would only be seen by members only. For example, lets say I only wanted members to see the pictures in the post. The members would see the entire post as normal:

Duis blandit nulla amet ea quis volutpat suscipit exerci eros duis dolore feugiat, commodo, duis vero, velit suscipit enim sed autem odio. Vulputate zzril blandit eum eum facilisi vero feugait iriure, et consequat. Molestie, accumsan velit ipsum praesent accumsan dolore delenit in hendrerit, at enim dolor.

Ea qui ut commodo odio consequat consectetuer augue dignissim ea ut velit sed accumsan veniam. Ut nostrud vulputate, magna nulla exerci eu in illum luptatum autem commodo nibh nibh. Augue tation hendrerit suscipit, consequat nulla enim, suscipit ea velit nulla molestie. In autem, ut consequat, exerci blandit, esse, aliquip dolore, eros veniam aliquip duis, vel.

But a non member would see something like this:

Duis blandit nulla amet ea quis volutpat suscipit exerci eros duis dolore feugiat, commodo, duis vero, velit suscipit enim sed autem odio. Vulputate zzril blandit eum eum facilisi vero feugait iriure, et consequat. Molestie, accumsan velit ipsum praesent accumsan dolore delenit in hendrerit, at enim dolor.
[This picture is for members only]
Ea qui ut commodo odio consequat consectetuer augue dignissim ea ut velit sed accumsan veniam. Ut nostrud vulputate, magna nulla exerci eu in illum luptatum autem commodo nibh nibh. Augue tation hendrerit suscipit, consequat nulla enim, suscipit ea velit nulla molestie. In autem, ut consequat, exerci blandit, esse, aliquip dolore, eros veniam aliquip duis, vel.

If I can be shown how to do that, then I think I can figure out how to make it work with other forum tags.

 

Replies ...


HuwR
25 July 2009, 12:07


it would be different for different tags, as they are not all parsed by the same function smile
The code is in inc_func common, the majority of codes are parsed using the docode function, image however are parsed in the ReplaceImageTags function.
I will take a look at the code later and work out where to put your code if you get stuck
leatherlips
25 July 2009, 22:41


OK, I've tried to do something and I kind of have it working. But it does this:

Code:
[This picture is for members only]Full URL of the image
It does not show the picture but then it does show the full url of the pictures location. How can I get rid of the URL?
This is what I changed in inc_func_common.asp:

Code:
ImgTags(1,1,1) = "[img ]"
ImgTags(1,2,1) = "[/img]"
ImgTags(1,1,2) = "<img name='img' src="""
ImgTags(1,2,2) = """ border=""0"" style='cursor:default'
I changed it to this:

Code:
ImgTags(1,1,1) = "[img ]"
ImgTags(1,2,1) = "[/img]"
if mlev > 0 then
ImgTags(1,1,2) = "<img name='img' src="""
ImgTags(1,2,2) = """ border=""0"" style='cursor:default' onClick='doimage(this,event)'>"
else
ImgTags(1,1,2) = "<div>[This picture is for members only]"
ImgTags(1,2,2) = "</div>"
end if
Where is it getting the URL from?
HuwR
26 July 2009, 03:41


you need to do the change where it does the replace rather than where it defines the tags, all you have done is replace the [img] tags, not what was inside them.
Carefree
26 July 2009, 05:41


Something like this may do ya ....
Code:

Look for the following line (appx: 1281)

ReplaceImageTags = strTempString



Change it to say:

if mLev > 0 then
ReplaceImageTags = strTempString
else
if instr(strTempString,"<img") then
ReplaceImageTags = "<div>[Image for members only!]</div>"
else
ReplaceImageTags = strTempString
end if
end if
leatherlips
26 July 2009, 09:27


Carefree, I tried what you suggested. It however seems to replace everything with that. I'm not sure why. Take a look at my test forum: www.mangionemagic.com/forumtest

It replaced the forum descriptions, signatures along with the pictures and any other tags in use.
Classicmotorcycling
26 July 2009, 18:09


OK, I have had a look at this and very simple to do, around line 999 of of a fresh inc_func_common.asp:

Change the following code:

Code:
					If strFirstPart <> "" Then
If UCase(Left(strFirstPart, 5)) = "[IMG]" Then
ReplaceURLs = ReplaceURLs & "<a href=""" & strArray2(0) & """ target=""_blank"">" & strFirstPart & "</a>" & strSecondPartf
ElseIf UCase(Left(strArray2(0), 7)) = "HTTP://" Then

To the following:

Code:
					If strFirstPart <> "" Then
If UCase(Left(strFirstPart, 5)) = "[IMG]" Then
if mlev > 0 then
ReplaceURLs = ReplaceURLs & "<a href=""" & strArray2(0) & """ target=""_blank"">" & strFirstPart & "</a>" & strSecondPart
else
Response.Write "<div>[This picture is for members only]</div><br />"
end if
ElseIf UCase(Left(strArray2(0), 7)) = "HTTP://" Then

It worked for me. Let me know how you go. bigsmile
leatherlips
26 July 2009, 19:17


Classicmotorcycling,

I don't have any of the code you listed. I think I remember a long time ago changing that to make any link that pointed to a page in my site to open in the same window. Here is the section of code I have that I think resembles what you are referring to. The part in red is what I tried to add according to your directions. It currently does not work for me. The pictures show rather you are logged in or not.
Code:
if instr(ucase(strArray2(0)),"MANGIONEMAGIC.COM")>0 then
ReplaceURLs=ReplaceURLs&roTag&strArray2(0)&rc3Tag&strFirstPart&rc2Tag&strSecondPart
elseif ucase(left(strFirstPart,5))="[IMG]" then
if mlev > 0 then ReplaceURLs=ReplaceURLs&"<a href="""&strArray2(0)&""" target=""_blank"">"&strFirstPart&"</a>"&strSecondPart
else
Response.Write "<div>[This picture is for members only]</div><br />"
end if
elseif ucase(left(strArray2(0),7))="HTTP://" then
Carefree
26 July 2009, 20:07


Originally posted by leatherlips
Carefree, I tried what you suggested. It however seems to replace everything with that. I'm not sure why. Take a look at my test forum: www.mangionemagic.com/forumtest

It replaced the forum descriptions, signatures along with the pictures and any other tags in use.

OK, I put a condition to check for the presence of a image tag before making the change. Try the new version. It works here.
leatherlips
26 July 2009, 21:57


Carefree,

It works a little better. But it is also hiding my mp3 tags along with the img tags.
Carefree
26 July 2009, 22:06


Originally posted by leatherlips
Carefree,

It works a little better. But it is also hiding my mp3 tags along with the img tags.

That shouldn't be possible. It only hides strings which include "<img". Post a link to your "inc_func_common.asp" in .txt for me to look at.
leatherlips
26 July 2009, 22:25


Here it is. Thanks for looking. smile
Carefree
26 July 2009, 23:41


The code I wrote isn't in the file. Where did you make the changes? Here's your "inc_func_common.asp" with the changes applied.
leatherlips
27 July 2009, 07:20


Sorry about that. I removed the code after it wasn't working. I did insert it just like you did though.
I went ahead and uploaded your version and it is doing the same thing.
My biggest thing is to hide the mp3 files from non members. I tried adding your code to the mp3 replace tag section but it doesn't do anything. Maybe my mp3 tag is not correct.
Carefree
27 July 2009, 17:12


I'll look at the mp3 portion to check for you.
Carefree
27 July 2009, 18:14


OK I have it working for hiding MP3s on my server. Try the file for yours.
leatherlips
27 July 2009, 18:23


Where is the file?
Edit: I found it. blush
I tried it with only the mp3 hidden section. I will leave the img tag as normal.
For some reason, it is hiding everything in the post. Here are a couple of screenshots:

Here is what a member sees:


Here is what a non member (visitor) sees:


You can test it for yourself at this thread:

http://www.mangionemagic.com/forumtest/topic.asp?TOPIC_ID=899

Login is demo/demo

I do not understand why your code is not working. It seems perfectly logical to me.
leatherlips
28 July 2009, 19:23


Anyone else have any ideas? Or perhaps why it won't work with my inc_func_common file?
Carefree
29 July 2009, 07:22


I know what is happening, Leather. I'll have to do a substring extraction of the mp3 tagged area of a post and only effect that portion. I'll try and do it today for you.
Carefree
29 July 2009, 16:10


Got it working, only hides the MP3 portion now. Get your file same link.
leatherlips
29 July 2009, 17:40


Now it is working! It is only hiding the mp3 file! Thanks!
One slight issue... blush
It is replacing the file with:

Code:
|File for Members Only|br />

I can't see why it is putting that unclosed break in:

Code:
if mLev=0 and inStr(fString,"[mp3") then
for i = 1 to len(fString)
if mid(fString,i,5)="[mp3]" then ij=i
if mid(fString,i,6)="[/mp3]" then
ik=i
strTextString=left(fString,ij-1)+"|File for Members Only|"+mid(fString,ik+7)
end if
next
strTempString=strTextString
end if
Carefree
29 July 2009, 17:45


Look at your tag definitions:
Code:
<div class=""break""></div>
leatherlips
29 July 2009, 17:49


Originally posted by Carefree
Look at your tag definitions:
Code:
<div class=""break""></div>
I removed it but it had no effect.
leatherlips
29 July 2009, 18:02


Hmmm. I did this:

Code:
strTextString=left(fString,ij-1)+"|File for Members Only|<"+mid(fString,ik+7)
And it fixed it. Seems weird though.
I added your code to my mp3jw tag and it places an extra ] at the end of the message. I have no idea where it is getting the extra /br > and ] from in those tags.
iane87
29 July 2009, 18:53


Looks like you are chopping off the < in your mid statement try replacing

Code:
strTextString=left(fString,ij-1)+"|File for Members Only|"+mid(fString,ik+7)

with

Code:

strTextString=left(fString,ij-1)+"|File for Members Only|"+mid(fString,ik+6)


leatherlips
29 July 2009, 19:16


That fixed it! Thanks!
Also, Carefree, thank you so much for your help with this! You have been incredible in your diligence in getting this to work for me!
leatherlips
29 July 2009, 20:03


I'm trying to give it one more little tweak. I've made an image that will display in place of the content. My code is this:

strTextString=left(fString,ij-1)+"<a href=""login.asp""><img border=""0"" src=""./images/membersonly.gif"" width=""350"" height=""56"" alt=""Members Only""></a>"+mid(fString,ik+6)

The non member can click the image to go to the login.asp page where they can either login or register. I'm trying to make it so if they are a member and just need to login they will be redirected back to the post. I tried to do this by adding the part in red but it is not working.
strTextString=left(fString,ij-1)+"<a href=""login.asp?target=" & lcase(scriptname(ubound(scriptname))) & """><img border=""0"" src=""./images/membersonly.gif"" width=""350"" height=""56"" alt=""Members Only""></a>"+mid(fString,ik+6)

It ends up killing the tag - meaning it just displays the tag and the tags content as normal text.
I also found a little glitch in the regular code. If more than one mp3 tag is being used in the same post, the first tag displays as text. See this post to see what I mean.
leatherlips
30 July 2009, 08:34


Originally posted by leatherlips
I also found a little glitch in the regular code. If more than one mp3 tag is being used in the same post, the first tag displays as text. See this post to see what I mean.
I figured out a workaround for this although it is not very elegant. I created a new mp32 tag and a mp33 tag. In the post I edit the second mp3 file to be mp32 and if there is a third mp3 tag I edit it to mp33.
If a better fix is available I'd appreciate knowing what it is. blush
leatherlips
31 July 2009, 14:09


Does anyone have any ideas about the two things I mentioned?
1. Getting the login link to redirect back to the post, and
2. Making the hidden content work for multiple instances of the tag being used within the same post?
I'm very appreciative of everything Carefree has done with this. He's probably getting annoyed with this (and me) by now. blush
Etymon
31 July 2009, 15:44


Originally posted by leatherlips
Does anyone have any ideas about the two things I mentioned?
1. Getting the login link to redirect back to the post, and
2. Making the hidden content work for multiple instances of the tag being used within the same post?
I'm very appreciative of everything Carefree has done with this. He's probably getting annoyed with this (and me) by now. blush

Nah, Carefree loves the attention! [^]
Carefree
31 July 2009, 17:24


LOL If you say so.
In answer to the return after login, here's how you could do it (this works):
Code:


if inStr(Request.ServerVariables("URL"),"/") then
for i=1 to len(Request.ServerVariables("URL"))
if mid(Request.ServerVariables("URL"),i,1)="/" then
strURL = mid(Request.ServerVariables("URL"),i+1)
end if
next
else
strURL = Request.ServerVariables("URL")
end if
left(fString,ij-1)+"<a href=""login.asp?target="& strURL &"""><img border=""0"" src=""images/members.bmp"" width=""350"" height=""56"" alt=""Members Only""></a>"+mid(fString,ik+6)

leatherlips
31 July 2009, 17:37


Thanks Carefree.
I'm getting this error:

Code:
Microsoft VBScript compilation error '800a0410' 

Invalid 'for' loop control variable

/forum/inc_func_common.asp, line 2092

for i=1 to len(Request.ServerVariables("URL"))

Here is the whole section of code:

Code:
if mLev=0 and inStr(fString,"[mp3") then
for i = 1 to len(fString)
if mid(fString,i,5)="[mp3]" then ij=i
if mid(fString,i,6)="[/mp3]" then
ik=i

if inStr(Request.ServerVariables("URL"),"/") then
for i=1 to len(Request.ServerVariables("URL")) if mid(Request.ServerVariables("URL"),i,1)="/" then
strURL = mid(Request.ServerVariables("URL"),i+1)
end if
next
else
strURL = Request.ServerVariables("URL")
end if
left(fString,ij-1)+"<a href=""login.asp?target="& strURL &"""><img border=""0"" src=""images/members.bmp"" width=""350"" height=""56"" alt=""Members Only""></a>"+mid(fString,ik+6)



end if
next
strTempString=strTextString
end if

Carefree
31 July 2009, 18:02


Originally posted by leatherlips
Thanks Carefree.
I'm getting this error:

Code:
Microsoft VBScript compilation error '800a0410' 

Invalid 'for' loop control variable

/forum/inc_func_common.asp, line 2092

for i=1 to len(Request.ServerVariables("URL"))

Here is the whole section of code:

Code:
if mLev=0 and inStr(fString,"[mp3") then
for i = 1 to len(fString)
if mid(fString,i,5)="[mp3]" then ij=i
if mid(fString,i,6)="[/mp3]" then
ik=i

if inStr(Request.ServerVariables("URL"),"/") then
for ji=1 to len(Request.ServerVariables("URL")) if mid(Request.ServerVariables("URL"),ji,1)="/" then
strURL = mid(Request.ServerVariables("URL"),ji+1)
end if
next
else
strURL = Request.ServerVariables("URL")
end if
left(fString,ij-1)+"<a href=""login.asp?target="& strURL &"""><img border=""0"" src=""images/members.bmp"" width=""350"" height=""56"" alt=""Members Only""></a>"+mid(fString,ik+6)



end if
next
strTempString=strTextString
end if



Well, naturally. We are re-using/defining the variable "i" within a loop - can't do that. So simply change the second series of "i" variables to "ji" and the problem will go away.
© 2000-2021 Snitz™ Communications