Facebook  Twitter 

SMFHacks.com

+- +-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 12381
Latest: btymorgans01
New This Month: 0
New This Week: 0
New Today: 0
Stats
Total Posts: 40238
Total Topics: 7088
Most Online Today: 70
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 43
Total: 43

Author Topic: Badges not displaying  (Read 5631 times)

0 Members and 1 Guest are viewing this topic.

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 15116
    • 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: 15116
    • 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
9408 Views
Last post November 12, 2007, 09:02:29 pm
by Rafferty
4 Replies
2721 Views
Last post March 15, 2010, 08:38:12 am
by mandomercs
7 Replies
3043 Views
Last post August 31, 2014, 09:40:44 pm
by SMFHacks
1 Replies
1913 Views
Last post February 12, 2015, 09:55:14 pm
by SMFHacks
3 Replies
2065 Views
Last post July 06, 2017, 05:02:31 pm
by SMFHacks

+- Recent Topics

Call to undefined function mysql_num_rows() by SMFHacks
July 30, 2020, 07:45:29 am

Problem with one videosite embedding by Hatshepsut
July 24, 2020, 01:25:08 am

Download System Lite by Rock Lee
June 03, 2020, 07:34:24 pm

Font question by SMFHacks
May 27, 2020, 08:15:26 am

Error message with latest SMF 2.1 Github build by Hatshepsut
May 25, 2020, 01:43:26 am

smfblog not working on 2.0.17 by tech9
May 20, 2020, 01:44:34 pm

Copyright removal by stbc
May 18, 2020, 01:27:57 am

Mod Verified User i can't square the image by Rock Lee
May 07, 2020, 07:56:10 pm

SMF4Mobile 2.0 released for SMF 2.0.x by SMFHacks
May 06, 2020, 12:13:14 pm

SMF Social Login Pro - Discontinued? by Nicole
May 02, 2020, 05:47:04 pm

Powered by EzPortal