SMFHacks.com
SMFHacks
Community Suite
SMF Gallery Pro
SMF Store
SMF Classifieds
Newsletter Pro
Downloads System Pro
Ad Seller Pro
Badge Awards
Hacks and Mods
Latest SMF Hacks
TopTen Hacks
Styles and Themes
Add a Hack
Manage Hacks
Earn Money from Your Forum with these tips
SMF Theme Generator
SMF Package Parser
Free SMF Hosting
Buy Website Traffic
Site Showcase
Email Marketing Software
Search Forums
Advanced search
User
Welcome,
Guest
. Please
login
or
register
.
May 18, 2013, 04:10:05 am
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Stats
Members
Total Members: 10755
Latest:
henrywilliams0173
Stats
Total Posts: 32348
Total Topics: 5473
Online Today: 50
Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Users: 0
Guests: 44
Total: 44
SMFHacks.com
Forum
Badge Awards
Support
How to create a participation badge
0 Members and 1 Guest are viewing this topic.
« previous
next »
Pages:
[
1
]
Author
Topic: How to create a participation badge (Read 923 times)
shuban
Badge Awards Customer
Full Member
Offline
Posts: 163
How to create a participation badge
«
on:
June 24, 2012, 09:31:21 pm »
I'd like to create a participation badge where you're given a badge based on how many times a member has particpated in the forum.
For instance, a member could have 50 posts, but those posts were only made in 7 topics total. Therefore, they have participated 7 times.
Or, in the same way, the member may have 50 posts and 3 topics, so it would be 10 times participated.
How could this be done?
Logged
Biology-Forums.com - For All Your Science Needs
SMFHacks
Administrator
Hero Member
Offline
Posts: 10987
Re: How to create a participation badge
«
Reply #1 on:
June 25, 2012, 11:53:21 am »
What do you mean by participated? Number of topics?
Either way it would be done by an SQL query to get the criteria that you are basing the participation on.
Logged
shuban
Badge Awards Customer
Full Member
Offline
Posts: 163
Re: How to create a participation badge
«
Reply #2 on:
June 25, 2012, 12:49:39 pm »
Quote from: SMFHacks on June 25, 2012, 11:53:21 am
What do you mean by participated? Number of topics?
Either way it would be done by an SQL query to get the criteria that you are basing the participation on.
Participation, as in, how many topics you've been a part of.
Like, you could have 6 posts in total, but those 6 posts were made in 2 topics. So essentially, you've only participated in two discussions.
Do you get what I mean?
Logged
Biology-Forums.com - For All Your Science Needs
SMFHacks
Administrator
Hero Member
Offline
Posts: 10987
Re: How to create a participation badge
«
Reply #3 on:
June 25, 2012, 12:56:15 pm »
A query like this should do it
Code:
SELECT count(distinct id_topic) as total from smf_messages where id_member = ####memberidhere####
Logged
shuban
Badge Awards Customer
Full Member
Offline
Posts: 163
Re: How to create a participation badge
«
Reply #4 on:
June 25, 2012, 12:57:43 pm »
Quote from: SMFHacks on June 25, 2012, 12:56:15 pm
A query like this should do it
Code:
SELECT count(distinct id_topic) as total from smf_messages where id_member = ####memberidhere####
YES! You're right...
But, where would I place this? And how could I implement this in badgeawards.php?
Logged
Biology-Forums.com - For All Your Science Needs
SMFHacks
Administrator
Hero Member
Offline
Posts: 10987
Re: How to create a participation badge
«
Reply #5 on:
June 25, 2012, 01:00:23 pm »
It would be in the same area as the topic starter badges/post badges in the badgewards php file.
Logged
shuban
Badge Awards Customer
Full Member
Offline
Posts: 163
Re: How to create a participation badge
«
Reply #6 on:
June 25, 2012, 01:12:10 pm »
I tried this:
Code:
// Participation Awards
$badgeAction = 'participation10';
if ($memberContext[$memberID]['topic_count'] >= 10 && !in_array($badgeAction,$currentBadges))
{
$result = db_query("
SELECT COUNT(distinct id_topic) AS total FROM {$db_prefix}smf_messages WHERE ID_MEMBER = $memberID
", __FILE__, __LINE__);
$totalRow = mysql_fetch_assoc($result);
if ($totalRow['total'] > 0)
{
$badgeID = GetBadgeIDByAction($badgeAction);
$ret = AddBadgeToMember($memberID,$badgeID,false);
if ($ret == true)
{
$currentBadges[] = $badgeAction;
$newBadges[] = $badgeAction;
}
}
}
But nothing happened
What am I doing wrong?
Logged
Biology-Forums.com - For All Your Science Needs
SMFHacks
Administrator
Hero Member
Offline
Posts: 10987
Re: How to create a participation badge
«
Reply #7 on:
June 25, 2012, 01:14:48 pm »
Get rid of $memberContext[$memberID]['topic_count'] >= 10 &&
Or change to
$memberContext[$memberID][posts'] > 0 &&
Logged
SMFHacks
Administrator
Hero Member
Offline
Posts: 10987
Re: How to create a participation badge
«
Reply #8 on:
June 25, 2012, 01:15:30 pm »
Right now the way you have it coded will give anyone who ever made a post a badge... not sure if that's what you want...
if ($totalRow['total'] > 0)
That part above is key you can have different badges depending on a total number...
Logged
shuban
Badge Awards Customer
Full Member
Offline
Posts: 163
Re: How to create a participation badge
«
Reply #9 on:
June 25, 2012, 01:23:46 pm »
I think this did the trick, for now
Code:
// Participation Awards // Still needs work
$badgeAction = 'participation10';
if ($memberContext[$memberID]['posts'] != 0 && !in_array($badgeAction,$currentBadges))
{
$result = db_query("
SELECT COUNT(distinct id_topic) AS total FROM {$db_prefix}messages WHERE ID_MEMBER = $memberID
", __FILE__, __LINE__);
$totalRow = mysql_fetch_assoc($result);
if ($totalRow['total'] >= 10)
{
$badgeID = GetBadgeIDByAction($badgeAction);
$ret = AddBadgeToMember($memberID,$badgeID,false);
if ($ret == true)
{
$currentBadges[] = $badgeAction;
$newBadges[] = $badgeAction;
}
}
}
Logged
Biology-Forums.com - For All Your Science Needs
Pages:
[
1
]
« previous
next »
Jump to:
Please select a destination:
-----------------------------
SMFHacks.com
-----------------------------
=> News
=> Site Discussion
===> Suggestions
===> Bugs
-----------------------------
SMF Gallery Pro
-----------------------------
=> Announcements
=> Presales
=> Support
===> Bugs
===> Feature Requests
-----------------------------
SMF Store
-----------------------------
=> Announcements
=> Presales
=> Support
===> Guides and Tips
===> Feature Requests
===> Bugs
-----------------------------
SMF Classifieds
-----------------------------
=> Announcements
=> Presales
=> Support
===> Bugs
===> Feature Requests
-----------------------------
Downloads System Pro
-----------------------------
=> Announcements
=> Presales
=> Support
===> Feature Requests
===> Bugs
-----------------------------
Ad Seller Pro
-----------------------------
=> Presales
=> Support
-----------------------------
Menu Editor Pro
-----------------------------
=> Presales Menu Editor Pro
=> Bug Reports
-----------------------------
Inline Personal Messages
-----------------------------
=> Presales
=> Support
=> Bug Reports
-----------------------------
Newsletter Pro
-----------------------------
=> Presales
=> Support
===> Feature Requests
-----------------------------
Badge Awards
-----------------------------
=> Presales
=> Support
-----------------------------
Tweet Topics/FB Post System
-----------------------------
=> Presales
-----------------------------
Social Login Pro
-----------------------------
=> Presales
-----------------------------
SMF Gallery Lite
-----------------------------
=> SMF Gallery Lite
-----------------------------
Modifications/Themes
-----------------------------
=> General SMF Forum
=> Modifications Talk
===> Latest Mods
===> Modification Showcase
=> Theme Talk
===> Theme Showcase
===> Latest Themes
Recent
Feature Requests for SMF ...
by
Secure
[May 16, 2013, 10:13:46 pm]
stuck on "Processing" scr...
by
SMFHacks
[May 15, 2013, 11:32:14 pm]
[Request] - Award for any...
by
SMFHacks
[May 15, 2013, 11:31:24 pm]
SMF Gallery Pro 5.0.1 not...
by
SMFHacks
[May 12, 2013, 09:10:43 am]
Golf Theme
by
Serglike
[May 10, 2013, 03:49:55 am]
Display ads on every page...
by
SMFHacks
[May 07, 2013, 07:12:40 pm]
Edited simple ad code and...
by
ApplianceJunk
[May 07, 2013, 02:37:14 pm]
"non" error on bulk uploa...
by
SMFHacks
[May 06, 2013, 10:29:56 pm]
Can I give member an ad p...
by
fernowl
[May 04, 2013, 03:22:01 pm]
How to configure the Auto...
by
SMFHacks
[May 04, 2013, 01:08:57 pm]
Random Picture
Donate to SMFHacks.com
Help Support the SMFHacks.com mod making.
Loading...