• Administrator
  •  
    Welcome to the new PunBB.biz design forum.

    We decide to switch from Forumotion due to technical limitations.

    Information: Choosing social login option will register your account automatically without need for email confirmation.
     

[JavaScript] IPB Reputation box v2

A place for codes and tutorials which will improve the functionality of your board.
Post Reply
User avatar
Shadow
Administrator
Posts: 19
Joined: Sat Jan 06, 2018 4:56 pm

Sun Jan 07, 2018 1:46 am

Description:
This tutorial will improve the functionalities of default reputation box and add ranks based on post numbers.

Version:
Punbb (Forumotion)

Preview:
Image

Installation steps:
Add the following code to the Javascript:
Placement: In Topics

Code: Select all

jQuery(document).ready(function(){
                jQuery('.user-info .post_field:contains("Reputation")').attr('style','background-color: #dff0d8;
    border-radius: 3px;
    color: #3c763d;
    display: block;
    font-weight: 700;
    margin: 0 auto 5px;
    max-width: 123px;
    padding: 3px 8px;
    text-align: center;');
jQuery(document).ready(function(){
                jQuery('.user-info .post_field:contains("Reputation: 0")').attr('style','background-color:  rgb(222, 222, 222);
    border-radius: 3px;
    color: #6e6e6e;
    display: block;
    font-weight: 700;
    margin: 0 auto 5px;
    max-width: 123px;
    padding: 3px 8px;
    text-align: center;');
 });
   $('.user-info .post_field:contains("Reputation")').each(function(){var rep=$(this).text().match(/\d+/g);$(this).append('<span class="title" style="font-weight:normal"></span>');
        if(rep==0){$(this).find('.title').text('\nNeutral')}
        if(rep>=1&&rep<10){$(this).find('.title').text('\nNewbie')}
        if(rep>=10&&rep<30){$(this).find('.title').text('\nGetting used to fame')}
        if(rep>=30&&rep<50){$(this).find('.title').text('\nBrilliant future')}
        if(rep>=50&&rep<100){$(this).find('.title').text('\nEveryone admire you')}
        if(rep>=100&&rep<200){$(this).find('.title').text('\nHonored elite ')}
        if(rep>=200){$(this).find('.title').text('\nBeyond famous')}})});
Explanation:  if(rep>=1&&rep<10) // means if user have less than 10 reputation points they will have Newbie rank.
if(rep>=10&&rep<30){$(this).find('.title').text('\nGetting used to fame')} If user have less than 30 reputation points they will have "getting used to fame' rank.

You are free to edit for your needs.

IMPORTANT change Reputation and Reputation: 0 field to your language if it's not on English
Closing Notes:

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest