SocialAcademy • Forum

Social Academy Community Support Forum & Free Tutorial's & Skins



[solved] Avatar Problem


    • Please log in to Reply

    View previous topic View next topic Go down  Message [Page 1 of 1]

    #1

    OfflineZeus

    Zeus
     
    Advance Member
    Advance Member

    Posted Sun Jun 15, 2014 7:55 am

     
    Details: Avatar does not appear when i'm disconnected.
    Screenshot:
    online
    [solved] Avatar Problem 2li8sja
    offline
    [solved] Avatar Problem 24kxs92
    Forum Address: http://help4games.2morpg.com/
    Forum Version: punbb

    http://games-online.forumz.ro/
    #2

    OfflineJ0k3R^

    J0k3R^
     
    Advance Member
    Advance Member

    Posted Sun Jun 15, 2014 8:23 am

     
    Hi,
    what codes did u use for the avatars?

    http://fmplanet.forumgreek.com
    #3

    OfflineZeus

    Zeus
     
    Advance Member
    Advance Member

    Posted Sun Jun 15, 2014 9:51 am

     
    JavaScript:
    Code:
    $(document).on('ready', function() {
        $('.statused .tcr').prepend('<div class="avatar-index"><div>');
        $('.statused .tcr .avatar-index').each(function () {
            var profileUserURL = $(this).parent().children('span').children('strong').children('a').attr('href');
            $(this).html('<a href="' + profileUserURL + '" class="avatar-index-enlace"><img src="http://2img.net/i/fa/invision/pp-blank-thumb.png" alt="No Avatar" /></a>');
            $(this).children('a').load(profileUserURL + ' .module:eq(0) img:eq(0)')
        });
    });

    CSS:
    Code:
    .avatar-index { float: left; }
    .avatar-index img { width: 40px; height: 40px; padding: 1px; border: 1px solid #DDD; margin: 0 5px; }

    http://games-online.forumz.ro/
    #4

    OfflineJ0k3R^

    J0k3R^
     
    Advance Member
    Advance Member

    Posted Sun Jun 15, 2014 9:58 am

     
    im not sure about that but try this:
    go to overall_header and add the following to the end of it:

    Code:
    <!-- BEGIN switch_user_logged_out -->
    <script>
    $(document).on('ready', function() {
        $('.statused .tcr').prepend('<div class="avatar-index"><div>');
        $('.statused .tcr .avatar-index').each(function () {
            var profileUserURL = $(this).parent().children('span').children('strong').children('a').attr('href');
            $(this).html('<a href="' + profileUserURL + '" class="avatar-index-enlace"><img src="http://2img.net/i/fa/invision/pp-blank-thumb.png" alt="No Avatar" /></a>');
            $(this).children('a').load(profileUserURL + ' .module:eq(0) img:eq(0)')
        });
    });
    </script>
    <!-- END switch_user_logged_out -->

    or:

    Code:
    <!-- BEGIN switch_user_logged_out -->
    <script type="text/javascript">
    $(document).on('ready', function() {
        $('.statused .tcr').prepend('<div class="avatar-index"><div>');
        $('.statused .tcr .avatar-index').each(function () {
            var profileUserURL = $(this).parent().children('span').children('strong').children('a').attr('href');
            $(this).html('<a href="' + profileUserURL + '" class="avatar-index-enlace"><img src="http://2img.net/i/fa/invision/pp-blank-thumb.png" alt="No Avatar" /></a>');
            $(this).children('a').load(profileUserURL + ' .module:eq(0) img:eq(0)')
        });
    });
    </script>
    <!-- END switch_user_logged_out -->

    http://fmplanet.forumgreek.com
    #5

    OfflineZeus

    Zeus
     
    Advance Member
    Advance Member

    Posted Sun Jun 15, 2014 11:42 am

     
    i not good
    look on my forum

    http://games-online.forumz.ro/
    #6

    OfflineJ0k3R^

    J0k3R^
     
    Advance Member
    Advance Member

    Posted Sun Jun 15, 2014 11:56 am

     

    *
    POPULAR

    okey, delete the javascript and these codes from overall_header..
    i will provide u new:

    1st. javascript (homepage + sub-forums):

    Code:
    $(function(){
    var text = '<span class="mini_ava"><img src="http://i58.tinypic.com/2enrbyd.png" /></span> <br/> <span class="nopostcont">No posts</span>';
    var noPost = $('.table td.tcr');
    $(noPost).each(function() {
    if($(this).text() == '') {
     $(this).html(text);
    }
    else { }
    });
    });

    2nd. javascript (homepage + sub-forums):

    Code:
    $(function(){
           
              if(!window.localStorage) return;
           
              // Avatar by default
                var default_avatar= 'http://2img.net/i/fa/invision/pp-blank-thumb.png';
           
              // Time of cache, here : 24hrs * 60m * 60s * 1000ms so one day
                var caching_time= 24*60*60*1000;
           
              // Time of cache in case of error, here : 60s * 1000ms so one minute
                var caching_error= 60*1000;
           
              var set_avatar= function(id) {
                    $('.mini_ava.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= {};
           
              $('dd.lastpost strong a.gensmall, .ipbtable tr td:last-child span strong a.gensmall, .table td.tcr strong a.gensmall, .forumline .row3.over strong a.gensmall').each(function(){
                    to_replace[$(this).attr('href').substr(2)]= 1;
                    $(this).closest('td,dd').prepend('<div class="mini_ava member'+$(this).attr('href').substr(2)+'"></div>');
                });
           
              for(i in to_replace)
                {
                    set_avatar(i);
                };
           
          });

    3rd. css:

    Code:
    .mini_ava{
    float:left;
    }
    .mini_ava img{
    width:30px;
    height:30px;
    margin: 7px 7px;
      padding: 1px;
    border: 1px solid #B1B1B1;
      border-radius:2px;
    }

    http://fmplanet.forumgreek.com
    #7

    OfflineZeus

    Zeus
     
    Advance Member
    Advance Member

    Posted Sun Jun 15, 2014 3:53 pm

     
    Problem Solved

    http://games-online.forumz.ro/
    #8

    OfflineDustin

    Dustin
     
    Forum Helper
    Forum Helper

    Posted Sun Jun 15, 2014 8:49 pm

     
    Topic solved & archived.

    #9

    OfflineSponsored content


     

    Posted

     

    Message (Page 1 of 1)



      Share Topics Url

      Url
      BBcode
      HTML

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

       
      • Free forum | ©phpBB | Free forum support | Report an abuse | Forumotion.com


      Social Academy Forum
      © Social Academy 2013-2022