vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Change the display order of smilies (https://vborg.vbsupport.ru/showthread.php?t=25888)

Admin 08-19-2001 10:00 PM

Description:
This hack will allow you to set the display order of clickable smilies (if you use them).
It's good if you have a lot of smilies, and want the more commonly used to be shown in the box.

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

Installation:
1. Run the following queries either in phpMyAdmin or thru Telnet: (one query at a time)
Code:

ALTER TABLE smilie ADD showid SMALLINT not null
ALTER TABLE smilie ADD INDEX (showid)
UPDATE smilie SET showid=smilieid

2. In functions.php (in your admin folder) replace
PHP Code:

$smilies $DB_site->query("SELECT title, smilietext, smiliepath FROM smilie"); 

with
PHP Code:

$smilies $DB_site->query("SELECT title, smilietext, smiliepath FROM smilie ORDER BY showid"); 

And also replace
PHP Code:

$smilies=$DB_site->query("SELECT smilietext,smiliepath FROM smilie"); 

with
PHP Code:

$smilies=$DB_site->query("SELECT smilietext,smiliepath FROM smilie ORDER BY showid"); 

3. In smilie.php (in your admin folder) replace
PHP Code:

$smilies=$DB_site->query("SELECT smilietext,smilieid,title,smiliepath FROM smilie ORDER BY title LIMIT ".($limitlower-1).",$perpage"); 

with
PHP Code:

$smilies=$DB_site->query("SELECT smilietext,smilieid,title,smiliepath,showid FROM smilie ORDER BY showid LIMIT ".($limitlower-1).",$perpage"); 

Below
PHP Code:

echo makelinkcode("remove","smilie.php?s=$session[sessionhash]&action=remove&smilieid=$smilie[smilieid]&perpage=$perpage&statrpage=$startpage"); 

add
PHP Code:

echo "<br>Order: <input type=text name=\"order[$smilie[smilieid]]\" size=5 value=\"$smilie[showid]\">"

Replace
PHP Code:

echo "</table></td></tr></table></form>"

with
PHP Code:

doformfooter("Update order"); 

Replace
PHP Code:

doformheader("smilie","modify"); 

with
PHP Code:

doformheader("smilie","doorder"); 

Above
PHP Code:

// ###################### Start Modify ####################### 

add
PHP Code:

// ###################### Start do order #####################
if ($HTTP_POST_VARS['action']=="doorder") {

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

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

  }

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



Requested by:
JJR512

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

dxb 08-20-2001 07:47 AM

nice simple and effective .... I'll try it now :)

JJR512 08-20-2001 07:55 AM

Alright, it's done, and it's great!

You know in the other thread I was about to say that the one line replacement you had originally (which added the ORDER BY bit) didn't work. I guess there was a lot more to it, though! :D Hope it wasn't too much trouble...but I love it! Thank you! :)

Admin 08-20-2001 07:57 AM

Yeah I know JJR, I forgot to replace another line. :o

Hoffi 08-20-2001 09:13 AM

Cool Hack and it works directly.
Good work.

weezle 08-20-2001 09:40 AM

kool hack m8 ur on fire with these hacks @ the mo

Zecherieh 08-20-2001 11:27 PM

I was actually doing something similiar at the same time, but wanted random


2. In functions.php (in your admin folder) replace
PHP Code:

$smilies $DB_site->query("SELECT title, smilietext, smiliepath FROM smilie"); 

with
PHP Code:

$smilies $DB_site->query("SELECT smilieid*0+RAND() AS randcol, title, smilietext, smiliepath FROM smilie ORDER BY randcol"); 

And also replace
PHP Code:

$smilies=$DB_site->query("SELECT smilietext,smiliepath FROM smilie"); 

with
PHP Code:

$smilies=$DB_site->query("SELECT smilieid*0+RAND() AS randcol, smilietext,smiliepath FROM smilie ORDER BY randcol"); 


dost 08-21-2001 08:38 AM

Thanks FireFly, it works great!

snyx 08-21-2001 08:39 PM

omg, do I ever want this!
but I never thought of it as a hack?
THANKS MAN!

*snyx runs off to install*

snyx 08-21-2001 08:41 PM

I tired to copy paste the queries into phpmyadmin and I get errors?


All times are GMT. The time now is 07:01 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01295 seconds
  • Memory Usage 1,763KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (18)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete