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
.
June 20, 2013, 02:48:36 am
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Stats
Members
Total Members: 10808
Latest:
smfhacks77
Stats
Total Posts: 32570
Total Topics: 5511
Online Today: 43
Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Users: 1
Guests: 33
Total: 34
smfhacks77
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 978 times)
shuban
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: 11056
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
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: 11056
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
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: 11056
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
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: 11056
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: 11056
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
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
Nike FREE 3.0 V2 Damen La...
by
smfhacks77
[
Today
at 02:05:58 am]
MBT Tataga Womens Shoes N...
by
smfhacks77
[
Today
at 02:02:45 am]
Feature Requests for SMF ...
by
SMFHacks
[June 19, 2013, 10:08:41 pm]
A few problems with Ad Se...
by
SMFHacks
[June 19, 2013, 10:08:05 pm]
Showing Badge Icons on Bo...
by
SMFHacks
[June 19, 2013, 10:06:16 pm]
Badge block
by
SMFHacks
[June 19, 2013, 07:25:45 pm]
Rebadging after install
by
SMFHacks
[June 19, 2013, 07:19:48 pm]
WhatÄs this?
by
Labradoodle-360
[June 19, 2013, 01:36:26 pm]
Can "Ad Seller Pro" do it...
by
SMFHacks
[June 18, 2013, 07:27:33 am]
paid auctions
by
SMFHacks
[June 17, 2013, 12:27:50 pm]
Random Picture
Donate to SMFHacks.com
Help Support the SMFHacks.com mod making.
Loading...