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.

Recent topic avatar

4 posters

Go down

Solved Recent topic avatar

Post by Fruzsi January 30th 2021, 2:19 pm

Hello!

I tried the recent topic avatar by this guide, but something went wrong. A see the forumotion default avatar, not the avatar that the members chosen (or my deafult avatar) by their self. What can i do with this?

Here is my (test) forum: https://testhp.hungarianforum.com/ and i think this is Phpp2
Fruzsi
Fruzsi
Forumember

Posts : 35
Reputation : 1
Language : Hungarian, English
Location : Hungary

Back to top Go down

Solved Re: Recent topic avatar

Post by skouliki January 30th 2021, 2:40 pm

Hello

Did you change on the code the default image with your default avatar image?
skouliki
skouliki
Manager
Manager

Female Posts : 15391
Reputation : 1709
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

Back to top Go down

Solved Re: Recent topic avatar

Post by Fruzsi January 30th 2021, 2:45 pm

Yes, here is de code in the script

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/u/3512/46/42/26/avatars/gallery/00010.jpg';
   
      // 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).before('<span class="mini_ava2 member'+$(this).attr('href').substr(2)+'"></span>');
        });
   
      for(i in to_replace)
        {
            set_avatar(i);
        };
   
  });
Fruzsi
Fruzsi
Forumember

Posts : 35
Reputation : 1
Language : Hungarian, English
Location : Hungary

Back to top Go down

Solved Re: Recent topic avatar

Post by skouliki January 30th 2021, 2:58 pm

I guess you add to the template the code that the tutorial says
If your template is modified then try to put the default one to check if the bug is caused by your template modification
skouliki
skouliki
Manager
Manager

Female Posts : 15391
Reputation : 1709
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

Back to top Go down

Solved Re: Recent topic avatar

Post by Fruzsi January 30th 2021, 3:06 pm

Yes i put it, and i try it. Now the all latest topics uses the original code without modifying.

This is te code in the mod_recent_topics:
Code:
<div id="recentTopics">
<!-- BEGIN scrolling_row -->
    {MARQUEE_JS_SRC}
    <table class="forumline genmed" width="100%" border="0" cellspacing="1" cellpadding="0">
            <tr>
                    <td class="catLeft" height="25">
                            <span class="genmed module-title">{L_RECENT_TOPICS}</span>
                    </td>
            </tr>
            <tr>
                    <td class="row1" style="height:{SCROLL_HEIGHT}px;">
                        <div class="marquee" align="left" data-direction='{SCROLL_WAY}' data-duration='{SCROLL_DELAY}' data-pauseOnHover="true" style="overflow:hidden;height:{SCROLL_HEIGHT}px;">
                            <!-- BEGIN recent_topic_row -->
                                »&nbsp;<a href="{scrolling_row.recent_topic_row.U_TITLE}" title="{scrolling_row.recent_topic_row.L_TITLE}">{scrolling_row.recent_topic_row.L_TITLE}</a><br />
                                <img src="{ICON_TIME}" alt="" />{scrolling_row.recent_topic_row.S_POSTTIME} {BY}&nbsp;

                                <!-- BEGIN switch_poster -->
                                <a href="{scrolling_row.recent_topic_row.switch_poster.U_POSTER}">{scrolling_row.recent_topic_row.switch_poster.S_POSTER}</a><br /><br />
                                <!-- END switch_poster -->

                                <!-- BEGIN switch_poster_guest -->
                                {scrolling_row.recent_topic_row.switch_poster_guest.S_POSTER}<br /><br />
                                <!-- END switch_poster_guest -->
                            <!-- END recent_topic_row -->
                        </div>
                    </td>
            </tr>
    </table>
    <script>
        $(".marquee").marquee();
    </script>
