Facebook  Twitter 

SMFHacks.com

+- +-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 12424
Latest: serbenfiquista
New This Month: 5
New This Week: 0
New Today: 0
Stats
Total Posts: 40038
Total Topics: 7046
Most Online Today: 52
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 25
Total: 25

Author Topic: Badges not displaying  (Read 5222 times)

0 Members and 1 Guest are viewing this topic.

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 15022
    • View Profile
Re: Badges not displaying
« Reply #15 on: July 25, 2015, 03:21:44 pm »
One more time updated code
Code: [Select]
function Badges_DisplayCustomBadges($memberID = 0, $order = 'recent', $maxToShow = 5, $badgesList = array())
{
global $smcFunc, $modSettings, $boardurl;

if (empty($modSettings['badgeawards_enable']))
return;

    if (empty($memberID))
        return; 
       
    if (empty($badgesList))
    {
    return;
    }
       
if (empty($modSettings['badgeawards_url']))
$modSettings['badgeawards_url'] = $boardurl . '/badges/';
       
$badgesCache = array();

$result = $smcFunc['db_query']('', "
SELECT
b.id_badge, b.title, b.image, b.enabled
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 AND b.id_badge IN (" . implode(",",$badgesList) . ")
ORDER BY l.id_log DESC
LIMIT  $maxToShow
");
while ($row = $smcFunc['db_fetch_assoc']($result))
{
$badgesCache[] = $row;

}


if (!empty($badgesCache))
foreach($badgesCache as $row)
{
echo '<img src="' . $modSettings['badgeawards_url']  . $row['image'] . '" alt="' . $row['title'] . '" title="' . $row['title'] . '" /> ';

}


}
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 VapeTech

  • Newbie
  • *
  • Posts: 39
    • View Profile
Re: Badges not displaying
« Reply #16 on: July 25, 2015, 03:44:31 pm »
:)  perfect,  is there a way I can use a larger image Badge for my custom ones?

And thanks so much for helping me today!

Offline VapeTech

  • Newbie
  • *
  • Posts: 39
    • View Profile
Re: Badges not displaying
« Reply #17 on: July 25, 2015, 03:53:15 pm »
Oh, I know I can set the styles in the function for the IMG but it is using the thumbnail so if I try to make it  80x80px it is blurry.  I was just wondering how we can use the larger uploaded version.  I guess it would have to be a different image ??   $modSettings['badgeawards_url']  ..  I mean actually the array that hold the $bigimageFilename.  I can't see where you identify the thumb verses the big size.
« Last Edit: July 25, 2015, 04:05:40 pm by VapeTech »

Offline VapeTech

  • Newbie
  • *
  • Posts: 39
    • View Profile
Re: Badges not displaying
« Reply #18 on: July 25, 2015, 06:14:25 pm »
Found it :)    I change the SQL query to return the  large_Image and updated the array...  not bad for first time playing around with php...  I'm an ASP guy  :P

So I updated the function to return

echo '<img style="width:50px; height:50px" src="' . $modSettings['badgeawards_url']  . $row['Large_image'] . '" alt="' . $row['title'] . '" title="' . $row['title'] . '" /> ' . ' ' . $row['title'] ;

I did 50px because it fit the best

Just in case anyone else needs it.

Thanks a TON for your time today..  hopefully we can figure out the Image issue with the Ad Seller pro now

Jason

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 15022
    • View Profile
Re: Badges not displaying
« Reply #19 on: July 25, 2015, 08:40:29 pm »
Nice good work glad you have it working.
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
16 Replies
9257 Views
Last post November 12, 2007, 09:02:29 pm
by Rafferty
4 Replies
2655 Views
Last post March 15, 2010, 08:38:12 am
by mandomercs
7 Replies
2936 Views
Last post August 31, 2014, 09:40:44 pm
by SMFHacks
1 Replies
1855 Views
Last post February 12, 2015, 09:55:14 pm
by SMFHacks
3 Replies
1938 Views
Last post July 06, 2017, 05:02:31 pm
by SMFHacks

+- Recent Topics

Cannot install by SMFHacks
January 18, 2020, 09:40:56 pm

Call to undefined function mysql_query() by SMFHacks
January 18, 2020, 02:06:47 pm

English British Translation file by HAL9000
January 17, 2020, 05:44:28 pm

Characters dispayed as boxes by SMFHacks
January 16, 2020, 07:21:51 am

Multiple adds where one used to be? by SMFHacks
January 07, 2020, 08:20:38 am

Ribbon Theme Logo Position by slizzie1986
January 06, 2020, 08:52:31 pm

System enhancement? by SMFHacks
January 03, 2020, 09:22:45 am

Pretty Url Pro Is it compatible with 7.2? by Rock Lee
January 01, 2020, 08:53:50 pm

Order of photos by SMFHacks
December 29, 2019, 02:02:28 pm

SMF Cookie Change Compatibly by HDB
December 28, 2019, 03:33:49 pm

Powered by EzPortal