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.

Avatar in the Recent Topics problem

2 posters

Go down

Solved Avatar in the Recent Topics problem

Post by Guest February 12th 2018, 6:56 pm

Technical Details

Forum version : #phpBB2
Position : Administrator
Concerned browser(s) : Google Chrome
Screenshot of problem : https://i.imgur.com/7FC1Zfq.jpg
Who the problem concerns : Yourself
Forum link : http://879htzozacipcupes.hungarianforum.net

Description of problem

Hi! I love you

I use this
https://help.forumotion.com/t137749-avatar-in-the-recent-topics#931159

here is my code

Code:
$(function(){
  var style = document.createElement('STYLE'), css = '.mini_ava2>img{height:20px;margin-right:5px;width:20px;}';
  style.type = 'text/css';
  if (style.styleSheet) style.styleSheet.cssText = css;
  else style.appendChild(document.createTextNode(css));
  document.getElementsByTagName('HEAD')[0].appendChild(style);
    
       if(!window.localStorage) return;
    
       // Default avatar
        var default_avatar= 'http://2img.net/i/fa/invision/pp-blank-thumb.png';
    
       // Time of cache 24h*60m*60s*1000ms - one day
        var caching_time= 60*1000;
    
       // Time of cache in case of error 60s*1000ms - one minute
        var caching_error= 60*1000;
    
       var set_avatar= function(id) {
            $('.mini_ava2.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= {};
    
       $('#recentTopics a[href^="/u"]').each(function(){
            to_replace[$(this).attr('href').substr(2)]= 1;
            $(this).before('<span class="mini_ava2 member'+$(this).attr('href').substr(2)+'"></span>');
        });
    
       for(i in to_replace)
        {
            set_avatar(i);
        };
    
   });

this work perfect, but this code add a avatar to my who is online (mod_whoisonline)

I dont know why, but i dont want to add avatar for mod_whoisonline
I want avatar JUST mod_recent_topics. Somebody know why? And how i can fix it?
Maybe you know, you helped me last dear @luffy
avatar
Guest
Guest


Back to top Go down

Solved Re: Avatar in the Recent Topics problem

Post by SLGray February 12th 2018, 7:06 pm

The link to your forum does not load your forum.


Avatar in the Recent Topics problem Slgray10

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

Male Posts : 50271
Reputation : 3466
Language : English
Location : United States

View user profile https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Solved Re: Avatar in the Recent Topics problem

Post by Guest February 12th 2018, 7:45 pm

avatar
Guest
Guest


Back to top Go down

Solved Re: Avatar in the Recent Topics problem

Post by SLGray February 13th 2018, 8:34 am

Thanks, but guests can not see the widgets.


Avatar in the Recent Topics problem Slgray10

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

Male Posts : 50271
Reputation : 3466
Language : English
Location : United States

View user profile https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Solved Re: Avatar in the Recent Topics problem

Post by Guest February 13th 2018, 1:40 pm

Now is active. I hope you can help me. I am sorry but i forget. I hope you see everything and can u help me :S
I am so lost.. and i don't understand what is the problem.
avatar
Guest
Guest


Back to top Go down

Solved Re: Avatar in the Recent Topics problem

Post by Guest February 13th 2018, 2:00 pm

problem is Solved.
avatar
Guest
Guest


Back to top Go down

Solved Re: Avatar in the Recent Topics problem

Post by brandon_g February 13th 2018, 2:32 pm

May you post what the solution was?

-Brandon


Avatar in the Recent Topics problem Brando10
Remember to mark your topic Avatar in the Recent Topics problem Solved15 when a solution is found.
General Rules | Tips & Tricks | FAQ | Forgot Founder Password?

Avatar in the Recent Topics problem Scre1476
Team Leader
Review Section Rules | Request A Review | Sticker Points
brandon_g
brandon_g
Manager
Manager

Male Posts : 9875
Reputation : 903
Language : English
Location : USA

View user profile https://www.broadcastingduo.com

Back to top Go down

Solved Re: Avatar in the Recent Topics problem

Post by Guest February 14th 2018, 5:13 pm

Dear @brandon_g Avatar in the Recent Topics problem 1f601
I add
Code:
</div>
for mod_whoisonline begining. And it closed, and dont show avatar in mod_whoisonline. cheers

So the problem is Solved.
avatar
Guest
Guest


Back to top Go down

Solved Re: Avatar in the Recent Topics problem

Post by brandon_g February 14th 2018, 5:45 pm

Thanks for posting the solution. Smile

Topic solved and archived ~ brandon_g
Please read our forum rules: ESF General Rules


Avatar in the Recent Topics problem Brando10
Remember to mark your topic Avatar in the Recent Topics problem Solved15 when a solution is found.
General Rules | Tips & Tricks | FAQ | Forgot Founder Password?

Avatar in the Recent Topics problem Scre1476
Team Leader
Review Section Rules | Request A Review | Sticker Points
brandon_g
brandon_g
Manager
Manager

Male Posts : 9875
Reputation : 903
Language : English
Location : USA

View user profile https://www.broadcastingduo.com

Back to top Go down

Back to top

- Similar topics

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