Feature #579

{theme} usable in smileys

Added by bosit man over 2 years ago. Updated over 2 years ago.

Status:Rejected Start date:12/09/2009
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:-
Target version:-

Description

Since myBB already has this feature for usergroup stars, I believe it would be really nice to have it for smileys too. Especially in dark themes, having the same "white" theme smileys looks pretty bad. Plus it looks like a fairly easy implementation. With this modification, you will be able to use {theme} in the smileys image path (e.g. {theme}/smilies/wacko.gif) just like you do with User Group stars.

I got this code from a thread in the myBB forums in the User Submitted Tutorials but can't find it anymore so sorry for not giving credits where it's due. Works perfectly for me.

Known bug: Smileys with {theme} will NOT display in the Admin CP (the preview). I guess this is easily fixable with some Admin CP changes

@Okay, firstly, open up /inc/class_parser.php,
Find:
PHP Code:

global $cache;
$this->smilies_cache = array();
$smilies = $cache->read("smilies");
if(is_array($smilies)) {
foreach($smilies as $sid => $smilie) {
$this->smilies_cache[$smilie['find']] = "<img src=\"{$this->base_url}{$smilie['image']}\" style=\"vertical-align: middle;\" border=\"0\" alt=\"{$smilie['name']}\" title=\"{$smilie['name']}\" />";

Replace with:
PHP Code:

global $cache, $theme;
$this->smilies_cache = array();
$smilies = $cache->read("smilies");
if(is_array($smilies)) {
foreach($smilies as $sid => $smilie) {
$smilie['image'] = str_replace('{theme}', $theme['imgdir'], $smilie['image']);
$this->smilies_cache[$smilie['find']] = "<img src=\"{$this->base_url}{$smilie['image']}\" style=\"vertical-align: middle;\" border=\"0\" alt=\"{$smilie['name']}\" title=\"{$smilie['name']}\" />";

Also, open up misc.php,
Find: (2 occurances)
PHP Code:

$smilie['find'] = htmlspecialchars_uni($smilie['find']);

Add below: (2 occurances)
PHP Code:

$smilie['image'] = str_replace('{theme}', $theme['imgdir'], $smilie['image']);

Finally, open up inc/functions.php,
Find:
PHP Code:

$smiliecache[$smilie['find']] = $smilie['image'];

Replace with:
PHP Code:

$smiliecache[$smilie['find']] = str_replace('{theme}', $theme['imgdir'], $smilie['image']);@

History

#1 Updated by Stefan T. over 2 years ago

  • Status changed from New to Rejected

Please do not request new features here.
http://ideas.mybboard.net/

#2 Updated by bosit man over 2 years ago

Sorry didn't know. Thanks for informing. I guess the feature selection should be for staff only then?

#3 Updated by Tom Moore over 2 years ago

bosit man wrote:

Sorry didn't know. Thanks for informing. I guess the feature selection should be for staff only then?

Yes it should. We're working on fixing up the little issues on this site...

Also available in: Atom PDF