Facebook  Twitter 

SMFHacks.com

+- +-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 12284
Latest: arthurheller99
New This Month: 11
New This Week: 0
New Today: 0
Stats
Total Posts: 39527
Total Topics: 6963
Most Online Today: 64
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 65
Total: 65

Author Topic: KARMA Badge  (Read 2418 times)

0 Members and 1 Guest are viewing this topic.

Offline FrizzleFried

  • Full Member
  • ***
  • Posts: 120
    • View Profile
KARMA Badge
« on: August 09, 2012, 01:49:07 pm »
My users are getting the karma badge automatically when they first sign in.  I am guessing this is because I use the advanced reputation mod that starts everyone with 100 karma points.  I'd like to set that limit from 0 to 101 so they get the badge when someone gives them karma rather than up front...

I found this line:

Code: [Select]
if ($memberContext[$memberID]['karma']['good'] != 0 && !in_array($badgeAction,$currentBadges))
Would I be correct in assuming I could change that 0 to 101 to accomplish what I am looking to do?

Thanks!

Offline FrizzleFried

  • Full Member
  • ***
  • Posts: 120
    • View Profile
Re: KARMA Badge
« Reply #1 on: August 10, 2012, 03:04:41 pm »
Oh... and to be clear... the advanced rep mod does use the "stock" karma string... but like I said,  I have it starting folks with 100 karma to begin with.

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14786
    • View Profile
Re: KARMA Badge
« Reply #2 on: August 10, 2012, 03:23:40 pm »
I would change != 0 to > 100
I think that would work.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline FrizzleFried

  • Full Member
  • ***
  • Posts: 120
    • View Profile
Re: KARMA Badge
« Reply #3 on: August 10, 2012, 04:29:05 pm »
Yeah... that works... sort of.  Unfortunately the Advanced Rep System also gives karma for posting... so as soon as I posted while testing my karma went to 102 from 100 and... welp,  I got the karma badge.

Bummer... maybe I will just change it to 200 and in the description change it to "Recipient of this badge has earned 200 Karma Points or more" or something generic...

Offline nonono12

  • SMF Classifieds Customer
  • Newbie
  • *****
  • Posts: 15
    • View Profile
Re: KARMA Badge
« Reply #4 on: October 13, 2018, 08:33:30 pm »
how to set badge for a certain amount of
giving good karma
giving bad karma
and number of topics started ?

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14786
    • View Profile
Re: KARMA Badge
« Reply #5 on: October 14, 2018, 11:19:42 am »
You would have to create  a new badge in the badge awards admin area.

