Facebook  Twitter 

SMFHacks.com

+- +-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 12172
Latest: LeaMoeller
New This Month: 14
New This Week: 1
New Today: 1
Stats
Total Posts: 39049
Total Topics: 6874
Most Online Today: 44
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 45
Total: 45

Author Topic: Badge block  (Read 4098 times)

0 Members and 1 Guest are viewing this topic.

Offline Dylert

  • Newbie
  • *
  • Posts: 45
    • View Profile
    • Hellasforum
Badge block
« 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?

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14551
    • View Profile
Re: Badge block
« Reply #1 on: September 03, 2012, 10:12:56 pm »
Some example code
Code: [Select]
//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

Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline Dylert

  • Newbie
  • *
  • Posts: 45
    • View Profile
    • Hellasforum
Re: Badge block
« Reply #2 on: September 04, 2012, 01:23:41 am »
Just what i need! Thanks a lot!  :)

Offline Draffi

  • Menu Editor Pro Customer
  • Jr. Member
  • *****
  • Posts: 76
    • View Profile
Re: Badge block
« 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?

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14551
    • View Profile
Re: Badge block
« Reply #4 on: May 24, 2013, 03:57:55 pm »
You mean the badge icon/image itself?
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline Draffi

  • Menu Editor Pro Customer
  • Jr. Member
  • *****
  • Posts: 76
    • View Profile
Re: Badge block
« Reply #5 on: May 24, 2013, 05:11:52 pm »
Mhhh....regulary this is what i want:

(SMF 2.0.4 with SimplePortal 2.3.5)

A streaming Badge List inside a block.


Offline Draffi

  • Menu Editor Pro Customer
  • Jr. Member
  • *****
  • Posts: 76
    • View Profile
Re: Badge block
« Reply #6 on: June 19, 2013, 06:03:35 pm »
Bumb....

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14551
    • View Profile
Re: Badge block
« Reply #7 on: June 19, 2013, 07:25:45 pm »
A streaming block would take me a while to do but I could do recent badges in a block in a couple posts up is the recent badges code for SMF 2.0.x
« Last Edit: June 19, 2013, 10:07:08 pm by SMFHacks »
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline exit

  • Badge Awards Customer
  • Jr. Member
  • *****
  • Posts: 92
    • View Profile
Re: Badge block
« Reply #8 on: May 07, 2018, 12:23:45 pm »
Some example code
Code: [Select]
//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


This is not working for me. Anything that needs to be updated?

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14551
    • View Profile
Re: Badge block
« Reply #9 on: May 07, 2018, 12:32:23 pm »
Where are you putting that code?
It is checking to see if the boardindex is enabled to display the badges you can take out that check and see if it runs
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline exit

  • Badge Awards Customer
  • Jr. Member
  • *****
  • Posts: 92
    • View Profile
Re: Badge block
« Reply #10 on: May 07, 2018, 12:39:44 pm »
Where are you putting that code?
It is checking to see if the boardindex is enabled to display the badges you can take out that check and see if it runs

Sorry, it's a simpleportal block.

I removed the boardindex if... still nothing

Code: [Select]
//Start Badge Awards

global $modSettings, $boardurl, $smcFunc;
if (!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

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14551
    • View Profile
Re: Badge block
« Reply #11 on: May 07, 2018, 12:46:56 pm »
Updated code
Code: [Select]
<?php
require 'SSI.php';

//Start Badge Awards

global $modSettings$boardurl$smcFunc;
if (!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 $smcFunc['db_fetch_assoc']($dbresult))
{
$context['badge_recentindex'][] = $row;

}

}


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

Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline exit

  • Badge Awards Customer
  • Jr. Member
  • *****
  • Posts: 92
    • View Profile
Re: Badge block
« Reply #12 on: May 07, 2018, 01:08:01 pm »
Updated code

It's missing the images

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14551
    • View Profile
Re: Badge block
« Reply #13 on: May 07, 2018, 01:11:12 pm »
Images were not part of that code originally.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

 

Related Topics

  Subject / Started by Replies Last post
4 Replies
2997 Views
Last post June 18, 2010, 09:18:00 am
by dvera
1 Replies
1793 Views
Last post June 07, 2011, 05:57:48 am
by SMFHacks
1 Replies
1464 Views
Last post June 07, 2012, 05:40:14 pm
by SMFHacks
1 Replies
1786 Views
Last post August 23, 2012, 01:55:20 pm
by SMFHacks
7 Replies
5171 Views
Last post April 08, 2014, 11:09:48 am
by MechSpecs

+- Recent Topics

link for users gallery from profile page by SMFHacks
August 20, 2018, 02:40:58 pm

[Mod]Tidy Child Boards 2.0 by SMFHacks
August 20, 2018, 01:32:43 pm

Admin View in Member's Profile of Dates for Accepting of PP and Reg Agreement by SMFHacks
August 18, 2018, 12:03:07 pm

Gallery2 Template Loading Error by SMFHacks
August 18, 2018, 12:02:12 pm

8: Undefined index: description by SMFHacks
August 17, 2018, 01:42:08 pm

It just does not send by SMFHacks
August 16, 2018, 11:03:06 pm

Ad beginning of post by SMFHacks
August 16, 2018, 10:22:58 pm

Agreement Date says NEVER by SMFHacks
August 14, 2018, 04:46:48 pm

HashTags system for SMF 2.0 released by Diego Andrés
August 12, 2018, 02:04:24 pm

Can the Store produce a unique code that you can sell? by SMFHacks
August 11, 2018, 11:43:32 am

Powered by EzPortal