<!-- END scrolling_row -->
<!-- BEGIN classical_row -->
<table class="forumline" width="100%" border="0" cellspacing="1" cellpadding="0">
   <tr>
      <td class="catHead" height="25"><span class="genmed"><b><center>{L_RECENT_TOPICS}</center></b></span></td>
   </tr>
   <tr>
      <td class="row1" align="left"><span class="gensmall">
      <!-- BEGIN recent_topic_row -->
      » <a href="{classical_row.recent_topic_row.U_TITLE}">{classical_row.recent_topic_row.L_TITLE}</a><br /><img src="{ICON_TIME}" alt="" />{BY}&nbsp;

      <!-- BEGIN switch_poster -->
      <a href="{classical_row.recent_topic_row.switch_poster.U_POSTER}">{classical_row.recent_topic_row.switch_poster.S_POSTER}</a>
      <!-- END switch_poster -->

      <!-- BEGIN switch_poster_guest -->
      {classical_row.recent_topic_row.switch_poster_guest.S_POSTER}
      <!-- END switch_poster_guest -->

      {ON} {classical_row.recent_topic_row.S_POSTTIME}<br /><br />

      <!--
      <a href="{classical_row.recent_topic_row.U_POSTER}">{classical_row.recent_topic_row.S_POSTER}</a> {ON} {classical_row.recent_topic_row.S_POSTTIME}<br /><br />
      -->
      <!-- END recent_topic_row -->
      </span></td>
   </tr>
</table>
<!-- END classical_row -->
</div>
Fruzsi
Fruzsi
Forumember

Posts : 35
Reputation : 1
Language : Hungarian, English
Location : Hungary

Back to top Go down

Solved Re: Recent topic avatar

Post by skouliki January 30th 2021, 3:47 pm

did the code work with the default template?
skouliki
skouliki
Manager
Manager

Female Posts : 15391
Reputation : 1709
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

Back to top Go down

Solved Re: Recent topic avatar

Post by Fruzsi January 30th 2021, 4:01 pm

No, same as the start.
Fruzsi
Fruzsi
Forumember

Posts : 35
Reputation : 1
Language : Hungarian, English
Location : Hungary

Back to top Go down

Solved Re: Recent topic avatar

Post by Ape January 30th 2021, 4:20 pm

Hmm this is strange as I have just tested the code's on my forum and it works just fine.

Have you tried to turn off all the other JavaScripts and just run that one and make sure it turned on to all pages ?

I have a feeling there is a code you are already using that is messing this up your end.


Recent topic avatar Left1212Recent topic avatar Center11Recent topic avatar Right112
Recent topic avatar Ape_b110
Recent topic avatar Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 19436
Reputation : 2010
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Niko likes this post

Back to top Go down

Solved Re: Recent topic avatar

Post by Fruzsi January 30th 2021, 4:41 pm

I delete all JavaScript, and make again this, but doesn't work. I don't understand to, I think i let go this, but thanks for time and help <3.
Fruzsi
Fruzsi
Forumember

Posts : 35
Reputation : 1
Language : Hungarian, English
Location : Hungary

Back to top Go down

Solved Re: Recent topic avatar

Post by Ape January 30th 2021, 8:17 pm

@Fruzsi Would you like me to mark this as solved or just trash the topic ?


Recent topic avatar Left1212Recent topic avatar Center11Recent topic avatar Right112
Recent topic avatar Ape_b110
Recent topic avatar Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 19436
Reputation : 2010
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: Recent topic avatar

Post by SLGray January 30th 2021, 9:40 pm

Did you publish teh modified template?


Recent topic avatar Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51555
Reputation : 3524
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Solved Re: Recent topic avatar

Post by Fruzsi January 31st 2021, 7:55 pm

Yes, I publish and I think yes, you marked solved, or/and take to the archive.
Fruzsi
Fruzsi
Forumember

Posts : 35
Reputation : 1
Language : Hungarian, English
Location : Hungary

Back to top Go down

Solved Re: Recent topic avatar

Post by Ape February 1st 2021, 12:17 am

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


Recent topic avatar Left1212Recent topic avatar Center11Recent topic avatar Right112
Recent topic avatar Ape_b110
Recent topic avatar Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 19436
Reputation : 2010
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Back to top

- Similar topics

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