Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-14-2011, 12:32 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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;
In all the BB Code hooks and the showthread_start/complete hooks.

I really only need disable their view in forum posts- they are almost never used elsewhere.
Reply With Quote
  #2  
Old 04-14-2011, 01:15 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #3  
Old 04-14-2011, 02:36 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

LOL... at least I'm not crazy... I will keep working on this too, will post up if I find anything.
Reply With Quote
  #4  
Old 04-14-2011, 06:08 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 04-14-2011, 11:20 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
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.
The style idea is excellent... will look into that... thanks. :up:
Reply With Quote
  #6  
Old 04-15-2011, 02:57 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #7  
Old 04-15-2011, 10:39 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #8  
Old 04-15-2011, 11:33 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
}
(But I don't know if $styleid is available there or not. I didn't try this or anything).
Reply With Quote
  #9  
Old 04-16-2011, 02:22 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #10  
Old 04-17-2011, 08:45 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:59 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05437 seconds
  • Memory Usage 2,256KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete