Notes with Ravinder on Badging System Development Part II

Tags
badges, badging system, css, development, forum development, html, jquery, new-badge-system-phaseii, php, system, underground, web programming

 
Thread Tools Search this Thread
# 22  
Old 2 Weeks Ago
Another one bites the dust.... prototype badge "discussions started in the last month" ...

Code:
<?php
$monthtq = "SELECT COUNT(threadid) AS threadcount from thread where firstpostid=" . $uid . " and  dateline > " . $one_month_ago;
$monththreads = $vbulletin->db->query_first($monthtq);
if ($monththreads['threadcount'] >= 4) {
    $color['faterminal'] = 'black';
} elseif ($monththreads['threadcount'] >= 5) {
    $color['faterminal'] = 'indigo';
} elseif ($monththreads['threadcount'] >= 2) {
    $color['faterminal'] = 'blue';
} elseif ($monththreads['threadcount'] >= 1) {
    $color['faterminal'] = 'limegreen';
} else {
    $color['faterminal'] = 'lightgray';
}

$badgejs .= 'badge["faterminal"] = "' . $color['faterminal'] . '";';
$badgejs .= 'badge["faterminalval"] = "' . number_format($monththreads['threadcount']) . '";';

jQuery:

Code:
$('.fa-terminal').css("color",badge["faterminal"]);
$('.fa-terminal').css("cursor","pointer").attr("title",  badge["faterminalval"] + " Discussions Started in the Last Month");
$('.fa-terminal').closest('div').find('.fa-circle').css("color",badge["faterminal"]);

9 out of 48 protos left .. Smilie
# 23  
Old 2 Weeks Ago
OK... prototype "thanks per month" badge is done:

Code:
$thanksmq = "SELECT SUM(post_thanks_amount) AS monthlythanks from post where userid=" . $uid . " and  dateline > " . $one_month_ago; 
$monththanks = $vbulletin->db->query_first($thanksmq); 
if ($monththanks['monthlythanks'] >= 10) { 
    $color['farocket'] = 'black'; 
} elseif ($monththanks['monthlythanks'] >= 5) { 
    $color['farocket'] = 'indigo'; 
} elseif ($monththanks['monthlythanks'] >= 2) { 
    $color['farocket'] = 'blue'; 
} elseif ($monththanks['monthlythanks'] >= 1) { 
    $color['farocket'] = 'limegreen'; 
} else { 
    $color['farocket'] = 'lightgray'; 
} 

$badgejs .= 'badge["farocket"] = "' . $color['farocket'] . '";'; 
$badgejs .= 'badge["farocketval"] = "' . number_format($monththanks['monthlythanks']) . '";';

jQuery:

Code:
$('.fa-rocket').css("color",badge["farocket"]);
$('.fa-rocket').css("cursor","pointer").attr("title",  badge["farocketval"] + " Thanks in the Last Month");
$('.fa-rocket').closest('div').find('.fa-circle').css("color",badge["farocket"])

I think that leaves 7 proto-badges to go ... Smilie
# 24  
Old 2 Weeks Ago
Also, light press on mobile gives info on each badge:

Image
# 25  
Old 2 Weeks Ago
Ravinder,

Please write the logic for the "current number of consecutive days active on the forums" ....

If you need a new MySQL table please specific the table definition and I will create it.

Thanks!
# 26  
Old 2 Weeks Ago
Quote:
Originally Posted by Neo
Ravinder,
Please write the logic for the "current number of consecutive days active on the forums" ....
If you need a new MySQL table please specific the table definition and I will create it.
Thanks!
Thanks a TON Neo for coding all these badges,sorry I am not having proper access in office(only IE is there so not able to perform anything).

For writing logic for consecutive days one,is it ok if I first present logic rather than code(as I know php which I learnt from you in last few days, I know I could write logic for it. Please do give me an hour or so I will write it here.

EDIT: Also request you to edit string so that it will be clear that people received THANKS from others, may be as follows. Ahhh if I would have access in office today I would have tried to write 1 of them.

Code:
$('.fa-rocket').css("cursor","pointer").attr("title",  badge["farocketval"] + " Thanks received in the Last Month");


Thanks,
R. Singh

Last edited by RavinderSingh13; 2 Weeks Ago at 08:51 AM..
This User Gave Thanks to RavinderSingh13 For This Post:
Neo (2 Weeks Ago)
# 27  
Old 2 Weeks Ago
Quote:
Originally Posted by RavinderSingh13
For writing logic for consecutive days one,is it ok if I first present logic rather than code(as I know php which I learnt from you in last few days, I know I could write logic for it. Please do give me an hour or so I will write it here.
No. Hurry.

Take your time. Glad you like the three new badges... Smilie
# 28  
Old 2 Weeks Ago
OK... Ravinder... updated the rocket:

Code:
$('.fa-rocket').css("cursor","pointer").attr("title",  badge["farocketval"] + " Thanks Received in the Last Month");

This User Gave Thanks to Neo For This Post:
RavinderSingh13 (2 Weeks Ago)

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Badging System: UNIX.COM Bug Hunter Badge (New) Neo What is on Your Mind? 0 1 Day Ago 08:29 AM
Status of Badging System - Beta 1 Neo What is on Your Mind? 4 6 Days Ago 11:07 PM
Ravinder Singh Just Earned His Green Web Dev Ops Badge Neo What is on Your Mind? 6 2 Weeks Ago 02:12 PM
Please Welcome Ravinder Singh to the Moderation Team Neo What is on Your Mind? 8 2 Weeks Ago 12:15 AM
New Badging System - Badges Prototype Beta 1 (Badges Only) Neo What is on Your Mind? 38 2 Weeks Ago 10:43 AM
SCO Development System for System V 3.2 R4.2 locovich SCO 3 02-21-2017 05:24 PM