TinyPortal

Development => Resources => Modules => Topic started by: brianjw on August 21, 2008, 12:14:20 AM

Title: TP Shout shows too many smileys!
Post by: brianjw on August 21, 2008, 12:14:20 AM
Hi, I used to use TP Adv shout but my members used NONE of it so I just went to the easy manageable TP Shout module. TP Adv Shout only showed the simple smileys such as the ones on this site. However TP Shout shows those and then shows ALL the other smileys I have which is too many to display on a shoutbox. Let's just say when you click the expand icon, you have to scroll down to see the shout form and shoutbox. How would I make it so it only shows these smileys:

'smileys' => array(
array('code' => ':)', 'filename' => 'smiley.gif', 'description' => $txt[287]),
array('code' => ';)', 'filename' => 'wink.gif', 'description' => $txt[292]),
array('code' => ':D', 'filename' => 'cheesy.gif', 'description' => $txt[289]),
array('code' => ';D', 'filename' => 'grin.gif', 'description' => $txt[293]),
array('code' => '>:(', 'filename' => 'angry.gif', 'description' => $txt[288]),
array('code' => ':(', 'filename' => 'sad.gif', 'description' => $txt[291]),
array('code' => ':o', 'filename' => 'shocked.gif', 'description' => $txt[294]),
array('code' => '8)', 'filename' => 'cool.gif', 'description' => $txt[295]),
array('code' => '???', 'filename' => 'huh.gif', 'description' => $txt[296]),
array('code' => '::)', 'filename' => 'rolleyes.gif', 'description' => $txt[450]),
array('code' => ':P', 'filename' => 'tongue.gif', 'description' => $txt[451]),
array('code' => ':-[', 'filename' => 'embarrassed.gif', 'description' => $txt[526]),
array('code' => ':-X', 'filename' => 'lipsrsealed.gif', 'description' => $txt[527]),
array('code' => ':-\\', 'filename' => 'undecided.gif', 'description' => $txt[528]),
array('code' => ':-*', 'filename' => 'kiss.gif', 'description' => $txt[529]),
array('code' => ':\'(', 'filename' => 'cry.gif', 'description' => $txt[530])
),

That's just the code from TPShout.php that shows the ONLY smileys I want to appear above the shoutbox. None others!

Please let me know how I would go about doing something like this thanks. :)
Title: Re: TP Shout shows too many smileys!
Post by: brianjw on September 01, 2008, 09:45:12 PM
Any ideas??
Title: Re: TP Shout shows too many smileys!
Post by: IchBin on September 01, 2008, 10:04:10 PM
If you look right under that code you just posted from the TPShout.php file you'll see where the rest of the smileys are called from. Just remove the code.

elseif ($user_info['smiley_set'] != 'none')
{
if (($temp = cache_get_data('posting_smileys', 480)) == null)
{
$request = db_query("
SELECT code, filename, description, smileyRow, hidden
FROM {$db_prefix}smileys
WHERE hidden IN (0, 2)
ORDER BY smileyRow, smileyOrder", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))
{
$row['code'] = htmlspecialchars($row['code']);
$row['filename'] = htmlspecialchars($row['filename']);
$row['description'] = htmlspecialchars($row['description']);

$context['smileys'][empty($row['hidden']) ? 'postform' : 'popup'][$row['smileyRow']]['smileys'][] = $row;
}
mysql_free_result($request);

cache_put_data('posting_smileys', $context['smileys'], 480);
}
else
$context['smileys'] = $temp;
}
Title: Re: TP Shout shows too many smileys!
Post by: brianjw on September 01, 2008, 10:11:08 PM
When I removed that code, NO smileys showed. And the expand/collapse button still showed but with no smileys...
Title: Re: TP Shout shows too many smileys!
Post by: bloc on September 01, 2008, 10:17:15 PM
You need that code...but you could set a limit to it, forcing it to only fetch 15-16 smileys there. Depending on how the order are on the installed ones you should get the original ones first.
This code:

$request = db_query("
SELECT code, filename, description, smileyRow, hidden
FROM {$db_prefix}smileys
WHERE hidden IN (0, 2)
ORDER BY smileyRow, smileyOrder", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))


needs to be:

$request = db_query("
SELECT code, filename, description, smileyRow, hidden
FROM {$db_prefix}smileys
WHERE hidden IN (0, 2)
ORDER BY smileyRow, smileyOrder LIMIT 16", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))


Title: Re: TP Shout shows too many smileys!
Post by: IchBin on September 01, 2008, 10:18:34 PM
Hmm... for some reason I totally read that code wrong.  :idiot2:
Title: Re: TP Shout shows too many smileys!
Post by: brianjw on September 01, 2008, 10:22:59 PM
Thanks that worked great :)
I also removed the [more] link because when I did 16 it showed only like 14 smileys and 2 were in the [more] popup. So I removed the [more] popup link and then just changed 16 to 18 and it works perfect. :)