change the unknown avatar picture Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.
3 posters

    change the unknown avatar picture

    iyaaz
    iyaaz
    Forumember


    Male Posts : 350
    Reputation : 8
    Language : English
    Location : London

    Solved change the unknown avatar picture

    Post by iyaaz March 8th 2014, 3:04 pm

    i'm trying to change the unknown avatar picture to an image of my own for some reason it's not changing



    Code:
               $(function(){
                
                   if(!window.localStorage) return;
                
                   // Avatar by default
                    var default_avatar= 'http://2img.net/i/fa/invision/pp-blank-thumb.png';
                
                   // Time of cache, here : 24hrs * 60m * 60s * 1000ms so one day
                    var caching_time= 24*60*60*1000;
                
                   // Time of cache in case of error, here : 60s * 1000ms so one minute
                    var caching_error= 60*1000;
                
                   var set_avatar= function(id) {
                        $('.mini_ava.member'+id).html('<img src="'+get_avatar(id)+'" />');
                    };
                
                   var get_avatar= function(id) {
                        if(localStorage.getItem('t_ava'+id) < +new Date - caching_time || (localStorage.getItem('d_ava'+id)==default_avatar && localStorage.getItem('t_ava'+id) < +new Date - caching_error))
                        {
                            localStorage.setItem('d_ava'+id, default_avatar);
                            $.get('/u'+id, function (d){
                                localStorage.setItem('t_ava'+id,+new Date);
                                localStorage.setItem('d_ava'+id, $('#profile-advanced-right .module:first div img:first,.forumline td.row1.gensmall:first > img, .frm-set.profile-view.left dd img,dl.left-box.details:first dd img, .row1 b .gen:first img, .real_avatar img',d).first().attr('src')||default_avatar);
                                set_avatar(id);
                            });
                        }
                        return localStorage.getItem('d_ava'+id);
                    };
                
                   var to_replace= {};
                
                   $('dd.lastpost strong a.gensmall, .ipbtable tr td:last-child span strong a.gensmall, .table td.tcr strong a.gensmall, .forumline .row3.over strong a.gensmall').each(function(){
                        to_replace[$(this).attr('href').substr(2)]= 1;
                        $(this).closest('td,dd').prepend('<div class="mini_ava member'+$(this).attr('href').substr(2)+'"></div>');
                    });
                
                   for(i in to_replace)
                    {
                        set_avatar(i);
                    };
                
               });

    PunBB
    Pizza Boi
    Pizza Boi
    Hyperactive


    Male Posts : 2016
    Reputation : 160
    Language : French
    Location : Pizza Hut!

    Solved Re: change the unknown avatar picture

    Post by Pizza Boi March 8th 2014, 3:28 pm

    Hi Very Happy

    Why don't you try this instead?

    ACP < Display < Avatar Management < Avatars Management < Copy the links and upload the photo for unknown < Make sure you clicked "Define as default avatar"

    It would be easier.

    Regards,
    Pizza Boi
    iyaaz
    iyaaz
    Forumember


    Male Posts : 350
    Reputation : 8
    Language : English
    Location : London

    Solved Re: change the unknown avatar picture

    Post by iyaaz March 8th 2014, 4:31 pm

    Solved by Pizza Boi, thank you! ----)  :wouhou: 
    Pizza Boi
    Pizza Boi
    Hyperactive


    Male Posts : 2016
    Reputation : 160
    Language : French
    Location : Pizza Hut!

    Solved Re: change the unknown avatar picture

    Post by Pizza Boi March 8th 2014, 7:46 pm

    Hi Very Happy

    The pizza's here! That'd be 2.99$ Wink.

    No problem~

    Regards,
    Pizza Boi
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51497
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: change the unknown avatar picture

    Post by SLGray March 8th 2014, 11:10 pm

    Problem solved & topic archived.



    change the unknown avatar picture Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.