The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

change the unknown avatar picture

View previous topic View next topic Go down

Solved change the unknown avatar picture

Post by iyaaz on March 8th 2014, 12: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://illiweb.com/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
avatar
iyaaz
Forumember

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

http://iyaaz.forumotion.co.uk/

Back to top Go down

Solved Re: change the unknown avatar picture

Post by Pizza Boi on March 8th 2014, 12: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
avatar
Pizza Boi
Hyperactive

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

http://redlustempire.forumtl.com/

Back to top Go down

Solved Re: change the unknown avatar picture

Post by iyaaz on March 8th 2014, 1:31 pm

Solved by Pizza Boi, thank you! ----)  :wouhou: 
avatar
iyaaz
Forumember

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

http://iyaaz.forumotion.co.uk/

Back to top Go down

Solved Re: change the unknown avatar picture

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

Hi Very Happy

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

No problem~

Regards,
Pizza Boi
avatar
Pizza Boi
Hyperactive

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

http://redlustempire.forumtl.com/

Back to top Go down

Solved Re: change the unknown avatar picture

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

Problem solved & topic archived.


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

avatar
SLGray
Administrator
Administrator

Male Posts : 40514
Reputation : 2733
Language : English
Location : United States

https://fmthemes.forumotion.com/

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum