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

3 posters

Go down

Avatar in the Recent Topics Empty Avatar in the Recent Topics

Post by the_rocketeer April 29th 2017, 8:51 am

Hi!

I used this tutorial by @ange tuteur and I would like to know If it's possible to put the avatar somewhere else below recent topics. Avatar in the Recent Topics 1f60d
Forum version: phpBB2 ^^
the_rocketeer
the_rocketeer
Forumember

Other / Decline to state Posts : 88
Reputation : 4
Language : English
Location : Europe

http://love-you-hogwarts.bulgarianforum.net/

Back to top Go down

Avatar in the Recent Topics Empty Re: Avatar in the Recent Topics

Post by SLGray April 29th 2017, 7:13 pm

Where would you like them?


Avatar in the Recent Topics 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 : 51576
Reputation : 3525
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Avatar in the Recent Topics Empty Re: Avatar in the Recent Topics

Post by the_rocketeer April 29th 2017, 7:38 pm

Hey SLGray!

I really would like to put them near the text (for exaple: click)
Is it possible? Avatar in the Recent Topics 1f60a
the_rocketeer
the_rocketeer
Forumember

Other / Decline to state Posts : 88
Reputation : 4
Language : English
Location : Europe

http://love-you-hogwarts.bulgarianforum.net/

Back to top Go down

Avatar in the Recent Topics Empty Re: Avatar in the Recent Topics

Post by SLGray April 29th 2017, 9:24 pm

So you do not want to place them in a different place on the forum, but change where they are in the latest topic column?


Avatar in the Recent Topics 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 : 51576
Reputation : 3525
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Avatar in the Recent Topics Empty Re: Avatar in the Recent Topics

Post by the_rocketeer May 1st 2017, 2:24 pm

Exactly! Avatar in the Recent Topics 1f60d
the_rocketeer
the_rocketeer
Forumember

Other / Decline to state Posts : 88
Reputation : 4
Language : English
Location : Europe

http://love-you-hogwarts.bulgarianforum.net/

Back to top Go down

Avatar in the Recent Topics Empty Re: Avatar in the Recent Topics

Post by Guest May 1st 2017, 2:49 pm

Please post your forum's link.
avatar
Guest
Guest


Back to top Go down

Avatar in the Recent Topics Empty Re: Avatar in the Recent Topics

Post by SarkZKalie May 1st 2017, 5:25 pm

Search and remove this line in your index_box template
Code:
<div style="width: 200px;"></div>
And you should merge Topis and Posts in one row, will save more space for Last Posts.


Avatar in the Recent Topics Sarkzk10
SarkZKalie
SarkZKalie
Support Moderator
Support Moderator

Male Posts : 1447
Reputation : 220
Language : English

https://rotavn.forumotion.com/

Back to top Go down

Avatar in the Recent Topics Empty Re: Avatar in the Recent Topics

Post by the_rocketeer May 1st 2017, 6:49 pm

Hi Wolfuryo!

Forum link: click
the_rocketeer
the_rocketeer
Forumember

Other / Decline to state Posts : 88
Reputation : 4
Language : English
Location : Europe

http://love-you-hogwarts.bulgarianforum.net/

Back to top Go down

Avatar in the Recent Topics Empty Re: Avatar in the Recent Topics

Post by Guest May 1st 2017, 7:04 pm

Did @SarkZKalie's solution solved your problem?

EDIT:Replace the JS code you use with this one:
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= 24*60*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).parent().before('<span class="mini_ava2 member'+$(this).attr('href').substr(2)+'"></span>');
                });
           
              for(i in to_replace)
                {
                    set_avatar(i);
                };
           
          });
Add this code to your css:
Code:
div#recentTopics>table>tbody>tr>td.row1>*{
display:inline-table;
}
div#recentTopics>table>tbody>tr>td.row1>span.gensmall{
width:80%;
}
div#recentTopics>table>tbody>tr>td.row1>span.mini_ava2{
position:relative;
vertical-align:middle;
top:13px;
}
avatar
Guest
Guest


Back to top Go down

Avatar in the Recent Topics Empty Re: Avatar in the Recent Topics

Post by the_rocketeer May 1st 2017, 7:49 pm

No because he is talking about last post but I need help in customizing Recent topics/Latest topics widget.
the_rocketeer
the_rocketeer
Forumember

Other / Decline to state Posts : 88
Reputation : 4
Language : English
Location : Europe

http://love-you-hogwarts.bulgarianforum.net/

Back to top Go down

Avatar in the Recent Topics Empty Re: Avatar in the Recent Topics

Post by the_rocketeer May 1st 2017, 8:10 pm

I used the codes and this happend: click :/
the_rocketeer
the_rocketeer
Forumember

Other / Decline to state Posts : 88
Reputation : 4
Language : English
Location : Europe

http://love-you-hogwarts.bulgarianforum.net/

Back to top Go down

Avatar in the Recent Topics Empty Re: Avatar in the Recent Topics

Post by the_rocketeer May 4th 2017, 12:58 pm

Up!

I still need help Avatar in the Recent Topics 1f60a
the_rocketeer
the_rocketeer
Forumember

Other / Decline to state Posts : 88
Reputation : 4
Language : English
Location : Europe

http://love-you-hogwarts.bulgarianforum.net/

Back to top Go down

Avatar in the Recent Topics Empty Re: Avatar in the Recent Topics

Post by the_rocketeer May 13th 2017, 8:34 am

Another issue: when I log out only default avatar shows up :/ click

java:
Code:
  $(function(){
  var style = document.createElement('STYLE'), css = '.mini_ava2>img{object-fit: cover;object-position: 50% 25%;border-radius: 100%;margin-right: 5px;height: 30px;margin-right: 5px;width: 30px;margin-top: -2px;float: left;}';
  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 60s*1000ms - one day
        var caching_time= 1*1000;
   
      // Time of cache in case of error 60s*1000ms - one minute
        var caching_error= 1*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);
        };
   
  });
the_rocketeer
the_rocketeer
Forumember

Other / Decline to state Posts : 88
Reputation : 4
Language : English
Location : Europe

http://love-you-hogwarts.bulgarianforum.net/

Back to top Go down

Avatar in the Recent Topics Empty Re: Avatar in the Recent Topics

Post by Guest May 13th 2017, 8:49 am

This happens because guests cannot view profiles on your forum, so the code cannot get the avatar.
avatar
Guest
Guest


Back to top Go down

Avatar in the Recent Topics Empty Re: Avatar in the Recent Topics

Post by the_rocketeer May 13th 2017, 9:47 am

Now guest can see the profile too but avatars still don't work in Google Chrome. Any other ideas?Avatar in the Recent Topics 1f614
the_rocketeer
the_rocketeer
Forumember

Other / Decline to state Posts : 88
Reputation : 4
Language : English
Location : Europe

http://love-you-hogwarts.bulgarianforum.net/

Back to top Go down

Back to top

- Similar topics

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