Can I add avatar for Private messages list?

Go down

Solved Can I add avatar for Private messages list?

Post by goldeneBlume407 on February 1st 2018, 12:24

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
goldeneBlume407
New Member

Posts : 17
Reputation : 1
Language : english

Back to top Go down

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

Post by Ikerepc on February 1st 2018, 12:45

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

Male Posts : 1150
Reputation : 155
Language : Croatian, HTML, HTML5, CSS, CSS3, jQuery, PHP, SQL, Bascom, Python, C, C++, FBD & LAD for PLC and more... Little English :D
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 goldeneBlume407 on February 1st 2018, 12:54

Thanks your answer but can u help how? :/
avatar
goldeneBlume407
New Member

Posts : 17
Reputation : 1
Language : english

Back to top Go down

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

Post by skouliki on February 1st 2018, 14:31

hello

what is your forum url please?
avatar
skouliki
Graphic Designer
Graphic Designer

Female Posts : 4119
Reputation : 675
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 goldeneBlume407 on February 1st 2018, 15:26

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
goldeneBlume407
New Member

Posts : 17
Reputation : 1
Language : english

Back to top Go down

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

Post by Luffy on February 1st 2018, 16:05

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.
avatar
Luffy
Manager
Manager

Male Posts : 5553
Reputation : 616
Language : Greek, English
Location : Greece

https://help.forumotion.com

Back to top Go down

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

Post by goldeneBlume407 on February 1st 2018, 16:31

avatar
goldeneBlume407
New Member

Posts : 17
Reputation : 1
Language : english

Back to top Go down

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

Post by Luffy on February 1st 2018, 16:52

@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://illiweb.com/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.
avatar
Luffy
Manager
Manager

Male Posts : 5553
Reputation : 616
Language : Greek, English
Location : Greece

https://help.forumotion.com

Back to top Go down

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

Post by goldeneBlume407 on February 1st 2018, 17:19

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
goldeneBlume407
New Member

Posts : 17
Reputation : 1
Language : english

Back to top Go down

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

Post by Luffy on February 1st 2018, 17:21

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

Male Posts : 5553
Reputation : 616
Language : Greek, English
Location : Greece

https://help.forumotion.com

Back to top Go down

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

Post by goldeneBlume407 on February 1st 2018, 17:22

No it has the same basic template
avatar
goldeneBlume407
New Member

Posts : 17
Reputation : 1
Language : english

Back to top Go down

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

Post by Luffy on February 1st 2018, 17:25

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

Sent from Topic'it App
avatar
Luffy
Manager
Manager

Male Posts : 5553
Reputation : 616
Language : Greek, English
Location : Greece

https://help.forumotion.com

Back to top Go down

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

Post by goldeneBlume407 on February 1st 2018, 17:45

Thanks
avatar
goldeneBlume407
New Member

Posts : 17
Reputation : 1
Language : english

Back to top Go down

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

Post by Luffy on February 1st 2018, 17:58

Is this now solved?
avatar
Luffy
Manager
Manager

Male Posts : 5553
Reputation : 616
Language : Greek, English
Location : Greece

https://help.forumotion.com

Back to top Go down

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

Post by goldeneBlume407 on February 1st 2018, 18:08

Nope...but i give up. xD
avatar
goldeneBlume407
New Member

Posts : 17
Reputation : 1
Language : english

Back to top Go down

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

Post by Luffy on February 1st 2018, 18:09

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

Male Posts : 5553
Reputation : 616
Language : Greek, English
Location : Greece

https://help.forumotion.com

Back to top Go down

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

Post by goldeneBlume407 on February 1st 2018, 18:14

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
goldeneBlume407
New Member

Posts : 17
Reputation : 1
Language : english

Back to top Go down

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

Post by Luffy on February 1st 2018, 18:16

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.
avatar
Luffy
Manager
Manager

Male Posts : 5553
Reputation : 616
Language : Greek, English
Location : Greece

https://help.forumotion.com

Back to top Go down

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

Post by goldeneBlume407 on February 1st 2018, 18:18

Is there a way to make it load more often?
avatar
goldeneBlume407
New Member

Posts : 17
Reputation : 1
Language : english

Back to top Go down

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

Post by Luffy on February 1st 2018, 18:22

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

This will make it load every minute.
avatar
Luffy
Manager
Manager

Male Posts : 5553
Reputation : 616
Language : Greek, English
Location : Greece

https://help.forumotion.com

Back to top Go down

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

Post by goldeneBlume407 on February 1st 2018, 18:38

Working thanks!
avatar
goldeneBlume407
New Member

Posts : 17
Reputation : 1
Language : english

Back to top Go down

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

Post by Luffy on February 1st 2018, 18:40

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

Male Posts : 5553
Reputation : 616
Language : Greek, English
Location : Greece

https://help.forumotion.com

Back to top Go down

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

Post by goldeneBlume407 on February 1st 2018, 18:48

Solved.
avatar
goldeneBlume407
New Member

Posts : 17
Reputation : 1
Language : english

Back to top Go down

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

Post by Luffy on February 1st 2018, 18:50

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
avatar
Luffy
Manager
Manager

Male Posts : 5553
Reputation : 616
Language : Greek, English
Location : Greece

https://help.forumotion.com

Back to top Go down

Back to top


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