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.
The forum of the forums
3 posters

    Avatar in the Recent Topics

    the_rocketeer
    the_rocketeer
    Forumember


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

    Avatar in the Recent Topics Empty Avatar in the Recent Topics

    Post by the_rocketeer Sat Apr 29, 2017 7: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 ^^
    SLGray
    SLGray
    Administrator
    Administrator


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

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

    Post by SLGray Sat Apr 29, 2017 6: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.
    the_rocketeer
    the_rocketeer
    Forumember


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

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

    Post by the_rocketeer Sat Apr 29, 2017 6: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
    SLGray
    SLGray
    Administrator
    Administrator


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

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

    Post by SLGray Sat Apr 29, 2017 8: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.
    the_rocketeer
    the_rocketeer
    Forumember


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

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

    Post by the_rocketeer Mon May 01, 2017 1:24 pm

    Exactly! Avatar in the Recent Topics 1f60d
    avatar
    Guest
    Guest


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

    Post by Guest Mon May 01, 2017 1:49 pm

    Please post your forum's link.
    SarkZKalie
    SarkZKalie
    Support Moderator
    Support Moderator


    Male Posts : 1442
    Reputation : 220
    Language : English

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

    Post by SarkZKalie Mon May 01, 2017 4: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
    the_rocketeer
    the_rocketeer
    Forumember


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

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

    Post by the_rocketeer Mon May 01, 2017 5:49 pm

    Hi Wolfuryo!

    Forum link: click
    avatar
    Guest
    Guest


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

    Post by Guest Mon May 01, 2017 6: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;
    }
    the_rocketeer
    the_rocketeer
    Forumember


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

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

    Post by the_rocketeer Mon May 01, 2017 6: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

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

    Post by the_rocketeer Mon May 01, 2017 7: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

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

    Post by the_rocketeer Thu May 04, 2017 11:58 am

    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

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

    Post by the_rocketeer Sat May 13, 2017 7: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);
            };
       
      });
    avatar
    Guest
    Guest


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

    Post by Guest Sat May 13, 2017 7:49 am

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


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

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

    Post by the_rocketeer Sat May 13, 2017 8: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

      Current date/time is Mon Sep 23, 2024 1:21 pm