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 19, 2013, 05:14:59 pm
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Stats
Members
Total Members: 10758
Latest:
murdocklawless
Stats
Total Posts: 32349
Total Topics: 5474
Online Today: 60
Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Users: 1
Guests: 44
Total: 45
SMFHacks.com
Forum
Badge Awards
Presales
Badges Displayed in Profile
0 Members and 1 Guest are viewing this topic.
« previous
next »
Pages:
[
1
]
2
Author
Topic: Badges Displayed in Profile (Read 1234 times)
shuban
Badge Awards Customer
Full Member
Offline
Posts: 163
Badges Displayed in Profile
«
on:
June 02, 2012, 02:58:08 pm »
I purchased the software, at your convenience, could you provide me the profile.template.php code that displays all the badges earned?
Thank you
Logged
Biology-Forums.com - For All Your Science Needs
SMFHacks
Administrator
Hero Member
Offline
Posts: 10987
Re: Badges Displayed in Profile
«
Reply #1 on:
June 02, 2012, 03:04:20 pm »
Try this
Example code with caching. Just need to pass in/set $memberID
Code:
global $modSettings, $db_prefix, $boardurl;
if (empty($modSettings['badgeawards_url']))
$modSettings['badgeawards_url'] = $boardurl . '/badges/';
$badgesCache = array();
if (($badgesCache = cache_get_data('badge_display_' . $memberID, 60)) == null)
{
$result = db_query("
SELECT
b.id_badge, b.title, b.image, b.enabled, l.date
FROM ({$db_prefix}badgeawards_badges as b, {$db_prefix}badgeawards_badge_log as l)
WHERE l.id_badge = b.id_badge AND l.ID_MEMBER = $memberID
ORDER BY l.id_log DESC
LIMIT $maxToShow
", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($result))
{
$badgesCache[] = $row;
}
cache_put_data('badge_display_' . $memberID, $badgesCache, 60);
}
// Tweak this loop for display
foreach($badgesCache as $row)
{
echo '<img src="' . $modSettings['badgeawards_url'] . $row['image'] . '" alt="' . $row['title'] . '" title="' . $row['title'] . '" /> ';
}
['code]
Logged
shuban
Badge Awards Customer
Full Member
Offline
Posts: 163
Re: Badges Displayed in Profile
«
Reply #2 on:
June 02, 2012, 03:21:35 pm »
Got an error
Code:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY l.id_log DESC
LIMIT' at line 5
File:
SELECT
b.id_badge, b.title, b.image, b.enabled, l.date
FROM ({$db_prefix}badgeawards_badges as b, {$db_prefix}badgeawards_badge_log as l)
WHERE l.id_badge = b.id_badge AND l.ID_MEMBER = $memberID
ORDER BY l.id_log DESC
LIMIT $maxToShow
", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($result))
Line 998 is
", __FILE__, __LINE__);
Logged
Biology-Forums.com - For All Your Science Needs
SMFHacks
Administrator
Hero Member
Offline
Posts: 10987
Re: Badges Displayed in Profile
«
Reply #3 on:
June 02, 2012, 03:23:56 pm »
Remove
LIMIT $maxToShow
Logged
shuban
Badge Awards Customer
Full Member
Offline
Posts: 163
Re: Badges Displayed in Profile
«
Reply #4 on:
June 02, 2012, 03:26:52 pm »
Now I get this:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY l.id_log DESC' at line 5
Code:
$result = db_query("
SELECT
b.id_badge, b.title, b.image, b.enabled, l.date
FROM ({$db_prefix}badgeawards_badges as b, {$db_prefix}badgeawards_badge_log as l)
WHERE l.id_badge = b.id_badge AND l.ID_MEMBER = $memberID
ORDER BY l.id_log DESC
", __FILE__, __LINE__);
Error on ", __FILE__, __LINE__);
This is for
1.x
Logged
Biology-Forums.com - For All Your Science Needs
SMFHacks
Administrator
Hero Member
Offline
Posts: 10987
Re: Badges Displayed in Profile
«
Reply #5 on:
June 02, 2012, 03:28:59 pm »
Are you setting $memberID = to anything before calling the query?
It should be set to the member id of the profile you are viewing.
Logged
shuban
Badge Awards Customer
Full Member
Offline
Posts: 163
Re: Badges Displayed in Profile
«
Reply #6 on:
June 02, 2012, 03:31:11 pm »
No, what do I set $memberID to?
Logged
Biology-Forums.com - For All Your Science Needs
shuban
Badge Awards Customer
Full Member
Offline
Posts: 163
Re: Badges Displayed in Profile
«
Reply #7 on:
June 02, 2012, 03:33:06 pm »
HEre's my profile.template...
I added the code to it already, just search for it...
«
Last Edit: June 02, 2012, 03:42:04 pm by shuban
»
Logged
Biology-Forums.com - For All Your Science Needs
SMFHacks
Administrator
Hero Member
Offline
Posts: 10987
Re: Badges Displayed in Profile
«
Reply #8 on:
June 02, 2012, 03:35:48 pm »
Before
$badgesCache = array();
Add
Code:
$memberID = $context['member']['id'];
Logged
shuban
Badge Awards Customer
Full Member
Offline
Posts: 163
Re: Badges Displayed in Profile
«
Reply #9 on:
June 02, 2012, 03:41:50 pm »
Quote from: SMFHacks on June 02, 2012, 03:35:48 pm
Before
$badgesCache = array();
Add
Code:
$memberID = $context['member']['id'];
Looks great...
Logged
Biology-Forums.com - For All Your Science Needs
shuban
Badge Awards Customer
Full Member
Offline
Posts: 163
Re: Badges Displayed in Profile
«
Reply #10 on:
June 02, 2012, 05:23:56 pm »
If I disable a badge, is it possible to not have it show up in people's profiles who have already earned it?
For instance, I disabled the "Level 1 Badge", but it's still showing up in people's profiles that they still have it
Logged
Biology-Forums.com - For All Your Science Needs
SMFHacks
Administrator
Hero Member
Offline
Posts: 10987
Re: Badges Displayed in Profile
«
Reply #11 on:
June 02, 2012, 05:32:21 pm »
Find
Code:
WHERE l.id_badge = b.id_badge AND l.ID_MEMBER = $memberID
Change
Code:
WHERE l.id_badge = b.id_badge AND l.ID_MEMBER = $memberID and b.enabled = 1
Logged
shuban
Badge Awards Customer
Full Member
Offline
Posts: 163
Re: Badges Displayed in Profile
«
Reply #12 on:
June 02, 2012, 05:54:55 pm »
Worked, thank you
Members are really starting to like this!
Logged
Biology-Forums.com - For All Your Science Needs
SMFHacks
Administrator
Hero Member
Offline
Posts: 10987
Re: Badges Displayed in Profile
«
Reply #13 on:
June 02, 2012, 05:58:12 pm »
No problem. There is a lot you can do exceptionally with custom badges. Kinda makes the forum a mini game and people try to earn them all.
Logged
shuban
Badge Awards Customer
Full Member
Offline
Posts: 163
Re: Badges Displayed in Profile
«
Reply #14 on:
June 02, 2012, 06:00:12 pm »
Quote from: SMFHacks on June 02, 2012, 05:58:12 pm
No problem. There is a lot you can do exceptionally with custom badges. Kinda makes the forum a mini game and people try to earn them all.
People sent me 10's of requests lol
Logged
Biology-Forums.com - For All Your Science Needs
Pages:
[
1
]
2
« 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
sa facebook integration c...
by
murdocklawless
[
Today
at 07:03:27 am]
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]
Random Picture
Donate to SMFHacks.com
Help Support the SMFHacks.com mod making.
Loading...