Page 1 of 1

:Solved: Need help disabling smileys

Posted: Sun Oct 04, 2009 3:52 pm
by Philthy
One for the phpbb gurus :geek:
I'm running a mobile theme for my forum, and have a problem with the smilies appearing larger than they should.
I would like to simply disable them. I can of course disable smilies in the admin control panel, but that would get rid of them for every user. I have a small piece of code that apparently disables them, but have no idea which file, or where to place it.
Has anyone got any idea?
Here's the code:

Code: Select all

$config['allow_smilies'] = 0;
Thanks in advance

Re: Need help disabling smileys

Posted: Mon Oct 05, 2009 11:10 pm
by prototech
In includes/functions_content.php, find:

Code: Select all

    if ($force_option || !$config['allow_smilies'] || !$user->optionget('viewsmilies')) 
Before, add:

Code: Select all

    $check_style = ($config['override_user_style']) ? $config['default_style'] : $user->data['user_style'];

    if ($check_style == 1)
    {
        $config['allow_smilies'] = 0;
    }
 
Adjust "1" to match the style's id.

Re: Need help disabling smileys

Posted: Fri Oct 09, 2009 12:05 pm
by Philthy
It didn't work.
I tried emptying the cache, and refreshing the template/theme, but the smilies were still showing?

Thanks for your post though.

Edit to add:

Strange, it works if I set it to style 1, The smilies are replaced by the code for them, but not for style 2, the mobile theme I'm trying to disable them from?

Hmmmmm

Re: Need help disabling smileys

Posted: Fri Oct 09, 2009 12:29 pm
by Philthy
Even odder, I set it to style 1, and checked on my iphone, which is set to switch to the mobile theme automatically, and they didn't display.

This code in session.php sets the mobile theme:

Code: Select all

          $user_browser = strtolower($this->browser);
          $this->data['is_mobile'] = false;
          $browsers_array = array('240x320', '320x240','blackberry', 'iemobile', 'minimobile', 'mobile', 'opera mini', 'pda', 'phone', 'pocket', 'psp', 'symbian', 't-shark', 'wireless');
          foreach ($browsers_array as $ua_match)
          {
             if (strpos($user_browser, $ua_match) !== false)
             {
                $style = 2;
                $this->data['is_mobile'] = true;
                break;
             }
          }
Somehow, it isn't communicating the style switchover?

Re: Need help disabling smileys

Posted: Fri Oct 09, 2009 4:31 pm
by prototech
Change:

Code: Select all

    $check_style = ($config['override_user_style']) ? $config['default_style'] : $user->data['user_style'];

    if ($check_style == 1)
    {
        $config['allow_smilies'] = 0;
    }
 
To:

Code: Select all

    if ($user->data['is_mobile'])
    {
        $config['allow_smilies'] = 0;
    }
 

Re: Need help disabling smileys

Posted: Fri Oct 09, 2009 5:12 pm
by Philthy
Thanks for that, I'll give it a try when I get home.

Re: Need help disabling smileys

Posted: Fri Oct 09, 2009 5:34 pm
by Philthy
That has worked :D
Thanks very much.

Re: :Solved: Need help disabling smileys

Posted: Mon Feb 01, 2010 4:56 pm
by Captain Jim
I'm running the same mobile forums and this worked perfectly.

THANKS!!! I was really struggling with this, and the solution was so simple. :mrgreen: