Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Beta Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Fix for smilie display problem Details »»
Fix for smilie display problem
Version: 1.00, by Boots Boots is offline
Developer Last Online: Feb 2015 Show Printable Version Email this Page

Version: 3.0.3 Rating:
Released: 12-23-2004 Last Update: Never Installs: 24
Is in Beta Stage  
No support by the author.

As many of you know, the parsing of vB smilies is rather odd and can be a huge headache when it comes to multiple codes not parsing correctly

ie:

uke: and

as you can see, the smilies are parsed by display order so
Code:
:p
gets parsed before
Code:
:puke:
therefore the longer smilie code doesn't display correctly. An easy fix is to parse the smilies in order of their code length. The following two quick hacks will do just that!

BEFORE ATTEMPTING THIS - MAKE BACKUP COPIES OF:

/includes/adminfunctions.php
/includes/functions_bbcodeparse.php

Whenever you are changing files you should always have a proper backup!



open /includes/adminfunctions.php and goto line 2192

you will see this line
Code:
	$items = $DB_site->query("SELECT * FROM " . TABLE_PREFIX . "$table ORDER BY imagecategoryid, displayorder");
replace that line with this code
Code:
	if ($table == 'smilie') 
                {
                     $items = $DB_site->query("SELECT * FROM " . TABLE_PREFIX . "smilie ORDER BY LENGTH(smilietext) DESC");  
                }
                else
                {
                    $items = $DB_site->query("SELECT * FROM " . TABLE_PREFIX . "$table ORDER BY imagecategoryid, displayorder");  
                }
open includes/functions_bbcodeparse.php and goto line 385

you will see this line
Code:
SELECT smilietext, smiliepath, smilieid FROM " . TABLE_PREFIX . "smilie
replace it with this
Code:
SELECT smilietext, smiliepath, smilieid FROM " . TABLE_PREFIX . "smilie  ORDER BY LENGTH(smilietext) DESC
After this is complete, go into your Admin CP, view your smilies and just click "Save Display Order" This will update the cached smilie's datastore. This hack won't have any effect until this is done

Enjoy proper smilies ! Let me know how it works for ya!

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 12-25-2004, 10:15 AM
red_baron2000's Avatar
red_baron2000 red_baron2000 is offline
 
Join Date: Jul 2002
Location: EU
Posts: 88
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

man oh man!! you've heard me!!!
Reply With Quote
  #13  
Old 12-25-2004, 10:48 AM
Oblivion Knight's Avatar
Oblivion Knight Oblivion Knight is offline
 
Join Date: May 2002
Location: Sheffield, UK
Posts: 1,757
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nicely done, I know that many will love you for this..
Reply With Quote
  #14  
Old 12-25-2004, 11:30 AM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

another fix may be to try and maintain display order
PHP Code:
if ($table == 'smilie')
                 {
 
$items $DB_site->query("SELECT * FROM " TABLE_PREFIX "smilie ORDER BY imagecategoryid, LENGTH(smilietext) DESC, displayorder"); 
                 }
                 else
                 {
 
$items $DB_site->query("SELECT * FROM " TABLE_PREFIX "$table ORDER BY imagecategoryid, displayorder"); 
                 } 
but i aint tested it so who knows :happysad:
Reply With Quote
  #15  
Old 12-25-2004, 11:45 PM
CtrlAltDel CtrlAltDel is offline
 
Join Date: Feb 2002
Location: Ohio
Posts: 107
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

good idea and great work putting it together
Reply With Quote
  #16  
Old 12-26-2004, 04:38 AM
Cap'n Steve's Avatar
Cap'n Steve Cap'n Steve is offline
 
Join Date: Feb 2004
Location: Kalamazoo, MI, USA
Posts: 745
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

THANK YOU! I've been putting off trying to reorganize my smilies so they all worked ever since I switched to vbulletin.
Reply With Quote
  #17  
Old 12-27-2004, 05:41 PM
Boots Boots is offline
 
Join Date: Dec 2004
Posts: 172
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by sabret00the
another fix may be to try and maintain display order
PHP Code:
if ($table == 'smilie')
                 {
 
$items $DB_site->query("SELECT * FROM " TABLE_PREFIX "smilie ORDER BY imagecategoryid, LENGTH(smilietext) DESC, displayorder"); 
                 }
                 else
                 {
 
$items $DB_site->query("SELECT * FROM " TABLE_PREFIX "$table ORDER BY imagecategoryid, displayorder"); 
                 } 
but i aint tested it so who knows :happysad:
Not a bad idea. I may implement this and test it later. Sorry for the delay on the text file. you know how the holidays are
Reply With Quote
  #18  
Old 12-27-2004, 07:59 PM
frage frage is offline
 
Join Date: Sep 2004
Posts: 38
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Boots

you made my day!

:up:
frage
Reply With Quote
  #19  
Old 04-04-2005, 07:43 PM
mtha's Avatar
mtha mtha is offline
 
Join Date: Jul 2002
Location: US
Posts: 775
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I did exactly the same thing, and suggested vb.com, but seems they didnt want to sort out the problem

[high]* mtha clicks install[/high]
Reply With Quote
  #20  
Old 05-09-2005, 01:05 PM
JohnBee JohnBee is offline
 
Join Date: Oct 2004
Posts: 544
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Doing this modification now produces this when updating cache counters.

Code:
Database error in vBulletin 3.0.3:

Invalid SQL: 
    		    	SELECT smilietext, smiliepath, smilieid FROM smilie  ORDER BY LENGTH(smilietext) DESC  ORDER BY LENGTH(smilietext) DESC
				
mysql error: You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY LENGTH(smilietext) DESC' at line 1

mysql error number: 1064

Date: Monday 09th of May 2005 09:39:44 AM
Script: http://www.mysite.net/web/forum/admincp/misc.php
Referer: http://www.mysite.net/web/forum/admincp/misc.php
Username: JohnBee
IP Address: *.*.*.*
Any ideas?
Reply With Quote
  #21  
Old 05-09-2005, 01:55 PM
JohnBee JohnBee is offline
 
Join Date: Oct 2004
Posts: 544
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I found it!
It was my own typo, carry on ... :classic:

Quote:
Originally Posted by JohnBee
Doing this modification now produces this when updating cache counters.

Code:
Database error in vBulletin 3.0.3:

Invalid SQL: 
    		    	SELECT smilietext, smiliepath, smilieid FROM smilie  ORDER BY LENGTH(smilietext) DESC  ORDER BY LENGTH(smilietext) DESC
				
mysql error: You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY LENGTH(smilietext) DESC' at line 1

mysql error number: 1064

Date: Monday 09th of May 2005 09:39:44 AM
Script: http://www.mysite.net/web/forum/admincp/misc.php
Referer: http://www.mysite.net/web/forum/admincp/misc.php
Username: JohnBee
IP Address: *.*.*.*
Any ideas?
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 07:41 PM.


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.07829 seconds
  • Memory Usage 2,325KB
  • Queries Executed 25 (?)
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
  • (8)bbcode_code
  • (2)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete