SMFHacks.com
Badge Awards => Support => Topic started by: balon on October 03, 2015, 03:58:00 pm
-
Hello,
My forum has been using the SMF-Awards system for quite some time now, almost 5 months, and we've enjoyed it since our original release to our userbase.
As the Holidays approach, I'd like to be able to implement a "Halloween 2015", "Christmas 2015" badge, etc.
My original idea, go in the database, and give all the users on that day the badge. But if there is an easier way to do this, so I do not need to manually edit it, that would be great.
This will allow me to easier issue badges, like a 2-year anniversary, to only users registered for exactly 2 years on that day, instead of something like the account-birthday, which everyone will "eventually" get.
Thanks!
-
All these things are possible with badge awards
This will allow me to easier issue badges, like a 2-year anniversary, to only users registered for exactly 2 years on that day, instead of something like the account-birthday, which everyone will "eventually" get.
We have that built in for the first 10 years. Auto anniversary badges that are based on the date of registration
Badge awards has a way to manually assign a badge to a user
As the Holidays approach, I'd like to be able to implement a "Halloween 2015", "Christmas 2015" badge, etc.
Also it might be possible to do auto badges for every holiday as well such as Christmas badge awarded on the 25th of december each year
-
Do you still take custom-badge requests? I saw the thread, if I can get a base-code for Holidays, it'd be easier to duplicate down the line.
I wouldn't need the graphics, just the base code and the action, for X date, any user registered can get the award.
So any users registered on October 31, 2015 (or before) would get the Halloween award.
Making it a limited edition badge.
-
Yeah I could do that request.
-
Hello, I was very busy with school.
So I am interested in first where I can set October 31, 2015 to give out Halloween 2015 Awards to anyone who logs in on this day.
And I am interested in something where I can say, anyone registered before Jan 1, 2015 would get x Award. Where I could rebadge for that action.
I wouldn't need the designs for either, as my staff can do that.
Could you give me a price here or via PM? Also, once I purchase them, would it be alright if I make a post and share them on these forums, open source. As I have no issue paying for the work, but if I could share these two concepts for others, it'd be pretty cool.
Thanks!
-
I would love to have this and I'll probably add it to my forum when I have time.
But I'm curious, how do you handle a leap year? Or are you just using the specific date?
-
in sources/badgeawards2.php
Find
[code]
$badgeAction = 'anniversary10';
$regTime = time() - 10 * 365 * 24 * 60 * 60;
if ($memberContext[$memberID]['registered_timestamp'] <= $regTime && !in_array($badgeAction,$currentBadges))
{
$badgeID = GetBadgeIDByAction($badgeAction);
$ret = AddBadgeToMember($memberID,$badgeID,false);
if ($ret == true)
{
$currentBadges[] = $badgeAction;
$newBadges[] = $badgeAction;
}
}
Add
Replace yournewbadgeactionhere with the action of your new badge
And change the "October 31, 2015 11:59pm"
$badgeAction = 'yournewbadgeactionhere';
$regTime = strtotime("October 31, 2015 11:59pm");
if ($memberContext[$memberID]['registered_timestamp'] <= $regTime && !in_array($badgeAction,$currentBadges))
{
$badgeID = GetBadgeIDByAction($badgeAction);
$ret = AddBadgeToMember($memberID,$badgeID,false);
if ($ret == true)
{
$currentBadges[] = $badgeAction;
$newBadges[] = $badgeAction;
}
}
This code awards any person with that badge previous of the date
-
Thanks
-
Thank you for this!
I just want to confirm before adding this, that it should not be <= regTime, as wouldn't we be looking for everything before October 31?
I read further down and found this.
Second... Would you be able to do a holiday-badge sometime this week? (If not, this current one will definitely do!)
So if you log in on the day October 31, 2015, you get a badge?
I'd assume I need to pay for this one, which is completely fine (I will not need the graphics), can you go about telling me how to pay for this, and on completion would you mind just posting it here for other who may wish to have this?
Thanks a ton!
-
exact date would be
$badgeAction = 'yournewbadgeactionhere';
$regTimeStart = strtotime("October 31, 2015 12:00am");
$regTimeEnd = strtotime("October 31, 2015 11:59pm");
if ( ($memberContext[$memberID]['registered_timestamp'] >= $regTimeStart && $memberContext[$memberID]['registered_timestamp'] <= $regTimeEnd) && !in_array($badgeAction,$currentBadges))
{
$badgeID = GetBadgeIDByAction($badgeAction);
$ret = AddBadgeToMember($memberID,$badgeID,false);
if ($ret == true)
{
$currentBadges[] = $badgeAction;
$newBadges[] = $badgeAction;
}
}
-
Well awesome, now we have two amazing ones..
But I meant, can you make one that if you log into the website on that day, not just register.
I'd assume we'd use something to trigger the login, similar to what's in invisible, etc, but I'm not completely experienced with PHP.
-
That's a harder would need to be added to checklogin code, cookie.