The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Can I add avatar for Private messages list?

3 posters

Go down

Solved Can I add avatar for Private messages list?

Post by Guest February 1st 2018, 11:24 am

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? Very Happy Popcorn

Thank you so much Slobber Hug
avatar
Guest
Guest


Back to top Go down

Solved Re: Can I add avatar for Private messages list?

Post by Ikerepc February 1st 2018, 11:45 am

Maybe this could help. You just need to modify code a little.
https://help.forumotion.com/t137749-avatar-in-the-recent-topics
Ikerepc
Ikerepc
Active Poster

Male Posts : 1186
Reputation : 167
Language : Who cares...
Location : Where web help & support is needed

http://admins.forumotion.com

Back to top Go down

Solved Re: Can I add avatar for Private messages list?

Post by Guest February 1st 2018, 11:54 am

Thanks your answer but can u help how? :/
avatar
Guest
Guest


Back to top Go down

Solved Re: Can I add avatar for Private messages list?

Post by skouliki February 1st 2018, 1:31 pm

hello

what is your forum url please?
skouliki
skouliki
Manager
Manager

Female Posts : 14247
Reputation : 1636
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

Back to top Go down

Solved Re: Can I add avatar for Private messages list?

Post by Guest February 1st 2018, 2:26 pm

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? blackeye

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!
avatar
Guest
Guest


Back to top Go down

Solved Re: Can I add avatar for Private messages list?

Post by TheCrow February 1st 2018, 3:05 pm

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.
TheCrow
TheCrow
Manager
Manager

Male Posts : 6878
Reputation : 794
Language : Greek, English

https://forumote.forumotion.com

Back to top Go down

Solved Re: Can I add avatar for Private messages list?

Post by TheCrow February 1st 2018, 3:52 pm

@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:
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.. Razz
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)! Wink

Regards.
TheCrow
TheCrow
Manager
Manager

Male Posts : 6878
Reputation : 794
Language : Greek, English

https://forumote.forumotion.com

Back to top Go down

Solved Re: Can I add avatar for Private messages list?

Post by Guest February 1st 2018, 4:19 pm

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? Shocked Crying or Very sad
avatar
Guest
Guest


Back to top Go down

Solved Re: Can I add avatar for Private messages list?

Post by TheCrow February 1st 2018, 4:21 pm

The "other" forum you are applying about, does it have heavily changed templates?
TheCrow
TheCrow
Manager
Manager

Male Posts : 6878
Reputation : 794
Language : Greek, English

https://forumote.forumotion.com

Back to top Go down

Solved Re: Can I add avatar for Private messages list?

Post by Guest February 1st 2018, 4:22 pm

No it has the same basic template
avatar
Guest
Guest


Back to top Go down

Solved Re: Can I add avatar for Private messages list?

Post by TheCrow February 1st 2018, 4:25 pm

This may need some time to load or perhaps you have other javascripts that affect its purpose.

Sent from Topic'it App
TheCrow
TheCrow
Manager
Manager

Male Posts : 6878
Reputation : 794
Language : Greek, English

https://forumote.forumotion.com

Back to top Go down

Solved Re: Can I add avatar for Private messages list?

Post by Guest February 1st 2018, 4:45 pm

Thanks Can I add avatar for Private messages list? 2764
avatar
Guest
Guest


Back to top Go down

Solved Re: Can I add avatar for Private messages list?

Post by TheCrow February 1st 2018, 4:58 pm

Is this now solved?
TheCrow
TheCrow
Manager
Manager

Male Posts : 6878
Reputation : 794
Language : Greek, English

https://forumote.forumotion.com

Back to top Go down

Solved Re: Can I add avatar for Private messages list?

Post by Guest February 1st 2018, 5:08 pm

Nope...but i give up. xD
avatar
Guest
Guest


Back to top Go down

Solved Re: Can I add avatar for Private messages list?

Post by TheCrow February 1st 2018, 5:09 pm

goldeneBlume407 wrote:Nope...but i give up. xD
What seems to be the occurring problem?
TheCrow
TheCrow
Manager
Manager

Male Posts : 6878
Reputation : 794
Language : Greek, English

https://forumote.forumotion.com

Back to top Go down

Solved Re: Can I add avatar for Private messages list?

Post by Guest February 1st 2018, 5:14 pm

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.
avatar
Guest
Guest


Back to top Go down

Solved Re: Can I add avatar for Private messages list?

Post by TheCrow February 1st 2018, 5:16 pm

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.
TheCrow
TheCrow
Manager
Manager

Male Posts : 6878
Reputation : 794
Language : Greek, English

https://forumote.forumotion.com

Back to top Go down

Solved Re: Can I add avatar for Private messages list?

Post by Guest February 1st 2018, 5:18 pm

Is there a way to make it load more often?
avatar
Guest
Guest


Back to top Go down

Solved Re: Can I add avatar for Private messages list?

Post by TheCrow February 1st 2018, 5:22 pm

Yes, change line 14 to this:
Code:
 var caching_time= 60*1000;

This will make it load every minute.
TheCrow
TheCrow
Manager
Manager

Male Posts : 6878
Reputation : 794
Language : Greek, English

https://forumote.forumotion.com

Back to top Go down

Solved Re: Can I add avatar for Private messages list?

Post by Guest February 1st 2018, 5:38 pm

Working thanks! Can I add avatar for Private messages list? 1f60d
avatar
Guest
Guest


Back to top Go down

Solved Re: Can I add avatar for Private messages list?

Post by TheCrow February 1st 2018, 5:40 pm

Any more problems we need to solve or this is now solved?
TheCrow
TheCrow
Manager
Manager

Male Posts : 6878
Reputation : 794
Language : Greek, English

https://forumote.forumotion.com

Back to top Go down

Solved Re: Can I add avatar for Private messages list?

Post by Guest February 1st 2018, 5:48 pm

Solved.
avatar
Guest
Guest


Back to top Go down

Solved Re: Can I add avatar for Private messages list?

Post by TheCrow February 1st 2018, 5:50 pm

Great! I'm glad this worked out for you!! Have a great day! :rose:

Problem solved & topic archived.
Please read our forum rules: ESF General Rules
TheCrow
TheCrow
Manager
Manager

Male Posts : 6878
Reputation : 794
Language : Greek, English

https://forumote.forumotion.com

Back to top Go down

Back to top

- Similar topics

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