• Login
  • Register
  • Login Register
    Login
    Username:
    Password:
  • Home
  • Members
  • Team
  • Help
  • More
    • Link 1
    • Link 2
    • Link 3
User Links
  • Login
  • Register
  • Login Register
    Login
    Username:
    Password:

    Quick Links Home Members Team Help
    More Link 1 Link 2 Link 3




    D&D Forums - MyBB Plugins & Themes MyBB General Discussions Tricks & Tutorials Fix Empty Default Avatar

     
    • 0 Vote(s) - 0 Average
    Fix Empty Default Avatar
    AmazOuz
    Offline

    Administrator

    Posts: 272
    Threads: 34
    Joined: Oct 2017
    Reputation: 11
    #1
    12-31-2018, 09:05 PM
    Hello everyone Smile

    Some of you use the avatar image source code {$mybb->user['avatar']} in a user header menu, but there is no image when user has the default MyBB avatar.

    Here are two ways how you can fix it.

    1.) Download my "MyBB Default Avatar Fix" plugin from here and include it into your theme package.

    or

    2) Include the small function into your own theme plugin:

    PHP Code:
    // defaultavatarfix function by SvePu (http://community.mybb.com/user-91011.html) //
    function defaultavatarfix()
    {
        global 
    $mybb;

        if(!
    $mybb->user['avatar'] && !empty($mybb->settings['useravatar']))
        {
            
    $mybb->user['avatar'] = $mybb->settings['useravatar'];
        }
    }
    $plugins->add_hook("global_intermediate", "defaultavatarfix"); 


    Credits : https://community.mybb.com/thread-166660.html
    « Next Oldest | Next Newest »

    Users browsing this thread: 1 Guest(s)



    • View a Printable Version
    • Subscribe to this thread
    Forum Jump:

    Company Name

    Home · Members · Team · Help · Contact

    © Designed by D&D - Powered by MyBB

    15 Yellow Road Lyon, France

    +1 555 123456

    business@example.com

    About the company Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

    Linear Mode
    Threaded Mode