![]() |
Hack for [IMG] tag in posts so that guests must register to view imbedded images
Hi all,
I have a hack that I'd like to see, and I'm hoping that it actually wouldn't been to difficult to implement. I'm looking for a hack that would allow an Admin the ability to "flip a switch" and make it so that any posts which include imbedded images (using the [IMG] tag) would be disabled for guests. Ideally, this would be a forum permission that could apply to certain forums only, at the Admin's choice. Instead of guests seeing the images within a post (as you normally would) they could see either: 1. A Replacement graphic that says something along the lines of "In order to view this image, you need to register." 2. Or any custom text (via a template) that would say the same thing: ""In order to view this image, you need to register. Click here to register." etc. This could be a way to save bandwidth and bump up the amount of registered users. Seems like it would be nice hack. Is there already a similar hack out there, or does someone want to tackle this one? |
Anyone want to take on this one?
Pretty please? :) |
Anyone? Bueller??
|
Great Idea
And also it will help to incarege the visitors to register in my forum Any body can do it ??? |
I'm still really interested in this hack, and it looks like there's other interest from at least kuwaitsun as well. Anyone want to take this one on?
Mist has created this nice hack which works with the PHP vb code tag in messages, but he's a bit busy to take this IMG hack on. For admins who host a lot of images in posts, this seems like an excellent way to reduce bandwidth AND get new registered users. Ideally, I'd like to see it be able to have an ON/OFF toggle per certain forums, so it would be easy for Admins to decide which forums get the treatment of this hack, without having to alter more templates, etc. I'll be happy to create the graphic(s) needed to show the "Sorry, you must register before you can view this image." graphic, etc. |
Try this:
Open admin/functions.php, look around line 884 for this line: PHP Code:
PHP Code:
That should do the job. |
Lesane, thanks for the reply.
I tried the suggested hack, but it didn't work. After applying your hack suggestion, any thread would view as a completely blank page. I don't just mean the contents of the post, but a total white page in the browser. (No header, no forum home, nada.) It would be a blank browser page for forum home, everything, not just individual threads. I double-checked, and made sure I was applying this hack to admin/functions.php (and not admin/adminfunctions.php), double-checked my suggested link to the replacement image (customized for my forum) and again, a total blank page. I'm using 2.3.0 if that helps. Lesane, were you able to get this working in a test? I'd really love to get this working, so please let me know if there's anything I'm missing. Thanks again for the help and suggestion. |
I did tested it on 2.3.2 but it should not give you a completely blank page even if it isn't working. But 2.3.0 does have a different line so try again:
(redo last one) Open admin/functions.php and find: PHP Code:
PHP Code:
|
Lesane, it worked like a charm!!
Thank you so much!!! But I did figure out what was causing the entire forum to be blank. 1. In the hack you suggested, at the end, there was an extra "}" character which caused the site to show up as blank. That one extra character was the issue for my board. Removing the extra "}" at the end of the replacement code did the trick!! Wow, thanks again for taking the time to generate this great little hack. You may want to post this hack in the hacks forum, because I'm sure others will get some use out of it. (Just to note, vB3 is odd with the Mac/Safari/IE for Mac. I had to copy/paste using a PC to get the true PHP code without any extra added characters.) So I'm going to save this as a separate TXT attachment just in case. Lesane, thanks again for the help with this! Awesome! |
You're welcome, glad it's working now.
And to be honest.. i don't know what that extra } is doing there hehe, i cut-n-paste it. Aah well, it's working now. :) |
this also effects users signature images if a user has an [img[ code in there sig..........
|
i modded it a bit to make the image a link to teh register page if u r interested ?
$bbcode = preg_replace("|\[img\](.*)\[/img\]|i", "<a href=\"http://www.url.com/forums/register.php?s=&action=signup\"><img src=\"http://www.url.com/forums/images/registerpic.jpg\" border=\"0\" alt=\"\"></a>", $bbcode); |
Awesome! Let me apply this new little tweak. Very good idea.
Lesane and corsacrazy, thanks again for your assistance with this! |
all credit goes to the L man ;) and ofcourse atomic for the idea ;)
|
1 Attachment(s)
If anyone is intersted, I created a simple quick and dirty "You'll need to register" graphic and have attached it to this post. (I just used the generic vBulletin colors/fonts, so it's not flashy, but it'll do the job. It includes the corsacrazy mod, telling users they can click the image to register.)
Lesane, would it be a LOT more work to get this hack selectable per forum? Or perhaps a line of code that would exclude a certain forum(s) from this IMG hack? (Perhaps the admin could hard code the forum IDs they want to include for this into the hack, etc? Or vice-versa, one could exclude a particular forum from this IMG tag behavior?) Its not crucial, but if it's not too difficult, it would be a nice addition. Thanks again to Lesane for the PHP work and corsacrazy for the mod! |
1 Attachment(s)
here tis my graffic
|
Hey, no fair!! Your graphic is way better than mine! :D
|
lol i also hav a swf flah move telin people to register i may incorportae that into it ;)
|
Just so this question doesn't get lost from the first page: Lesane, would it be a LOT more work to get this hack selectable per forum? Or perhaps a line of code that would exclude a certain forum(s) from this IMG hack? (Perhaps the admin could hard code the forum IDs they want to include for this into the hack, etc? Or vice-versa, one could exclude a particular forum from this IMG tag behavior?)
|
Quote:
It's not really that hard, open admin/functions.php and find: Code:
return bbcodeparse2($bbcode,$dohtml,$dobbimagecode,$dosmilies,$dobbcode); Code:
return bbcodeparse2($bbcode,$dohtml,$dobbimagecode,$dosmilies,$dobbcode,$forumid); Code:
function bbcodeparse2($bbcode,$dohtml,$dobbimagecode,$dosmilies,$dobbcode) Code:
function bbcodeparse2($bbcode,$dohtml,$dobbimagecode,$dosmilies,$dobbcode,$forumid) Code:
if($bbuserinfo[userid]==0) { Code:
if($bbuserinfo[userid]==0 AND $forumid != X) { |
Lesane, you da man!!
Thanks so much for this help. I'll test this out on my test forum tonite. In the spirit of your avatar, I'm sure everything will be "Kool Mo' D"! :D |
Lesane, this is an excellent hack.
I just wanted to know if it would be possible to update this for vB3? I sure hope so, thanks! |
Has anyone ported over the code to/for vB 3.0.1 for this useful bit of a hack? This is assuming that the code above is for 2.3.2.
|
If you can find it under the 3.x hack section, the answer to your question is yes. :)
Syl... |
Not everyone who ports over the code for their own personal board releases it here at vb.org.
So again, has anyone used this hack and customized it for vB3? Unfortunately, it looks as if Lesane is no longer here to offer his excellent help. :( |
According to a personal email from Lesane, he has been banned from this site, vb.org and will not be able to post here ever. I will remain in contact and possibly post his responses as I get them. I hope this helps you understand his delay in responding. Best wishes.
-Andy |
Quote:
|
nice work guys this is a very good hack and ill be using it on babesandstuff .. that way the forums can be spidered and images wont show to non registered users .
|
Quote:
But this hack is great for sites that have many many guest viewers. WE NEED THIS HACK FOR VB3!!! :D Anyone?? |
I'd love to see this for 3.0.8 (OR 3.5, Ill be scooting on over soon) - I have a similar hack working, but it does not affect thumbnails. Which kind of defeats the purpose, since I have all images thumbnailed. When a guest clicks the (viewable) thubnail, they get the full size image. The only thing that gets blocked is sigs!
|
All times are GMT. The time now is 05:51 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|