Mini Avatar not visible on the index (Punbb)

Go down

Solved Mini Avatar not visible on the index (Punbb)

Post by la valle dell'eco on July 2nd 2014, 12:18 pm

Sorry if I send you one more question. I would like to know how to make visible the mini avatar of the user who wrote on the index. I can not use the option in the panel because I made some changes.
http://rispostecristiane.forumattivo.it/




I used Punbb.
avatar
la valle dell'eco
Forumember

Female Posts : 103
Reputation : 2
Language : Italian/English

http://www.lavalledelleco.net/

Back to top Go down

Solved Re: Mini Avatar not visible on the index (Punbb)

Post by Pizza Boi on July 3rd 2014, 3:38 pm

Hi Very Happy

This should work, hopefully, add this in Javascript:

Code:
$(function(){
       
          if(!window.localStorage) return;
       
          // Avatar by default
            var default_avatar= 'http://illiweb.com/fa/invision/pp-blank-thumb.png';
       
          // Time of cache, here : 24hrs * 60m * 60s * 1000ms so one day
            var caching_time= 24*60*60*1000;
       
          // Time of cache in case of error, here : 60s * 1000ms so one minute
            var caching_error= 60*1000;
       
          var set_avatar= function(id) {
                $('.mini_ava.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= {};
       
          $('dd.lastpost strong a.gensmall, .ipbtable tr td:last-child span strong a.gensmall, .table td.tcr strong a.gensmall, .forumline .row3.over strong a.gensmall').each(function(){
                to_replace[$(this).attr('href').substr(2)]= 1;
                $(this).closest('td,dd').prepend('<div class="mini_ava member'+$(this).attr('href').substr(2)+'"></div>');
            });
       
          for(i in to_replace)
            {
                set_avatar(i);
            };
       
      });

This in CSS:

Code:
/* Mini-avatar in Index */
.mini_ava{
  float:left;
}
.mini_ava img {
  height: 40px;
  margin: 0 5px;
  width: 40px;
  top: 5px;
  position: relative;
  border-right: 1px dashed #FA0000;
  padding: 0 5px;
}

Regards,
Pizza Boi
avatar
Pizza Boi
Hyperactive

Male Posts : 2016
Reputation : 160
Language : French
Location : Pizza Hut!

http://redlustempire.forumtl.com/

Back to top Go down

Solved Re: Mini Avatar not visible on the index (Punbb)

Post by Ange Tuteur on July 3rd 2014, 6:50 pm

Hello la valle dell'eco,

I am getting a syntax error from one of your scripts :

Find this :
Code:
$(document).ready(function(){
    var rdtOn=$('.rdtOn strong').html();
    var lastUser=$('.lastUser strong').html();
    var totalUser=$('.totalUser strong').html();
    var totalPost=$('.totalPost strong').html();
    $('ul.statsPers').prepend('<li><span>'+totalPost+'</span> Total Posts</li><li><span>'+totalUser+'</span> Total Member</li><li><span>'+lastUser+'</span> Newest Member</li><li><span>'+rdtOn+'</span> Most Online</li>');

and replace it with :
Code:
$(document).ready(function(){
    var rdtOn=$('.rdtOn strong').html();
    var lastUser=$('.lastUser strong').html();
    var totalUser=$('.totalUser strong').html();
    var totalPost=$('.totalPost strong').html();
    $('ul.statsPers').prepend('<li><span>'+totalPost+'</span> Total Posts</li><li><span>'+totalUser+'</span> Total Member</li><li><span>'+lastUser+'</span> Newest Member</li><li><span>'+rdtOn+'</span> Most Online</li>');
});


For the avatar, have you tried the following ?
http://help.forumotion.com/t133214-new-option-show-avatars-in-the-column-last-posts
avatar
Ange Tuteur
Forumaster

Male Posts : 13195
Reputation : 2910
Language : EN10, FR5, JA5
Location : Macungie, PA

https://github.com/SethClydesdale

Back to top Go down

Solved Re: Mini Avatar not visible on the index (Punbb)

Post by la valle dell'eco on July 3rd 2014, 10:34 pm

I have found and corrected the error.

I tried the codes of the tutorial  but I have already changed that with this code.

Code:
<td class="tcr">
 <div class="lastpost">
 <!-- BEGIN switch_topic_title -->
 <a href="{catrow.forumrow.U_LATEST_TOPIC}" title="{catrow.forumrow.LATEST_TOPIC_TITLE}">{catrow.forumrow.LATEST_TOPIC_NAME}</a><br />
 <!-- END switch_topic_title -->
 {catrow.forumrow.USER_LAST_POST}
 </div>
 </td>
 </tr>
 <!-- END forumrow -->
I can not place it.
I tried the codes of Pizza Boi. Nothing.

I do not understand. I did the test here ( http://aureomicina.forumattivo.it/) and be seen.

Instead this is the situation on the forum.






There must be an explanation.  Neutral
avatar
la valle dell'eco
Forumember

Female Posts : 103
Reputation : 2
Language : Italian/English

http://www.lavalledelleco.net/

Back to top Go down

Solved Re: Mini Avatar not visible on the index (Punbb)

Post by Ange Tuteur on July 4th 2014, 6:36 am

Replace the last post by :
Code:
<td class="tcr">
<!-- BEGIN avatar -->
<span class="lastpost-avatar">{catrow.forumrow.avatar.LAST_POST_AVATAR}</span>
<!-- END avatar -->
 <div class="lastpost">
 <!-- BEGIN switch_topic_title -->
 <a href="{catrow.forumrow.U_LATEST_TOPIC}" title="{catrow.forumrow.LATEST_TOPIC_TITLE}">{catrow.forumrow.LATEST_TOPIC_NAME}</a><br />
 <!-- END switch_topic_title -->
 {catrow.forumrow.USER_LAST_POST}
 </div>
 </td>
 </tr>
 <!-- END forumrow -->

Remove the script for avatars, then go to : Display > Structure and hierarchy > enable Show avatars in the column "Last posts"
avatar
Ange Tuteur
Forumaster

Male Posts : 13195
Reputation : 2910
Language : EN10, FR5, JA5
Location : Macungie, PA

https://github.com/SethClydesdale

Back to top Go down

Solved Re: Mini Avatar not visible on the index (Punbb)

Post by la valle dell'eco on July 4th 2014, 9:07 am

Now you see Avatar! Thank you!
But they aren't well positioned.



How can I fix it well ?
avatar
la valle dell'eco
Forumember

Female Posts : 103
Reputation : 2
Language : Italian/English

http://www.lavalledelleco.net/

Back to top Go down

Solved Re: Mini Avatar not visible on the index (Punbb)

Post by Ange Tuteur on July 4th 2014, 9:17 am

Try replacing it with this :
Code:
<td class="tcr">
<div class="lastpost">
<!-- BEGIN avatar -->
<span class="lastpost-avatar">{catrow.forumrow.avatar.LAST_POST_AVATAR}</span>
<!-- END avatar -->
<!-- BEGIN switch_topic_title -->
<a href="{catrow.forumrow.U_LATEST_TOPIC}" title="{catrow.forumrow.LATEST_TOPIC_TITLE}">{catrow.forumrow.LATEST_TOPIC_NAME}</a><br />
<!-- END switch_topic_title -->
{catrow.forumrow.USER_LAST_POST}
</div>
</td>
</tr>
<!-- END forumrow -->
avatar
Ange Tuteur
Forumaster

Male Posts : 13195
Reputation : 2910
Language : EN10, FR5, JA5
Location : Macungie, PA

https://github.com/SethClydesdale

Back to top Go down

Solved Re: Mini Avatar not visible on the index (Punbb)

Post by la valle dell'eco on July 4th 2014, 10:40 am

Thank you very much.
I do not know how you say in English, but "sei in gamba"

solved
avatar
la valle dell'eco
Forumember

Female Posts : 103
Reputation : 2
Language : Italian/English

http://www.lavalledelleco.net/

Back to top Go down

Solved Re: Mini Avatar not visible on the index (Punbb)

Post by Ange Tuteur on July 4th 2014, 11:20 am

You're welcome ! ^^

Topic archived

Have a good day ! sunny
avatar
Ange Tuteur
Forumaster

Male Posts : 13195
Reputation : 2910
Language : EN10, FR5, JA5
Location : Macungie, PA

https://github.com/SethClydesdale

Back to top Go down

Back to top


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