The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Add a bar for Reputation

View previous topic View next topic Go down

Solved Add a bar for Reputation

Post by smurfavr on July 5th 2017, 12:36 pm

I did everything from the lesson, but it does not work. How do I fix it?


Code:
$(document).ready(function() {
               
                  var version = 'phpBB2';
               
                  var settings = {
                      repName : 'Репутация',
                      repStyle : 'block',
                      repImage : 'http://i57.servimg.com/u/f57/18/21/41/30/star12.png'
                    };
               
                  var repLv = {
                      lv1 : 1,
                      lv2 : 2,
                      lv3 : 3,
                      lv4 : 4,
                      lv5 : 5,
                      lv6 : 6,
                      lv7 : 7,
                      lv8 : 8,
                      lv9 : 9,
                      lv10 : 10
                    };
               
                  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', modernbb : version.toLowerCase() == 'modernbb' };
                    var reg = new RegExp('.*'+settings.repName+'\\s+:\\s+(\\d+).*');
               
                  if (ver.phpbb3 || ver.punbb || ver.invision || ver.modernbb) {
                      if (ver.phpbb3 || ver.invision || ver.modernbb) { 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 + ')');
                      });
                    }
                });


Last edited by smurfavr on July 23rd 2017, 4:53 pm; edited 1 time in total
avatar
smurfavr
Active Poster

Male Posts : 1568
Reputation : 13
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Add a bar for Reputation

Post by APE on July 5th 2017, 12:40 pm

Have you made a lot of change to your templates ?



avatar
APE
Manager
Manager

Male Posts : 10679
Reputation : 997
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

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

Back to top Go down

Solved Re: Add a bar for Reputation

Post by smurfavr on July 5th 2017, 12:43 pm

I've made changes. I try on a test FORUM.

http://vracatestforum.bulgarianforum.net/t18-topic
avatar
smurfavr
Active Poster

Male Posts : 1568
Reputation : 13
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Add a bar for Reputation

Post by APE on July 5th 2017, 12:55 pm

ok on your forum you have the settings wrong
see here you have the name as Reputation but in your code you changed it to Репутация The names have to be 100% the same or it will not work.



avatar
APE
Manager
Manager

Male Posts : 10679
Reputation : 997
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

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

Back to top Go down

Solved Re: Add a bar for Reputation

Post by smurfavr on July 5th 2017, 1:00 pm

Thank you APE. How do I make a reputation under the avatars, not above it?

psp
Why Not Displaying, All Profiles Reputation ???
http://vracatestforum.bulgarianforum.net/t18-topic

avatar
smurfavr
Active Poster

Male Posts : 1568
Reputation : 13
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Add a bar for Reputation

Post by APE on July 5th 2017, 1:48 pm

The reason you don't have it on all the profiles as the one you are pointing at is -2 you need to have all + numbers to make it show up as for moving the bar i really Don't know as it was made to work that way on some forums you are best to ask @Ange Tuteur how to move it as he made the cool code Smile



avatar
APE
Manager
Manager

Male Posts : 10679
Reputation : 997
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

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

Back to top Go down

Solved Re: Add a bar for Reputation

Post by APE on July 5th 2017, 1:55 pm

Update:

Try and change it to this and see if it works
Code:
 $(document).ready(function() {
                     
                          var version = 'phpBB2';
                     
                          var settings = {
                              repName : 'Reputation',
                              repStyle : 'block',
                              repImage : 'http://i57.servimg.com/u/f57/18/21/41/30/star12.png'
                            };
                     
                          var repLv = {
                              lv1 : 1,
                              lv2 : 2,
                              lv3 : 3,
                              lv4 : 4,
                              lv5 : 5,
                              lv6 : 6,
                              lv7 : 7,
                              lv8 : 8,
                              lv9 : 9,
                              lv10 : 10
                            };
                     
                          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', modernbb : version.toLowerCase() == 'modernbb' };
                            var reg = new RegExp('.*'+settings.repName+'\\s+:\\s+(\\d+).*');
                     
                          if (ver.phpbb3 || ver.punbb || ver.invision || ver.modernbb) {
                              if (ver.phpbb3 || ver.invision || ver.modernbb) { 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('.avatar').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 changed the text from under name to under avatar





avatar
APE
Manager
Manager

Male Posts : 10679
Reputation : 997
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

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

Back to top Go down

Solved Re: Add a bar for Reputation

Post by smurfavr on July 5th 2017, 2:05 pm

APE wrote:The reason you don't have it on all the profiles as the one you are pointing at is -2
Here all the points are positive.
1.

2. So the code does not work.


PSP

From what rows to change these inscriptions?
Spoiler:
avatar
smurfavr
Active Poster

Male Posts : 1568
Reputation : 13
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Add a bar for Reputation

Post by Justice™ on July 6th 2017, 10:16 am

To edit the texts, look for this in the code:
Code:

 $(this).find('#repu').attr('title','Reputation level ' + $(this).find('#rLv').length + '\nNext : (' + next + ')');
Change Reputation level and Next to whatever you want the texts to be.
avatar
Justice™
Forumember

Posts : 515
Reputation : 117
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Solved Re: Add a bar for Reputation

Post by smurfavr on July 9th 2017, 4:59 pm

Thank you Wolfuryo

up
The reason you don't have it on all the profiles as the one you are pointing at is -2 [/quote]
Here all the points are positive.
1.

2. So the code does not work.
avatar
smurfavr
Active Poster

Male Posts : 1568
Reputation : 13
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Add a bar for Reputation

Post by smurfavr on July 10th 2017, 8:19 am

The problem was setting the code.
lv1 : 10, <---> lv1 : 1,
avatar
smurfavr
Active Poster

Male Posts : 1568
Reputation : 13
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Add a bar for Reputation

Post by APE on July 10th 2017, 11:49 am

give this code a try

Code:
// REPUTATION BAR
 $(document).ready(function() {
               
                  var version = 'phpBB2';
               
                  var settings = {
                      repName : 'Reputation',
                      repStyle : 'block',
                      repImage : 'https://i.servimg.com/u/f57/18/21/41/30/star12.png'
                    };
     
      var repLv = {
          lv1 : 1,
                      lv2 : 2,
                      lv3 : 3,
                      lv4 : 4,
                      lv5 : 5,
                      lv6 : 6,
                      lv7 : 7,
                      lv8 : 8,
                      lv9 : 9,
                      lv10 : 10
        };
     
      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+:\\s+(\\d+)[\\s\\S]*');
   
        if (ver.phpbb3 || ver.punbb || ver.invision || ver.modernbb) {
                      if (ver.phpbb3 || ver.invision || ver.modernbb) { 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 + ')');
                      });
                    }
                });
// END OF CODE
EDIT:
OOPS i see you fixed it before i could post back

Please remember to mark your threads as solved if they are solved for you

Thank you.

APE



avatar
APE
Manager
Manager

Male Posts : 10679
Reputation : 997
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

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

Back to top Go down

Solved Re: Add a bar for Reputation

Post by smurfavr on July 10th 2017, 1:32 pm

It only remains to be done.

How do I make a reputation under the avatars, not above it?
avatar
smurfavr
Active Poster

Male Posts : 1568
Reputation : 13
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Add a bar for Reputation

Post by smurfavr on July 13th 2017, 10:54 am

smurfavr wrote:It only remains to be done.

How do I make a reputation under the avatars, not above it?
@Ange Tuteur


Last edited by smurfavr on July 15th 2017, 12:53 pm; edited 2 times in total
avatar
smurfavr
Active Poster

Male Posts : 1568
Reputation : 13
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Add a bar for Reputation

Post by smurfavr on July 15th 2017, 12:52 pm

Can it be done at any reputation level to show some rank?

Demo
avatar
smurfavr
Active Poster

Male Posts : 1568
Reputation : 13
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Add a bar for Reputation

Post by smurfavr on July 23rd 2017, 11:54 am

Up
avatar
smurfavr
Active Poster

Male Posts : 1568
Reputation : 13
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Add a bar for Reputation

Post by Daemon on July 23rd 2017, 4:11 pm

avatar
Daemon
Forumember

Posts : 51
Reputation : 29
Language : Português

Back to top Go down

Solved Re: Add a bar for Reputation

Post by smurfavr on July 23rd 2017, 4:53 pm

Thank you Daemon.
avatar
smurfavr
Active Poster

Male Posts : 1568
Reputation : 13
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: Add a bar for Reputation

Post by APE on July 23rd 2017, 5:16 pm

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



avatar
APE
Manager
Manager

Male Posts : 10679
Reputation : 997
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

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

Back to top Go down

View previous topic View next topic Back to top


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