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.

How can I add avatar in Recent Topics Widget?

4 posters

Page 2 of 2 Previous  1, 2

Go down

Solved How can I add avatar in Recent Topics Widget?

Post by Van-Helsing February 25th 2014, 02:23

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, 03:59; edited 3 times in total
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down


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

Post by Ange Tuteur March 5th 2014, 02:24

Dark-Avenger,

Try replacing the script by :
Code:

    $(function(){
        
           if(!window.localStorage) return;
        
           // Avatar por defecto
            var default_avatar= 'http://2img.net/i/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
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

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

Post by TheCrow March 5th 2014, 02:27

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


How can I add avatar in Recent Topics Widget? - Page 2 Thecro10
Forum of the Forums

Forumotion Rules | Tips & Tricks |
FAQ | Did you forget your password?



*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
TheCrow
TheCrow
Manager
Manager

Male Posts : 6916
Reputation : 795
Language : Greek, English

https://www.inforumgr.com

Back to top Go down

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

Post by Van-Helsing March 5th 2014, 02:31

Ange Tuteur wrote:Dark-Avenger,

Try replacing the script by :
Code:

    $(function(){
        
           if(!window.localStorage) return;
        
           // Avatar por defecto
            var default_avatar= 'http://2img.net/i/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
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

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

Post by Ange Tuteur March 5th 2014, 02:34

Try this then :
Code:
    $(function(){
       
          if(!window.localStorage) return;
       
          // Avatar por defecto
            var default_avatar= 'http://2img.net/i/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
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

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

Post by Van-Helsing March 5th 2014, 02:48

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
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

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

Post by Ange Tuteur March 5th 2014, 03:52

Okay, try this :

Replace your script with :
Code:
$(function(){
           
              if(!window.localStorage) return;
           
              // Avatar por defecto
                var default_avatar= 'http://2img.net/i/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
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

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

Post by Van-Helsing March 5th 2014, 03:58

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

Best Regards,
Dark-Avenger
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

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

Post by Ange Tuteur March 5th 2014, 04:04

You're welcome I love you

Topic solved and archived
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Page 2 of 2 Previous  1, 2

Back to top

- Similar topics

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