Facebook  Twitter 

SMFHacks.com

+- +-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 12388
Latest: Rands
New This Month: 5
New This Week: 0
New Today: 0
Stats
Total Posts: 40314
Total Topics: 7100
Most Online Today: 97
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 52
Total: 52

Author Topic: Number of Friend Bagde not working...  (Read 2081 times)

0 Members and 1 Guest are viewing this topic.

Offline shuban

  • Hero Member
  • *****
  • Posts: 657
    • View Profile
    • Homework Clinic - Your Academic Lifeline
Number of Friend Bagde not working...
« on: June 05, 2012, 09:29:20 pm »
I'm trying to incorporate a friend badge and came up with this:

Code: [Select]
$badgeAction = 'friend100';
if ($memberContext[$memberID]['buddies_data'] >= 100 && !in_array($badgeAction,$currentBadges))
{
$badgeID = GetBadgeIDByAction($badgeAction);
$ret = AddBadgeToMember($memberID,$badgeID,false);
if ($ret == true)
{
$currentBadges[] = $badgeAction;
$newBadges[]  = $badgeAction;
}

}

What am I doing wrong here? Everyone is getting it even though the code says you need 100 friends to get it.

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 15151
    • View Profile
Re: Number of Friend Bagde not working...
« Reply #1 on: June 05, 2012, 09:41:17 pm »
Change to something like this
Code: [Select]

if ($memberContext[$memberID]['buddies_data'] >= 100 && !in_array($badgeAction,$currentBadges))
To
Code: [Select]

if (count($memberContext[$memberID]['buddies']) > 100 && !in_array($badgeAction,$currentBadges))

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 shuban

  • Hero Member
  • *****
  • Posts: 657
    • View Profile
    • Homework Clinic - Your Academic Lifeline
Re: Number of Friend Bagde not working...
« Reply #2 on: June 05, 2012, 09:53:19 pm »
I kept the >= and it worked, thank you :)

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 15151
    • View Profile
Re: Number of Friend Bagde not working...
« Reply #3 on: June 05, 2012, 09:54:42 pm »
Glad to help.
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
2 Replies
6444 Views
Last post October 05, 2006, 03:07:00 pm
by Rocket 442
4 Replies
3150 Views
Last post July 10, 2007, 11:57:22 pm
by cgtemple
8 Replies
7302 Views
Last post July 01, 2008, 07:34:04 pm
by rgsknr
1 Replies
2150 Views
Last post June 30, 2008, 08:03:08 pm
by SMFHacks
2 Replies
5617 Views
Last post January 25, 2012, 12:53:58 pm
by DimTwinkle

+- Recent Topics

Quality of images after import by SMFHacks
September 05, 2020, 10:21:44 am

How do I download gallery images? by CWVRV
August 30, 2020, 11:50:07 pm

Deleting Empty Galleries by SMFHacks
August 30, 2020, 11:43:32 am

PHP error by davejo
August 25, 2020, 07:35:13 am

Permissions to list ads and buy items by CWVRV
August 21, 2020, 05:19:45 pm

Doubt with download permissions. by Rock Lee
August 20, 2020, 08:23:24 pm

Attachment images Upsidedown or Sideways by SMFHacks
August 18, 2020, 05:41:07 pm

[Mod]Avatars Display Integration by Hatshepsut
August 17, 2020, 11:39:54 pm

Simple Portal Block - Classifieds by SMFHacks
August 16, 2020, 09:56:48 am

SMF Links by SMFHacks
August 16, 2020, 08:03:42 am

Powered by EzPortal