Twitter SMFHacks Facebook SMFHacks SMFHacks.com
** Home Forum Index Hacks Products Login Register Search
Welcome, Guest. Please login or register.
May 23, 2013, 10:07:03 pm

Login with username, password and session length
Members
Total Members: 10769
Latest: CayoTTe
Stats
Total Posts: 32394
Total Topics: 5480
Online Today: 69
Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Users: 1
Guests: 48
Total: 49
+ 
|-+ 
| |-+ 
| | |-+ 
| | | |-+ 
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Print
Author Topic: Badge block  (Read 859 times)
Dylert
Inline PM Customer
*****
Offline Offline

Posts: 45



View Profile WWW
« on: September 03, 2012, 04:55:59 pm »

Hi! I'm using TinyPortal and would love to have a side block where the latest badges given are listed. Just like the list in the info center. Is that hard to make?
Logged
SMFHacks
Administrator
Hero Member
*****
Offline Offline

Posts: 11003


View Profile
« Reply #1 on: September 03, 2012, 10:12:56 pm »

Some example code
Code:
//Start Badge Awards

global $modSettings, $boardurl, $smcFunc;
if ($modSettings['badgeawards_showboardindex'] == true && !empty($modSettings['badgeawards_enable']))
{
if (empty($modSettings['badgeawards_boardnumdisplay']))
$modSettings['badgeawards_boardnumdisplay'] = 10;

if (empty($modSettings['badgeawards_url']))
$modSettings['badgeawards_url'] = $boardurl . '/badges/';

$dbresult = $smcFunc['db_query']('', "SELECT
b.id_badge, b.title, b.image, b.enabled,
l.ID_MEMBER, l.date, l.id_log, m.real_name 
FROM ({db_prefix}badgeawards_badges as b, {db_prefix}badgeawards_badge_log as l)
LEFT JOIN {db_prefix}members as m ON (m.ID_MEMBER = l.ID_MEMBER)
WHERE l.id_badge = b.id_badge
ORDER BY l.id_log DESC
LIMIT " . $modSettings['badgeawards_boardnumdisplay']);

$context['badge_recentindex'] = array();
while($row = mysql_fetch_assoc($dbresult))
{
$context['badge_recentindex'][] = $row;

}
mysql_free_result($dbresult);
}


foreach ($context['badge_recentindex'] as $pic)
{


echo '<a href="' . $scripturl . '?action=badgeawards;sa=badges;u=' . $pic['ID_MEMBER'] . '">' . $pic['title'] . '</a> ' .   $txt['badges_to'], ' ', ($pic['real_name'] != '' ?  '<a href="' . $scripturl . '?action=profile;u=' . $pic['ID_MEMBER'] . '">' . $pic['real_name'] . '</a>' : '') . '
', timeformat($pic['date']), '<br />';


}

//END Badge Awards

Logged
Dylert
Inline PM Customer
*****
Offline Offline

Posts: 45



View Profile WWW
« Reply #2 on: September 04, 2012, 01:23:41 am »

Just what i need! Thanks a lot!  Smiley
Logged
Draffi
Menu Editor Pro Customer
Newbie
*****
Offline Offline

Posts: 14


View Profile
« Reply #3 on: May 21, 2013, 01:18:58 pm »

Is it possible, to show the Badge next (in front of) to the username inside this block-code?
Logged
Pages: [1] Go Up Print 
« previous next »
Jump to:  

Recent
[Today at 08:29:56 pm]

[Today at 04:50:21 am]

[May 22, 2013, 10:03:30 pm]

[May 22, 2013, 03:00:09 pm]

[May 22, 2013, 03:03:31 am]

[May 21, 2013, 03:27:16 pm]

[May 21, 2013, 02:11:10 pm]

[May 21, 2013, 01:18:58 pm]

[May 21, 2013, 12:22:02 am]

[May 21, 2013, 12:20:41 am]
Random Picture
Donate to SMFHacks.com
Help Support the SMFHacks.com mod making.
Powered by SMF 1.1.18 | SMF © 2013, Simple Machines
TinyPortal v0.9.7 © Bloc
SMF and SimpleMachines are registered trademarks of Simple Machines. SMFHacks.com is not affiliated with nor endorsed by Simple Machines.
Page created in 1.349 seconds with 21 queries.