PDA

View Full Version : Change the display order of message icons


Admin
08-20-2001, 10:00 PM
Description:
This hack will allow you to set the display order of message icons.
Similar to my other hack, ordering of smilies (http://www.vbulletin.com/forum/showthread.php?s=&threadid=25888).

Demo:
http://forum.t-cove.com/order2.gif

Installation:
1. Run the following queries either in phpMyAdmin (http://www.vbulletin.com/forum/showthread.php?threadid=18558) or thru Telnet: (one query at a time)
ALTER TABLE icon ADD showid SMALLINT not null
ALTER TABLE icon ADD INDEX (showid)
UPDATE icon SET showid=iconid

2. In functions.php (in your admin folder) replace
$icons=$DB_site->query("SELECT iconid,iconpath,title FROM icon ORDER BY iconid");
with
$icons=$DB_site->query("SELECT iconid,iconpath,title FROM icon ORDER BY showid");

3. In icon.php (in your admin folder) replace
$icons=$DB_site->query("SELECT iconid,title,iconpath FROM icon ORDER BY title LIMIT ".($limitlower-1).",$perpage");
with
$icons=$DB_site->query("SELECT iconid,title,iconpath FROM icon ORDER BY showid LIMIT ".($limitlower-1).",$perpage");
Below
makelinkcode("remove","icon.php?s=$session[sessionhash]&action=remove&iconid=$icon[iconid]&perpage=$perpage&statrpage=$startpage");
add
echo "<br>Order: <input type=text name=\"order[$icon[iconid]]\" size=5 value=\"$icon[showid]\">";
Replace
echo "</table></td></tr></table></form>";
with
doformfooter("Update order");
Replace
doformheader("icon","modify");
with
doformheader("icon","doorder");
Above
// ###################### Start Modify #######################
add
// ###################### Start do order #####################
if ($HTTP_POST_VARS['action']=="doorder") {

while (list($key,$val)=each($order)) {

$DB_site->query("UPDATE icon SET showid='$val' WHERE iconid='$key'");

}

echo "<p>Order updated!</p>";
$action="modify";

}

Requested by:
theflow

That's it. Feedback, requests and anything else is more than welcome. :)
Good luck! :D

Hoffi
08-21-2001, 08:29 AM
I think you were too fast with cut'n paste. :cool:

in step three you say to change smilie.php and the variables and tables are also smilie.

Admin
08-21-2001, 08:41 AM
Thanks man. :)

YourHostSucks
09-29-2001, 12:30 AM
Nice feature, Now i just have to find one for what smilies show up on the front page.. :)

Thanks!

Alien
09-30-2001, 02:07 PM
Excellent job!

:D

Balbanes
09-30-2001, 02:37 PM
Nice hack Firefly!!

By any chance are you the same firefly from FFshrine BB?? If so then im Bal the FFT mod there. hehe

Admin
09-30-2001, 02:40 PM
Glad you guys like this. :)

Balbanes:
Nope, sorry. :D

YourHostSucks
09-30-2001, 02:56 PM
Its nice, but we need one to do this with smilies also... :D

Or atleast control the 15-20 that show up on the front page.

But this one works perfect, nice Job.. :)

Admin
09-30-2001, 03:02 PM
This hack was actually requested by someone that saw my first hack, this one:
http://www.vbulletin.com/forum/showthread.php?s=&threadid=25888

YourHostSucks
09-30-2001, 03:19 PM
Great! Thanks ;)

You seem to half alot of nice hacks, keep it up!

:D

Lucky
01-25-2002, 10:06 PM
Will this work in 2.2.1 just like your smilie hack?

Icheb
12-04-2002, 02:50 PM
$icons=$DB_site->query("SELECT iconid,title,iconpath FROM icon ORDER BY showid LIMIT ".($limitlower-1).",$perpage");

Only one minor addition to the code above: You also have to query the showid from the icon table, otherwise the ids will not be displayed in the Admin CP and you have to enter all of them every time you want to change the order.

Xer
12-11-2002, 01:10 PM
sorry.. it is not working on 2.2.9.
when i click "update order" no any change ..and remove all my order.

*.i am running the smile one.. it is fully Working.

Icheb
12-11-2002, 01:52 PM
As I said, change the following code in your icon.php

$icons=$DB_site->query("SELECT iconid,title,iconpath FROM icon ORDER BY showid LIMIT ".($limitlower-1).",$perpage");

to this:

$icons=$DB_site->query("SELECT iconid,title,iconpath,showid FROM icon ORDER BY showid LIMIT ".($limitlower-1).",$perpage");

It has to query the showid from the table, otherwise it can't use it.

Icheb

Xer
12-11-2002, 02:42 PM
thx Icheb!!! it is working now!!!