How can I add avatar in Recent Topics Widget?
4 posters
Page 2 of 2
Page 2 of 2 • 1, 2
How can I add avatar in Recent Topics Widget?
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
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
Re: How can I add avatar in Recent Topics Widget?
Dark-Avenger,
Try replacing the script by :
Marios94 and JScript,
Is scrolling active for your latest topics ? It must be active.
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.
Re: How can I add avatar in Recent Topics Widget?
Yes it is activated but it still doesn't work!
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!
Re: How can I add avatar in Recent Topics Widget?
AngeAnge 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.
I want to move the avatar before the symbol >> like this image http://prntscr.com/2xyk81
Re: How can I add avatar in Recent Topics Widget?
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);
};
});
Re: How can I add avatar in Recent Topics Widget?
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.
Re: How can I add avatar in Recent Topics Widget?
Okay, try this :
Replace your script with :
and replace your CSS with :
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;
}
Re: How can I add avatar in Recent Topics Widget?
Thank you very very much Ange its working perfectly.
Best Regards,
Dark-Avenger
Best Regards,
Dark-Avenger
Page 2 of 2 • 1, 2
Similar topics
» Avatar in recent topics widget phpbb3
» Change Recent Topics widget to Recent Posts?
» Avatar in: Lattest Topics, Most Viewed Topics and Most Active Topics Widget!
» Recent topics not as widget
» Recent topics widget
» Change Recent Topics widget to Recent Posts?
» Avatar in: Lattest Topics, Most Viewed Topics and Most Active Topics Widget!
» Recent topics not as widget
» Recent topics widget
Page 2 of 2
Permissions in this forum:
You cannot reply to topics in this forum