Previous Thread
Next Thread
Print Thread
Rate Thread
#225546 09/28/2002 6:39 PM
Joined: Aug 2002
Posts: 1,191
Kahuna
Kahuna
Joined: Aug 2002
Posts: 1,191
Mod Name / Version Graemlins Sort Order 1.0
Description Allows you to sort the order on which the graemlins are shown in the post screens. Also it helps in decoding the graemlin codes.
Working under UBB.threads 6.1
Any pre-requisites None
Author(s) dimopoulos
Credits ubbdev.com who taught me how to do things in php and ubb threads
Demo None.
Files Altered admin/menu.php, ubbt.inc.php, optionally ubbt_instant_ubbcode.tmpl
Database Altered Yes
New Files dochangegrmorder.php, changegrmorder.php
Any other info Please report any problems you might have and I'll try to fix them as soon as possible. Sorry but I have tested this only in version 6.1.


INSTALL
Step 1
Open the file ubbt.inc.php

Step 1.1: Find a line that looks like this (at line 600):
code:

// Convert the smileys
// First grab all smileys out of the database
$query = "
SELECT G_Code,G_Smiley,G_Image
FROM {$config['tbprefix']}Graemlins
ORDER BY G_Smiley
";



And change it to this (we are adding an ORDER BY statement in the query)
code:

// Convert the smileys
// First grab all smileys out of the database
$query = "
SELECT G_Code,G_Smiley,G_Image
FROM {$config['tbprefix']}Graemlins
ORDER BY G_Location DESC
";



Step 1.2: Then find this line (around line 700):
code:

// Convert the smileys
// First grab all smileys out of the database
$query = "
SELECT G_Code,G_Smiley,G_Image
FROM {$config['tbprefix']}Graemlins
ORDER BY G_Smiley
";



And change it to this (we are adding an ORDER BY statement in the query)
code:

// Convert the smileys
// First grab all smileys out of the database
$query = "
SELECT G_Code,G_Smiley,G_Image
FROM {$config['tbprefix']}Graemlins
ORDER BY G_Location DESC
";



Step 1.3: Then find this line (around line 1640):
code:

// --------------------------------------------------
// We need to grab all of the graemlins out of the db
$query = "
SELECT G_Code,G_Smiley,G_Image
FROM {$config['tbprefix']}Graemlins
";



And change it to this (we are adding an ORDER BY statement in the query)
code:

// --------------------------------------------------
// We need to grab all of the graemlins out of the db
$query = "
SELECT G_Code,G_Smiley,G_Image
FROM {$config['tbprefix']}Graemlins
ORDER BY G_Location
";




Step 2
Open up the file admin/menu.php and do the following:

Step 2.1: Find these lines (around line 320):
code:

<br>
<a href="{$config['phpurl']}/admin/removegraemlin.php?Cat=$Cat" target="mainFrame">Remove a graemlin</a>
<br>



And ADD the following AFTER:
code:

<a href="{$config['phpurl']}/admin/changegrmorder.php?Cat=$Cat" target="mainFrame">Sort graemlins order</a>
<br>



Step 3
Upload the files changegrmorder.php and dochangegrmorder.php in your admin folder


Step 4
Run phpMyAdmin and change the Graemlins table (usually w3t_Graemlins) by adding the following field
code:

G_Location INT(11) NULL DEFAULT = 0 (this is zero and not the letter 'O')



the sql script to do so is:
code:

ALTER TABLE `w3t_graemlins` ADD `G_Location` INT( 11 ) DEFAULT '0'



The INT(11) is optional. I think a normal INT will suffice.


OPTIONAL STEP

Step 5
The way the post screens are sructured, the graemlins might push down the 'Submit' button. Hence we can
modify that page to show on two lines the UBB codes, the colors on the next line and below all the
graemlins. This saves space (see attached screenshot)

Step 5.1
Open the ubbt_instant_ubbcode.tmpl and find this (around line 180):
code:

</script>



and CHANGE EVERYTHING below it to this:
code:

<table border="1">
<tr class="tdheader">
<td>
<b>{$ubbt_lang['INST_UBB']}</b>
</td>
</tr>
</table>
<table border="1">
<tr>
<td valign="top" align="left" nowrap="nowrap" class="darktable">
<a href="javascript: x()" onclick="DoPrompt('url');">{$ubbt_lang['J_HYPER']}</a>
</td>
<td class="darktable">
<a href="javascript: x()" onclick="DoPrompt('email');">{$ubbt_lang['J_EMAIL']}</a>
</td>
<td class="darktable">
<a href="javascript: x()" onclick="DoPrompt('image');">{$ubbt_lang['J_IMAGE']}</a>
</td>
<td class="darktable">
<a href="javascript: x()" onclick="DoPrompt('liststart');">{$ubbt_lang['J_LISTSTART']}</a>
</td>
<td class="darktable">
<a href="javascript: x()" onclick="DoPrompt('listitem');">{$ubbt_lang['J_LISTITEM']}</a>
</td>
<td class="darktable">
<a href="javascript: x()" onclick="DoPrompt('listend');">{$ubbt_lang['J_LISTEND']}</a>
</td>
<td class="darktable">
<a href="javascript: x()" onclick="DoPrompt('bold');">{$ubbt_lang['J_BOLD']}</a>
</td>
</tr>
<tr>
<td class="darktable">
<a href="javascript: x()" onclick="DoPrompt('pollstart');">{$ubbt_lang['J_POLLSTART']}</a>
</td>
<td class="darktable">
<a href="javascript: x()" onclick="DoPrompt('polloption');">{$ubbt_lang['J_POLLOPTION']}</a>
</td>
<td class="darktable">
<a href="javascript: x()" onclick="DoPrompt('pollstop');">{$ubbt_lang['J_POLLSTOP']}</a>
</td>
<td class="darktable">
<a href="javascript: x()" onclick="DoPrompt('italics');">{$ubbt_lang['J_ITALICS']}</a>
</td>
<td class="darktable">
<a href="javascript: x()" onclick="DoPrompt('underline');">{$ubbt_lang['J_UNDERLINE']}</a>
</td>
<td class="darktable">
<a href="javascript: x()" onclick="DoPrompt('quote');">{$ubbt_lang['J_QUOTE']}</a>
</td>
<td class="darktable">
<a href="javascript: x()" onclick="DoPrompt('code');">{$ubbt_lang['J_CODE']}</a>
</td>
</tr>
</table>
<table border="1">
<tr class="tdheader">
<td>
<b>{$ubbt_lang['FONT_COLOR']}</b>
</td>
<td bgcolor="red">
<a href="javascript: x()" onclick="DoColor('red');">    </a>
</td>
<td bgcolor="green">
<a href="javascript: x()" onclick="DoColor('green');">    </a>
</td>
<td bgcolor="blue">
<a href="javascript: x()" onclick="DoColor('blue');">    </a>
</td>
<td bgcolor="white">
<a href="javascript: x()" onclick="DoColor('white');">    </a>
</td>
<td bgcolor="orange">
<a href="javascript: x()" onclick="DoColor('orange');">    </a>
</td>
<td bgcolor="yellow">
<a href="javascript: x()" onclick="DoColor('yellow');">    </a>
</td>
<td bgcolor="black">
<a href="javascript: x()" onclick="DoColor('black');">    </a>
</td>
<td bgcolor="purple">
<a href="javascript: x()" onclick="DoColor('purple');">    </a>
</td>
<td bgcolor="pink">
<a href="javascript: x()" onclick="DoColor('pink');">    </a>
</td>
<td bgcolor="brown">
<a href="javascript: x()" onclick="DoColor('brown');">    </a>
</td>
<td bgcolor="#666666">
<a href="javascript: x()" onclick="DoColor('#666666');">    </a>
</td>
<td>
<a href="javascript: x()" onclick="DoPrompt('color');">?</a>
</td>
</tr>
</table>
<table border="1">
<tr class="tdheader">
<td>
<b>{$ubbt_lang['INST_GRAEMLIN']}</b>
</td>
</tr>
</table>
<table border="1">
<tr>
<tr>
<td valign="top" align="left">
$graemlinlist
</td>
</tr>
</table>



Bare in mind that I have applied the Underline UBB Code Hack on the template. Hence you can see the
code:

<td class="darktable">
<a href="javascript: x()" onclick="DoPrompt('underline');">{$ubbt_lang['J_UNDERLINE']}</a>
</td>


which you might not have in your original template. Please remove if you haven't applied the Underline UBB Code Hack.

Step 5.2
Open the ubbt_inc.php and find this (around line 1830):
code:

$i++;
if ($i==6) {
$i=0;
$graemlinlist .= "<br />";
}



and replace everything below it with (we are commenting out the <BR> every 6 graemlins:
code:

// $i++;
// if ($i==6) {
// $i=0;
// $graemlinlist .= "<br />";
// }



Warm regards

Nikos
Attachments
57890-Graemlins_Sort_Order_1_0.zip (0 Bytes, 37 downloads)


Nikos
Sponsored Links
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Cool!

This is much needed.

Thanks!

Joined: Aug 2002
Posts: 1,191
Kahuna
Kahuna
Joined: Aug 2002
Posts: 1,191
No problem Josh. I only hope that this is useful to all and will not cause any major problems since it is my first try for a hack

Warm regards

Nikos


Nikos
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)