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 25, 2013, 08:15:12 am
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Stats
Members
Total Members: 10769
Latest:
johnnyv_nl
Stats
Total Posts: 32408
Total Topics: 5482
Online Today: 58
Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Users: 1
Guests: 51
Total: 52
johnnyv_nl
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 931 times)
shuban
Badge Awards Customer
Full Member
Offline
Posts: 164
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: 11008
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: 164
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: 11008
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: 164
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: 11008
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: 164
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: 11008
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: 11008
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: 164
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
sending emails
by
ozzie4x4
[May 24, 2013, 10:05:48 pm]
Replace the SMF-Logo on t...
by
SMFHacks
[May 24, 2013, 06:36:59 pm]
Code for ultimate Profile
by
Draffi
[May 24, 2013, 05:22:09 pm]
Parent and children Badge...
by
Draffi
[May 24, 2013, 05:20:20 pm]
Badge block
by
Draffi
[May 24, 2013, 05:11:52 pm]
Why i need a PP-Business-...
by
SMFHacks
[May 23, 2013, 08:29:56 pm]
Simple Audio Video Embede...
by
tuberose
[May 23, 2013, 04:50:21 am]
news letter pro cant find...
by
ozzie4x4
[May 22, 2013, 10:03:30 pm]
Automated newsletter of r...
by
SMFHacks
[May 22, 2013, 03:00:09 pm]
Help me program these awa...
by
Draffi
[May 22, 2013, 03:03:31 am]
Random Picture
Donate to SMFHacks.com
Help Support the SMFHacks.com mod making.
Loading...