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.

Reputation bar problem.

2 posters

Go down

Reputation bar problem.  Empty Reputation bar problem.

Post by Yuushishio February 27th 2016, 5:12 am

So I follow the code to make an reputation bar by @Ange Tuteur
It worked well untill there's a member reach level 4 and all of her repbar dis-appear.

My rep bar has 10level so I fix the code into this:
Code:
$(document).ready(function() {
 
  var version = 'phpbb3';
 
  var settings = {
      repName : 'Danh vọng',
      repStyle : 'block',
      repImage : 'http://i57.servimg.com/u/f57/18/21/41/30/star12.png'
    };
 
  var repLv = {
      lv1 : 1,
      lv2 : 10,
      lv3 : 30,
      lv4 : 70,
      lv5 : 120,
      lv6 : 200,
      lv7 : 300,
      lv8 : 500,
      lv9 : 700,
      lv10 : 1000
    };
 
  if (settings.repStyle.toLowerCase() == 'block') { var repBlock = '<span id="rLv" class="repuBlock">' }
    else if (settings.repStyle.toLowerCase() == 'image') { var repBlock = '<img id="rLv" src="'+settings.repImage+'"/>' }
    else { var repBlock = '<span id="rLv" class="repuBlock">' }
    var ver = { phpbb2 : version.toLowerCase() == 'phpbb2', phpbb3 : version.toLowerCase() == 'phpbb3', punbb : version.toLowerCase() == 'punbb', invision : version.toLowerCase() == 'invision' };
    var reg = new RegExp('.*'+settings.repName+':\\s+(\\d+).*');
 
  if (ver.phpbb3 || ver.punbb || ver.invision) {
      if (ver.phpbb3 || ver.invision) { var profSel = '.postprofile'; var addRepu = $(this).find('dt').append('<div id="repu">'); }
      else if (ver.punbb) { var profSel = '.user'; var addRepu = $(this).find('.user-ident').prepend('<div id="repu">'); }
      $(profSel).each(function() {
          var rep = Number($(this).text().replace(reg,'$1'));
          addRepu;
          if (rep >= repLv.lv1) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv2 }
          if (rep >= repLv.lv2) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv3 }
          if (rep >= repLv.lv3) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv4 }
          if (rep >= repLv.lv4) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv5 }
          if (rep >= repLv.lv5) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv6 }
          if (rep >= repLv.lv6) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv7 }
          if (rep >= repLv.lv7) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv8 }
          if (rep >= repLv.lv8) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv9 }
          if (rep >= repLv.lv9) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv10 }
          if (rep >= repLv.lv10) { $(this).find('#repu').append(repBlock); var next = 'MAX' }
          $(this).find('#repu').attr('title','Reputation level ' + $(this).find('#rLv').length + '\nNext : (' + next + ')');
      });
    }
    else if (ver.phpbb2) {
      $('td .postdetails.poster-profile').each(function() {
          var rep = Number($(this).text().replace(reg,'$1'));
          $(this).parent().find('.name').next().after('<div id="repu">');
          if (rep >= repLv.lv1) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv2  }
          if (rep >= repLv.lv2) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv3  }
          if (rep >= repLv.lv3) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv4  }
          if (rep >= repLv.lv4) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv5  }
          if (rep >= repLv.lv5) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv6  }
          if (rep >= repLv.lv6) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv7  }
          if (rep >= repLv.lv7) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv8  }
          if (rep >= repLv.lv8) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv9  }
          if (rep >= repLv.lv9) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv10  }
          if (rep >= repLv.lv10) { $(this).parent().find('#repu').append(repBlock); var next = 'MAX'  }
          $(this).parent().find('#repu').attr('title','Reputation level ' + $(this).parent().find('#rLv').length  + '\nNext : (' + next + ')');
      });
    }
});

I wonder did I make anything wrong.
There's other members reach level 4 and their repbar is still appear.

I check the html through browser and see that the code acknowledge her rep at level 0, even though she must be level 5.
Reputation bar problem.  Repbar11

I tried all night but couldn't figure out why. Shocked
avatar
Yuushishio
Forumember

Posts : 117
Reputation : 4
Language : English

http://sharetheworld.forumvi.com

Back to top Go down

Reputation bar problem.  Empty Re: Reputation bar problem.

Post by SLGray February 27th 2016, 5:17 am

So this is only occurring to one member?


Reputation bar problem.  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 : 51464
Reputation : 3519
Language : English
Location : United States

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

Back to top Go down

Reputation bar problem.  Empty Re: Reputation bar problem.

Post by Yuushishio February 27th 2016, 5:19 am

yes, till now it only occurs with one member.
avatar
Yuushishio
Forumember

Posts : 117
Reputation : 4
Language : English

http://sharetheworld.forumvi.com

Back to top Go down

Reputation bar problem.  Empty Re: Reputation bar problem.

Post by Yuushishio March 4th 2016, 8:26 am

I find out the solution myself. Please help me move this topic to garbage. Thank you.
avatar
Yuushishio
Forumember

Posts : 117
Reputation : 4
Language : English

http://sharetheworld.forumvi.com

Back to top Go down

Reputation bar problem.  Empty Re: Reputation bar problem.

Post by SLGray March 4th 2016, 8:27 pm

Since no solution was given, this topic will be sent to the garbage.


Reputation bar problem.  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 : 51464
Reputation : 3519
Language : English
Location : United States

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

Back to top Go down

Back to top

- Similar topics

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