Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 11845
Latest: SamoanOnion
New This Month: 6
New This Week: 0
New Today: 0
Stats
Total Posts: 42472
Total Topics: 7406
Most Online Today: 127
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 47
Total: 47

Author Topic: Portal Block  (Read 874 times)

0 Members and 1 Guest are viewing this topic.

Offline PapaFrizArcade

  • Awesome Post Ratings
  • Jr. Member
  • *****
  • Posts: 76
    • View Profile
Portal Block
« on: March 13, 2022, 10:23:54 am »
It would be cool to create a portal block to display a users badges...

Would the code for that be something simple enough to cut/paste in to a PHP block?


Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16109
    • View Profile
Re: Portal Block
« Reply #1 on: March 13, 2022, 02:46:24 pm »
This php code would work for that
Just set the paramters

 Badges_DisplayBadges($memberID = 0, $order = 'recent', $maxToShow = 5);

Code: [Select]
global $sourcedir;
require_once($sourcedir . '/badgeawards2.php');
Badges_DisplayBadges(1, 'recent',  5);
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/
Like Like x 1 View List

Offline PapaFrizArcade

  • Awesome Post Ratings
  • Jr. Member
  • *****
  • Posts: 76
    • View Profile
Re: Portal Block
« Reply #2 on: March 29, 2022, 09:34:54 am »
This block code works awesome for displaying a small "wall" of badges.

A could of questions...

1) Any way to make them random badges vs last x number of badges?

2) Any way to spiff up the display?  Perhaps pointer hover causes "expansion" to large version?

3) If that isn't possible... perhaps the individual badges could be clickable that would bring up that badges large version ... or the page that shows that badge?

Just some ideas... ;)


[ Guests cannot view attachments ]


EDIT: Pro-tip for those not-in-the-know ...  you're not stuck with "round" badges ... nor are you stuck with PNG files.  We have multiple non-round badges and even a few animated gifs at our site...

:)
« Last Edit: March 29, 2022, 09:37:12 am by PapaFrizArcade »

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16109
    • View Profile
Re: Portal Block
« Reply #3 on: March 29, 2022, 08:23:38 pm »
1. Good idea that function can be expanded to included random in a future update.
2. not easily
3. That would be easy to do as that is just a simple link.
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 davejo

  • Downloads Pro Customer
  • Full Member
  • *****
  • Posts: 157
    • View Profile
    • Quizland
Re: Portal Block
« Reply #4 on: August 20, 2022, 06:04:33 am »
VB,

Is it possible to have the member ID
Quote
Badges_DisplayBadges($memberID = 0, $order = 'recent', $maxToShow = 5);
as a wild card so it picks up on all members who have recently received a badge?

It would be similar to the board index setting.

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16109
    • View Profile
Re: Portal Block
« Reply #5 on: August 21, 2022, 11:44:56 am »
No really with that function. It just displays barges for the member.
What would that function display?/How would it be formatted.
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 davejo

  • Downloads Pro Customer
  • Full Member
  • *****
  • Posts: 157
    • View Profile
    • Quizland
Re: Portal Block
« Reply #6 on: August 21, 2022, 04:00:06 pm »
No really with that function. It just displays barges for the member.
What would that function display?/How would it be formatted.

My thoughts were that the block would display a list of members who had received a badge the same as it does on the board index. The block would not need to have the date or time just who received the badge similar to the attachment, with the option of changing how long the list is.


[ Guests cannot view attachments ]

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16109
    • View Profile
Re: Portal Block
« Reply #7 on: August 22, 2022, 08:54:01 pm »
Here is some php code which you can customize

Code: [Select]
global $smcFunc, $modSettings, $boardurl;

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

$result = $smcFunc['db_query']('', "
SELECT
b.id_badge, b.title, b.image, b.enabled, m.real_name, m.ID_MEMBER
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  10
");
while ($row = $smcFunc['db_fetch_assoc']($result))
{
echo '<img src="' . $modSettings['badgeawards_url']  . $row['image'] . '" alt="' . $row['title'] . '" title="' . $row['title'] . '" /> ' . $row['title']  . ' - ' . $row['real_name'];

}


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 davejo

  • Downloads Pro Customer
  • Full Member
  • *****
  • Posts: 157
    • View Profile
    • Quizland
Re: Portal Block
« Reply #8 on: August 23, 2022, 01:09:26 am »
Here is some php code which you can customize

Code: [Select]
global $smcFunc, $modSettings, $boardurl;
 
       
 if (empty($modSettings['badgeawards_url']))
 $modSettings['badgeawards_url'] = $boardurl . '/badges/';
       

 $result = $smcFunc['db_query']('', "
 SELECT
 b.id_badge, b.title, b.image, b.enabled, m.real_name, m.ID_MEMBER
 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  10
 ");
 while ($row = $smcFunc['db_fetch_assoc']($result))
 {
 echo '<img src="' . $modSettings['badgeawards_url']  . $row['image'] . '" alt="' . $row['title'] . '" title="' . $row['title'] . '" /> ' . $row['title']  . ' - ' . $row['real_name'];
 
 }
 

 

Thank you very much VB just what I wanted

I changed the code a little as the buttons says it all for me

Code: [Select]
global $smcFunc, $modSettings, $boardurl;

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

$result = $smcFunc['db_query']('', "
SELECT
b.id_badge, b.title, b.image, b.enabled, m.real_name, m.ID_MEMBER
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  8
");
while ($row = $smcFunc['db_fetch_assoc']($result))
{
echo '<img src="' . $modSettings['badgeawards_url']  . $row['image'] . '" /> ' .  $row['real_name'];

}

and that results in

[ Guests cannot view attachments ]

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16109
    • View Profile
Re: Portal Block
« Reply #9 on: August 23, 2022, 12:42:22 pm »
Glad that helped!
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
2 Replies
5165 Views
Last post April 01, 2010, 07:39:09 am
by Pegasys
1 Replies
3779 Views
Last post June 08, 2010, 03:18:26 pm
by SMFHacks
7 Replies
4182 Views
Last post September 25, 2011, 11:35:12 am
by cosmicx
52 Replies
33888 Views
Last post May 06, 2021, 12:24:32 pm
by Shades
9 Replies
610 Views
Last post April 05, 2022, 01:29:19 pm
by SMFHacks

+- Recent Topics

"Custom title" badge by SMFHacks
September 24, 2022, 07:09:22 pm

Category Selection by Anmer
September 18, 2022, 02:40:06 am

Setting a single free download. by Zaphod
September 12, 2022, 10:18:45 pm

Error message "Data too long for column 'ipaddress' at row 1" by SMFHacks
September 12, 2022, 08:49:02 am

SMF to SMF bridge via WP by SMFHacks
September 11, 2022, 09:44:30 am

Video player included by SMFHacks
September 06, 2022, 10:26:27 pm

Upload hangs / doesn't complete by SMFHacks
August 28, 2022, 08:36:21 am

[Feature Request] Admin Sales Alert by Shades
August 25, 2022, 06:41:00 pm

Portal Block by SMFHacks
August 23, 2022, 12:42:22 pm

Question about undoing a rating by SMFHacks
August 22, 2022, 04:31:50 pm

Powered by EzPortal