The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Allow a user to disable smileys (because of epilepsy)
Hello all- I've been working on this all day and can't believe it's not a simple edit- maybe it is and I'm missing something.
I have a new member who says they are epileptic and they have some concerns that some of my larger animated smileys may trigger a seizure. He already browses with images turned off. I can't find any option to disable smielys per user but I know it's possible. I've been all through class_bbcode.php trying all the hooks and all the options I can think of to disable smileys and none of it seems to work. I also searched and searched and can't believe this hasn't been asked before. I found a mod for VB 2.x to do this but the code doesn't work on 3.x. Anyone have any ideas how to do this via a plugin? Once I get how I will work it into a custom user profile field to let people disable them if they want. What I had been trying was stuff like: Code:
$allowsmilies = false; $dosmilies = false; $do_smilies = false; $forum['allowsmilies'] = false; I really only need disable their view in forum posts- they are almost never used elsewhere. |
#2
|
|||
|
|||
The problem seems to be post caching - I set $dosmilies = false at bbcode_parse_start, but it only changes when the post cache is rebuilt. I tried to set $post_cachable = false at showthread_post_start, but that didn't work. showthread.php is too complicated to for me to figure out tonight
|
#3
|
||||
|
||||
LOL... at least I'm not crazy... I will keep working on this too, will post up if I find anything.
|
#4
|
|||
|
|||
OK, if you also put $parsedtext = '' at bbcode_parse_start (as well as $dosmilies = false, both inside some if condition I'd assume), and also put $post_cachable = false (ETA: at showthread_post_start, that is) (probably inside the same if condition), then it seems to work. Well, at least it turns smilies on and off depending on how you set $dosmilies, but I haven't tested to make sure it doesn't affect what other users see.
Another thought was to somehow make a style that has smilies turned off. The caching stuff seems to be separate for different styles, so that might eliminate that problem. |
#5
|
||||
|
||||
Quote:
|
#6
|
||||
|
||||
Mobile styles have smiles (images) disabled by using replacement variables. Just use that code for a new style or write it up as a plugin that gets turned 'on' via a user profile field - Disable Smilies? Yes/No.
|
#7
|
||||
|
||||
Hmmm... the mobile styles I have use the replacement variables to change the HTML of inline images only, they don't work on smilies- I could probably edit it to work on all images but I really don't want to disable all images.
I got a preg_replace going on bbcode_parse_start that removes the colons ( from a smiley name and replaces it with Italics tags so the name of the smiley displays instead of the smiley... unfortunately I run into the same post cache issue I did last time I tried to modify code at this hook. If the post is cached it doesn't change. Shutting off the post cache for everyone isn't really an option. What gets me is that anything I run on postbit_display_complete changes all the time regardless of the cache... I'd run my plugin on postbit_display_complete but smileys are already in HTML at this point. I guess I could just do a str_replace on an array of HTML for the smileys I need to replace- it's a limited number- I don't need to disable all of them, just a handful really. Surprised this has never come up before. Is there a "hook" that the replacement variables run on? Edit- I see- replacement_vars |
#8
|
|||
|
|||
I had been thinking maybe you could make a copy of a style and then in a plugin at bbcode_parse_start put something like
Code:
if ($styleid == X) { $dosmilies = false } |
#9
|
||||
|
||||
That may work, if it was a new style...
I ended up going with basically my own "Replacement Variables" that work on all styles. I put a line of HTML into one box and a replacement text into another... I use it to disable my biggest/most animated smileys but really it could be used for anything. Should work for me needs... Needs a little polishing, I'll probably release it if it can be of help to anyone. Thanks everyone for the help. |
#10
|
||||
|
||||
OK, got this working finally how I wanted it. The key was using the replacement variable hook, Thanks Lynne.
I can now disable all smileys and replace with their names. I also kept the part where I put a whole image tag in and disable that image as well since there are a few popular flashing images my users seem to post and post over again. I cleaned it up and released it as mod in case anyone in the future finds this in a search, it's here: https://vborg.vbsupport.ru/showthread.php?t=262159 |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|