Then check sources/badgeawards2.php  and you will need to copy and change code such as
Code: [Select]
$badgeAction = 'topic';
if ($memberContext[$memberID]['posts'] != 0 && !in_array($badgeAction,$currentBadges))
{
$result = $smcFunc['db_query']('', "
SELECT COUNT(*) AS total FROM {db_prefix}topics 
WHERE ID_MEMBER_STARTED = $memberID
"); 
$totalRow = $smcFunc['db_fetch_assoc']($result);

if ($totalRow['total'] > 0)
{
$badgeID = GetBadgeIDByAction($badgeAction);
$ret = AddBadgeToMember($memberID,$badgeID,false);
if ($ret == true)
{
$currentBadges[] = $badgeAction;
$newBadges[]  = $badgeAction;
}
}

}

And
Code: [Select]

$badgeAction = 'karma';
if ($memberContext[$memberID]['karma']['good'] != 0 && !in_array($badgeAction,$currentBadges))
{
$badgeID = GetBadgeIDByAction($badgeAction);
$ret = AddBadgeToMember($memberID,$badgeID,false);
if ($ret == true)
{
$currentBadges[] = $badgeAction;
$newBadges[]  = $badgeAction;
}

}
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline nonono12

  • SMF Classifieds Customer
  • Newbie
  • *****
  • Posts: 15
    • View Profile
Re: KARMA Badge
« Reply #6 on: October 16, 2018, 04:20:01 pm »
You would have to create  a new badge in the badge awards admin area.

Then check sources/badgeawards2.php  and you will need to copy and change code such as
Code: [Select]
$badgeAction = 'topic';
 if ($memberContext[$memberID]['posts'] != 0 && !in_array($badgeAction,$currentBadges))
 {
 $result = $smcFunc['db_query']('', "
 SELECT COUNT(*) AS total FROM {db_prefix}topics 
 WHERE ID_MEMBER_STARTED = $memberID
 "); 
 $totalRow = $smcFunc['db_fetch_assoc']($result);
 
 if ($totalRow['total'] > 0)
 {
 $badgeID = GetBadgeIDByAction($badgeAction);
 $ret = AddBadgeToMember($memberID,$badgeID,false);
 if ($ret == true)
 {
 $currentBadges[] = $badgeAction;
 $newBadges[]  = $badgeAction;
 }
 }
 
 }

And
Code: [Select]

 $badgeAction = 'karma';
 if ($memberContext[$memberID]['karma']['good'] != 0 && !in_array($badgeAction,$currentBadges))
 {
 $badgeID = GetBadgeIDByAction($badgeAction);
 $ret = AddBadgeToMember($memberID,$badgeID,false);
 if ($ret == true)
 {
 $currentBadges[] = $badgeAction;
 $newBadges[]  = $badgeAction;
 }

 }

but how to say give badge to someone who gave 4 negative karma ?

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14786
    • View Profile
Re: KARMA Badge
« Reply #7 on: October 16, 2018, 04:33:37 pm »
I think  I would just change
$memberContext[$memberID]['karma']['good']
To
$memberContext[$memberID]['karma']['bad']

For the check and see if equals 4
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline nonono12

  • SMF Classifieds Customer
  • Newbie
  • *****
  • Posts: 15
    • View Profile
Re: KARMA Badge
« Reply #8 on: October 17, 2018, 08:02:23 am »
I think  I would just change
$memberContext[$memberID]['karma']['good']
To
$memberContext[$memberID]['karma']['bad']

For the check and see if equals 4

is this for receiving ?
i'm looking to query if they gave good and bad karma

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14786
    • View Profile
Re: KARMA Badge
« Reply #9 on: October 17, 2018, 11:17:16 pm »
I already have actions to give a badge on negative or postiive karma and that is found in sources/Karma.php
Code: [Select]
// Badge Awards
global $sourcedir, $user_info;
require_once($sourcedir . '/badgeawards2.php');
if ($dir == 1)
{
Badges_AwardBadge($user_info['id'],'karmagood');
}
else
{
Badges_AwardBadge($user_info['id'],'karmabad');
}

// End Badge Awards
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

 

Related Topics

  Subject / Started by Replies Last post
0 Replies
2393 Views
Last post November 19, 2007, 11:51:41 am
by jasonwatkins
1 Replies
2849 Views
Last post April 05, 2009, 08:56:50 am
by SMFHacks
1 Replies
1576 Views
Last post June 07, 2012, 05:40:14 pm
by SMFHacks
1 Replies
2450 Views
Last post March 09, 2013, 06:17:38 pm
by RC Storick
5 Replies
3229 Views
Last post May 06, 2015, 08:14:55 pm
by Empire

+- Recent Topics

SMF Gallery Pro and AD Seller Pro now for SMF 2.1.x by SMFHacks
Today at 12:12:54 am

Pretty URLs and 2.1 by SMFHacks
February 18, 2019, 09:40:57 pm

SMF 2.1 RCI & SMF Gallery Pro 8.04 500 Errors by DragonLady
February 18, 2019, 11:49:27 am

Slide show order by SMFHacks
February 17, 2019, 06:04:54 pm

Bulk upload image problem by SMFHacks
February 14, 2019, 11:09:20 pm

Can the old store mod work on SMF 2.1? by SMFHacks
February 13, 2019, 08:58:13 pm

Is it possible for an admin user to upload photos to a nonadmin user's gallery? by 10341mouse
February 13, 2019, 11:15:56 am

[Mod]Push Notifications by shuban
February 06, 2019, 09:18:16 pm

Tinyportal and Mkportal.Which is better? by Oldiesmann
February 06, 2019, 07:23:16 pm

SMF 2.1 RC 1 Released by SMFHacks
February 04, 2019, 06:52:36 pm

Powered by EzPortal