Hidden Content for Members Only - Postet den (3838 Views)
Senior Member
leatherlips
Innlegg: 1838
1838
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.
   
 Sidestørrelse 
Postet den
Forum Admin
HuwR
Innlegg: 20611
20611
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
Postet den
Senior Member
leatherlips
Innlegg: 1838
1838
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?
Postet den
Forum Admin
HuwR
Innlegg: 20611
20611
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.
Postet den
Advanced Member
Carefree
Innlegg: 4224
4224
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
Postet den
Senior Member
leatherlips
Innlegg: 1838
1838
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.
Postet den
Development Team Leader
Classicmotorcycling
Innlegg: 2085
2085
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
Cheers,

David Greening
Postet den
Senior Member
leatherlips
Innlegg: 1838
1838
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
Postet den
Advanced Member
Carefree
Innlegg: 4224
4224
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.
Postet den
Senior Member
leatherlips
Innlegg: 1838
1838
Carefree,

It works a little better. But it is also hiding my mp3 tags along with the img tags.
Postet den
Advanced Member
Carefree
Innlegg: 4224
4224
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.
Du må legge inn en melding