Can I add avatar for Private messages list?
3 posters
Page 1 of 1
Can I add avatar for Private messages list?
Technical Details
Forum version : #phpBB2
Position : Administrator
Concerned browser(s) : Google Chrome
Who the problem concerns : Yourself
Forum link :
Description of problem
Hi!without this : https://i.imgur.com/Cxin8TV.jpg
with avatar (manipulated): https://i.imgur.com/q0hZaki.jpg
I would like add avatar, like in the pic (this pic is manipulated with ps) to my privmsgs_body // Private messages list.
Is it possible? And if yes, how?


Thank you so much


Guest- Guest
Re: Can I add avatar for Private messages list?
Maybe this could help. You just need to modify code a little.
https://help.forumotion.com/t137749-avatar-in-the-recent-topics
https://help.forumotion.com/t137749-avatar-in-the-recent-topics
Re: Can I add avatar for Private messages list?
Sorry but this is a private forum for me where I am trying out different styles/ideas and I would like to keep the link private because there is literally nothing on it yet. I don't really know what the url would help because I simply ask if it could be done or not and how. I mean my forum base is phpBB2 I have an administrator acces. I just want to know that could it be done and how?
Forum version : #phpBB2
Position : Administrator
Concerned browser(s) : Google Chrome.
This is my idea: https://i.imgur.com/q0hZaki.jpg
I made this with photoshop I would like to know if it is possible to do so with code. Thank you in advance!

Forum version : #phpBB2
Position : Administrator
Concerned browser(s) : Google Chrome.
This is my idea: https://i.imgur.com/q0hZaki.jpg
I made this with photoshop I would like to know if it is possible to do so with code. Thank you in advance!
Guest- Guest
Re: Can I add avatar for Private messages list?
Hello @goldeneBlume407,
The forum link is needed to check the codes if they work. We do not have all type of forums and some codes may vary on different versions. As for your issue, as far as i know, no version so far has this column you want to add. I am sure it's possible though.
Regards.
The forum link is needed to check the codes if they work. We do not have all type of forums and some codes may vary on different versions. As for your issue, as far as i know, no version so far has this column you want to add. I am sure it's possible though.
Regards.
Re: Can I add avatar for Private messages list?
@goldeneBlume407,
This is one code that should work if there are not "hard" changes on the templates.
You have to add this Javascript (Modules > Javascript > Create a new javascript) to all the pages with any name you wish:
This code works with cookies. That means that once it's loaded, the images are there for the next day. Each day, this code checks for changes to avatars and if there are any it applies it a day after. If the code shows the default avatar instead of the normal one, give it a chance and reload the page and if it doesn't show the normal one means there's something wrong..
If more help is needed i'd be glad to attend to the problem, but i'll need an account to check the problem (if they appear)!
Regards.
This is one code that should work if there are not "hard" changes on the templates.
You have to add this Javascript (Modules > Javascript > Create a new javascript) to all the pages with any name you wish:
- 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= 'https://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 img,.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= {};
$('form[name*="privmsg"] span.name 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);
};
});
This code works with cookies. That means that once it's loaded, the images are there for the next day. Each day, this code checks for changes to avatars and if there are any it applies it a day after. If the code shows the default avatar instead of the normal one, give it a chance and reload the page and if it doesn't show the normal one means there's something wrong..

If more help is needed i'd be glad to attend to the problem, but i'll need an account to check the problem (if they appear)!

Regards.
Re: Can I add avatar for Private messages list?
Thank you. But I have another problem. If I try this code on another page with the same basis(phpBB2) it does not work at all. Or simply just shows the "default avatar". Is there a way to solve this?


Guest- Guest
Re: Can I add avatar for Private messages list?
The "other" forum you are applying about, does it have heavily changed templates?
Re: Can I add avatar for Private messages list?
This may need some time to load or perhaps you have other javascripts that affect its purpose.
Sent from Topic'it App
Sent from Topic'it App
Re: Can I add avatar for Private messages list?
What seems to be the occurring problem?goldeneBlume407 wrote:Nope...but i give up. xD
Re: Can I add avatar for Private messages list?
It only worked on the forum I linked and I can't seem to find the problem why doesn't it work anywhere else. I have the same javascript codes and almost everything is the same and still it's not working.
Guest- Guest
Re: Can I add avatar for Private messages list?
Maybe it's the cache time set in the javascript. As i mentioned above, if the avatars don't load normally, it either be a problem with the forum or it needs the time to load, which is a day, or every minute if there's an error there.
Re: Can I add avatar for Private messages list?
Yes, change line 14 to this:
This will make it load every minute.
- Code:
var caching_time= 60*1000;
This will make it load every minute.
Re: Can I add avatar for Private messages list?
Any more problems we need to solve or this is now solved?
Re: Can I add avatar for Private messages list?
Great! I'm glad this worked out for you!! Have a great day! 

Problem solved & topic archived.
|

» Resize the avatar box in private messages
» Entire site cannot read Private Messages "Could not query private message post information"
» Private messages shows you have no new messages
» private messages not so private
» Private Messages
» Entire site cannot read Private Messages "Could not query private message post information"
» Private messages shows you have no new messages
» private messages not so private
» Private Messages
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum