Avatar in the Recent Topics
3 posters
Page 1 of 1
Avatar in the Recent Topics
Hi!
I used this tutorial by @ange tuteur and I would like to know If it's possible to put the avatar somewhere else below recent topics.
Forum version: phpBB2 ^^
I used this tutorial by @ange tuteur and I would like to know If it's possible to put the avatar somewhere else below recent topics.
Forum version: phpBB2 ^^
Re: Avatar in the Recent Topics
Where would you like them?
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Re: Avatar in the Recent Topics
So you do not want to place them in a different place on the forum, but change where they are in the latest topic column?
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Re: Avatar in the Recent Topics
Search and remove this line in your index_box template
- Code:
<div style="width: 200px;"></div>
Re: Avatar in the Recent Topics
Did @SarkZKalie's solution solved your problem?
EDIT:Replace the JS code you use with this one:
EDIT:Replace the JS code you use with this one:
- Code:
$(function(){
var style = document.createElement('STYLE'), css = '.mini_ava2>img{height:20px;margin-right:5px;width:20px;}';
style.type = 'text/css';
if (style.styleSheet) style.styleSheet.cssText = css;
else style.appendChild(document.createTextNode(css));
document.getElementsByTagName('HEAD')[0].appendChild(style);
if(!window.localStorage) return;
// Default avatar
var default_avatar= 'http://2img.net/i/fa/invision/pp-blank-thumb.png';
// Time of cache 24h*60m*60s*1000ms - one day
var caching_time= 24*60*60*1000;
// Time of cache in case of error 60s*1000ms - one minute
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= {};
$('#recentTopics a[href^="/u"]').each(function(){
to_replace[$(this).attr('href').substr(2)]= 1;
$(this).parent().before('<span class="mini_ava2 member'+$(this).attr('href').substr(2)+'"></span>');
});
for(i in to_replace)
{
set_avatar(i);
};
});
- Code:
div#recentTopics>table>tbody>tr>td.row1>*{
display:inline-table;
}
div#recentTopics>table>tbody>tr>td.row1>span.gensmall{
width:80%;
}
div#recentTopics>table>tbody>tr>td.row1>span.mini_ava2{
position:relative;
vertical-align:middle;
top:13px;
}
Guest- Guest
Re: Avatar in the Recent Topics
No because he is talking about last post but I need help in customizing Recent topics/Latest topics widget.
Re: Avatar in the Recent Topics
Another issue: when I log out only default avatar shows up click
java:
java:
- Code:
$(function(){
var style = document.createElement('STYLE'), css = '.mini_ava2>img{object-fit: cover;object-position: 50% 25%;border-radius: 100%;margin-right: 5px;height: 30px;margin-right: 5px;width: 30px;margin-top: -2px;float: left;}';
style.type = 'text/css';
if (style.styleSheet) style.styleSheet.cssText = css;
else style.appendChild(document.createTextNode(css));
document.getElementsByTagName('HEAD')[0].appendChild(style);
if(!window.localStorage) return;
// Default avatar
var default_avatar= 'http://2img.net/i/fa/invision/pp-blank-thumb.png';
// Time of cache 60s*1000ms - one day
var caching_time= 1*1000;
// Time of cache in case of error 60s*1000ms - one minute
var caching_error= 1*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= {};
$('#recentTopics a[href^="/u"]').each(function(){
to_replace[$(this).attr('href').substr(2)]= 1;
$(this).before('<span class="mini_ava2 member'+$(this).attr('href').substr(2)+'"></span>');
});
for(i in to_replace)
{
set_avatar(i);
};
});
Re: Avatar in the Recent Topics
This happens because guests cannot view profiles on your forum, so the code cannot get the avatar.
Guest- Guest
Re: Avatar in the Recent Topics
Now guest can see the profile too but avatars still don't work in Google Chrome. Any other ideas?
Similar topics
» Avatar in the Recent Topics
» Change Recent Topics widget to Recent Posts?
» Avatar in the recent topics problem
» Avatar in the Recent Topics problem
» Avatar in the recent topics problem
» Change Recent Topics widget to Recent Posts?
» Avatar in the recent topics problem
» Avatar in the Recent Topics problem
» Avatar in the recent topics problem
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum