add mini-avater pic to last posts
3 posters
Page 1 of 1
add mini-avater pic to last posts
How can I have my forum show a small version of the poster's avatar pic on the latest post column?
Re: add mini-avater pic to last posts
Hi,
This will be the Javascript: ACP >> Modules >> JavaScript Code management >> Create a new one.
Add this into your CSS
Codes from French Support Forum.
This will be the Javascript: ACP >> Modules >> JavaScript Code management >> Create a new one.
- Code:
$ ( function () {
if (! window . localStorage ) return ;
/ / Default Avatar
var Default_avatar = 'http://2img.net/i/fa/invision/pp-blank-thumb.png' ;
/ / Time to cache within 24 h 60 m * 60 * s * 1000 ms so one day
var caching_time = 24 * 60 * 60 * 1000 ;
/ / Time of cache error, here 60 s * 1000 ms then 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,. set.profile-frm-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 = {};
$ ( 'strong dd.lastpost a.gensmall,. ipbtable tr td: last-child span a.gensmall strong,. td.tcr strong a.gensmall table,. forumline. row3.over a.gensmall strong' ). each Stock ( 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 );
};
});
Add this into your CSS
- Code:
. mini_ava {
float : left ;
}
. mini_ava img {
width : 40px ;
height : 40px ;
margin : 0 5px ;
border-radius : 10px ;
transition : all 2s ;
-Moz-transition : all 2s ;
-Webkit-transition : all 2s ;
-O-transition : all 2s ;
}
. mini_ava img : hover
{
width : 80px ;
height : 80px ;
}
Codes from French Support Forum.
Re: add mini-avater pic to last posts
It won't work at all. Infact, it will serve only to slow down and eventually ruin your forum with constant 'Request Limit Exceeded' messages.
Kudos to the author for caching the avatars.
Forumotion have loosened this limit a little, but still not quite enough to make this plausible using ajax.
Kudos to the author for caching the avatars.
Forumotion have loosened this limit a little, but still not quite enough to make this plausible using ajax.
LGforum- Hyperactive
- Posts : 2265
Reputation : 264
Language : English
Location : UK
Similar topics
» Display a mini-version of user avatars in posts in the mobile version?
» Avater
» how to move avater & info
» How to remove contact buttons from posts & information/options in writing posts?
» Avater/Signature
» Avater
» how to move avater & info
» How to remove contact buttons from posts & information/options in writing posts?
» Avater/Signature
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum