View Full Version : Fix for smilie display problem
Boots
12-23-2004, 10:00 PM
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:
:puke: and :p
as you can see, the smilies are parsed by display order so :p gets parsed before :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
$items = $DB_site->query("SELECT * FROM " . TABLE_PREFIX . "$table ORDER BY imagecategoryid, displayorder");
replace that line with this 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
SELECT smilietext, smiliepath, smilieid FROM " . TABLE_PREFIX . "smilie
replace it with this
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 ! :D Let me know how it works for ya! :D
sabret00the
12-24-2004, 01:18 PM
that's great work although theirs a mistake
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");
}
should read
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");
}
sabret00the
12-24-2004, 01:19 PM
will this also fix the :lol:) problem?
GenSec
12-24-2004, 01:34 PM
Very usefull. Thanks!
Boots
12-24-2004, 02:08 PM
fixed this in the original post. I don't know how the | got in there as I copied it directly from my code ? weird. Oh well, fixed now :D
that's great work although theirs a mistake
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");
}
should read
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");
}
Boots
12-24-2004, 02:10 PM
will this also fix the :lol:) problem?
yes
(:lol:)
displays perfectly fine on my forum :)
Boofo
12-24-2004, 10:08 PM
Can you please post this in a text file also for easier downloading and saving? ;)
Boots
12-24-2004, 11:53 PM
Sure thing. i'll post one up tommorow :)
NYI Fan
12-25-2004, 12:55 AM
thanks, i was wondering when Iw as going to find some time to clean this mess up LOL and youve saved me the trouble!
*clicks install*
NuclioN
12-25-2004, 01:16 AM
Fantastic! :) Tnx.
red_baron2000
12-25-2004, 10:15 AM
man oh man!! you've heard me!!! :)
Oblivion Knight
12-25-2004, 10:48 AM
Nicely done, I know that many will love you for this.. ;)
sabret00the
12-25-2004, 11:30 AM
another fix may be to try and maintain display orderif ($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:
CtrlAltDel
12-25-2004, 11:45 PM
good idea and great work putting it together
Cap'n Steve
12-26-2004, 04:38 AM
THANK YOU! I've been putting off trying to reorganize my smilies so they all worked ever since I switched to vbulletin.
Boots
12-27-2004, 05:41 PM
another fix may be to try and maintain display orderif ($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 :D
frage
12-27-2004, 07:59 PM
Boots
you made my day!
:up: :)
frage
:) I did exactly the same thing, and suggested vb.com, but seems they didnt want to sort out the problem :)
* mtha clicks install
JohnBee
05-09-2005, 01:05 PM
Doing this modification now produces this when updating cache counters.
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?
JohnBee
05-09-2005, 01:55 PM
I found it!
It was my own typo, carry on ... :classic:
Doing this modification now produces this when updating cache counters.
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?
nice, this one worked fine for me...
Boofo
05-31-2005, 10:41 PM
Can you please post this in a text file for those who may have to reinstall this after an upgrade?
blueshift
06-06-2005, 09:58 AM
Very good work. This has been an on-going problem throughout vBulletin history. Nicely done. :)
Smash World
07-06-2005, 12:29 AM
works great on my vB 3.0.7 board - thanks!
weaver
07-31-2005, 03:21 PM
I am getting
" class="inlineimg" />
after some of my smilies. Is that related to this hack or something else? I've only seen it start happening after I installed this hack.
ETA: Figured it out. It will give that error if you have duplicate smilie codes.
Gutspiller
08-05-2005, 10:18 PM
Does this problem still exist in 3.0.7?
hotwheels
08-19-2005, 11:44 PM
this is a great hack...............thanks, it is working perfectly
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.