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.

How can I add avatar in Recent Topics Widget?

Page 2 of 2 Previous  1, 2

View previous topic View next topic Go down

Solved How can I add avatar in Recent Topics Widget?

Post by Van-Helsing on February 25th 2014, 1:23 am

First topic message reminder :

Hi dear all,
How can I add avatar in Recent Topics Widget before the topic title? My forum version is phpbb2.

Best Regards,
Dark-Avenger


Last edited by Dark-Avenger on March 5th 2014, 2:59 am; edited 3 times in total

Van-Helsing
Hyperactive

Male Posts : 2222
Reputation : 82
Language : English, Greek

http://helpgr.forumgreek.com/

Back to top Go down


Solved Re: How can I add avatar in Recent Topics Widget?

Post by Ange Tuteur on March 5th 2014, 1:24 am

Dark-Avenger,

Try replacing the script by :
Code:

    $(function(){
        
           if(!window.localStorage) return;
        
           // Avatar por defecto
            var default_avatar= 'http://illiweb.com/fa/invision/pp-blank-thumb.png';
        
           // Tiempo de cache, aqui 24 h * 60 m * 60 s * 1000 ms entonces un día
            var caching_time= 24*60*60*1000;
        
           // Tiempo de cache de un error, ici 60 s * 1000 ms entonces un minuto
            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= {};
        
           $('#comments_scroll_div a[href^="/u"]').each(function(){
                to_replace[$(this).attr('href').substr(2)]= 1;
                $(this).prev().prev().prev().before('<span class="mini_ava2 member'+$(this).attr('href').substr(2)+'"></span>');
            });
        
           for(i in to_replace)
            {
                set_avatar(i);
            };
        
       });

Marios94 and JScript,

Is scrolling active for your latest topics ? It must be active.

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: How can I add avatar in Recent Topics Widget?

Post by Luffy on March 5th 2014, 1:27 am

Yes it is activated but it still doesn't work! Sad






Luffy
Manager
Manager

Male Posts : 4246
Reputation : 424
Language : Greek, English
Location : Greece

http://helpgr.forumgreek.com/forum

Back to top Go down

Solved Re: How can I add avatar in Recent Topics Widget?

Post by Van-Helsing on March 5th 2014, 1:31 am

@Ange Tuteur wrote:Dark-Avenger,

Try replacing the script by :
Code:

    $(function(){
        
           if(!window.localStorage) return;
        
           // Avatar por defecto
            var default_avatar= 'http://illiweb.com/fa/invision/pp-blank-thumb.png';
        
           // Tiempo de cache, aqui 24 h * 60 m * 60 s * 1000 ms entonces un día
            var caching_time= 24*60*60*1000;
        
           // Tiempo de cache de un error, ici 60 s * 1000 ms entonces un minuto
            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= {};
        
           $('#comments_scroll_div a[href^="/u"]').each(function(){
                to_replace[$(this).attr('href').substr(2)]= 1;
                $(this).prev().prev().prev().before('<span class="mini_ava2 member'+$(this).attr('href').substr(2)+'"></span>');
            });
        
           for(i in to_replace)
            {
                set_avatar(i);
            };
        
       });

Marios94 and JScript,

Is scrolling active for your latest topics ? It must be active.
Ange
I want to move the avatar before the symbol >> like this image http://prntscr.com/2xyk81

Van-Helsing
Hyperactive

Male Posts : 2222
Reputation : 82
Language : English, Greek

http://helpgr.forumgreek.com/

Back to top Go down

Solved Re: How can I add avatar in Recent Topics Widget?

Post by Ange Tuteur on March 5th 2014, 1:34 am

Try this then :
Code:
    $(function(){
       
          if(!window.localStorage) return;
       
          // Avatar por defecto
            var default_avatar= 'http://illiweb.com/fa/invision/pp-blank-thumb.png';
       
          // Tiempo de cache, aqui 24 h * 60 m * 60 s * 1000 ms entonces un día
            var caching_time= 24*60*60*1000;
       
          // Tiempo de cache de un error, ici 60 s * 1000 ms entonces un minuto
            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= {};
       
          $('#comments_scroll_div a[href^="/u"]').each(function(){
                to_replace[$(this).attr('href').substr(2)]= 1;
                $(this).prev().prev().prev().prev().after('<span class="mini_ava2 member'+$(this).attr('href').substr(2)+'"></span>');
            });
       
          for(i in to_replace)
            {
                set_avatar(i);
            };
       
      });

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: How can I add avatar in Recent Topics Widget?

Post by Van-Helsing on March 5th 2014, 1:48 am

The title is still wrapping under the avatar how can I fix this? Furthermore the first topic in recent topic widget doesn't display avatar.

Van-Helsing
Hyperactive

Male Posts : 2222
Reputation : 82
Language : English, Greek

http://helpgr.forumgreek.com/

Back to top Go down

Solved Re: How can I add avatar in Recent Topics Widget?

Post by Ange Tuteur on March 5th 2014, 2:52 am

Okay, try this :

Replace your script with :
Code:
$(function(){
           
              if(!window.localStorage) return;
           
              // Avatar por defecto
                var default_avatar= 'http://illiweb.com/fa/invision/pp-blank-thumb.png';
           
              // Tiempo de cache, aqui 24 h * 60 m * 60 s * 1000 ms entonces un día
                var caching_time= 24*60*60*1000;
           
              // Tiempo de cache de un error, ici 60 s * 1000 ms entonces un minuto
                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= {};
           
              $('#comments_scroll_div a[href^="/u"]').each(function(){
                    to_replace[$(this).attr('href').substr(2)]= 1;
                    $(this).prev().prev().prev().before('<span class="mini_ava2 member'+$(this).attr('href').substr(2)+'"></span>');
                });
           
              for(i in to_replace)
                {
                    set_avatar(i);
                };
           
          });

and replace your CSS with :
Code:
.mini_ava2 > img {
    height:30px;
    width:30px;
    float:left;
    margin:4px 0;
    padding:8px 0;
}

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: How can I add avatar in Recent Topics Widget?

Post by Van-Helsing on March 5th 2014, 2:58 am

Thank you very very much Ange its working perfectly.
 :wouhou: 

Best Regards,
Dark-Avenger

Van-Helsing
Hyperactive

Male Posts : 2222
Reputation : 82
Language : English, Greek

http://helpgr.forumgreek.com/

Back to top Go down

Solved Re: How can I add avatar in Recent Topics Widget?

Post by Ange Tuteur on March 5th 2014, 3:04 am

You're welcome I love you

Topic solved and archived

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Page 2 of 2 Previous  1, 2

View previous topic View next topic Back to top


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