PDA

View Full Version : Change the display order of message icons


Chen
21 Aug 2001, 09:06
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
21 Aug 2001, 10:29
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.

Chen
21 Aug 2001, 10:41
Thanks man. :)

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

Thanks!

Alien
30 Sep 2001, 16:07
Excellent job!

:D

Balbanes
30 Sep 2001, 16:37
Nice hack Firefly!!

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

Chen
30 Sep 2001, 16:40
Glad you guys like this. :)

Balbanes:
Nope, sorry. :D

YourHostSucks
30 Sep 2001, 16:56
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.. :)

Chen
30 Sep 2001, 17:02
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
30 Sep 2001, 17:19
Great! Thanks ;)

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

:D

Lucky
26 Jan 2002, 00:06
Will this work in 2.2.1 just like your smilie hack?

Icheb
04 Dec 2002, 16:50
$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
11 Dec 2002, 15:10
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
11 Dec 2002, 15:52
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
11 Dec 2002, 16:42
thx Icheb!!! it is working now!!!