Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 4200
Latest: [chrisB]
New This Month: 0
New This Week: 1
New Today: 0
Stats
Total Posts: 42613
Total Topics: 7433
Most Online Today: 98
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 1
Guests: 45
Total: 46

Author Topic: Portal Block  (Read 984 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: 16161
    • 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: 16161
    • 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: 164
    • 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: 16161
    • 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: 164
    • 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: 16161
    • 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: 164
    • 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: 16161
    • 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
5192 Views
Last post April 01, 2010, 07:39:09 am
by Pegasys
1 Replies
3805 Views
Last post June 08, 2010, 03:18:26 pm
by SMFHacks
7 Replies
4271 Views
Last post September 25, 2011, 11:35:12 am
by cosmicx
52 Replies
34312 Views
Last post May 06, 2021, 12:24:32 pm
by Shades
9 Replies
679 Views
Last post April 05, 2022, 01:29:19 pm
by SMFHacks

+- Recent Topics

List of changes in SMFGallery by Monocero
Today at 06:23:53 am

Permissions query by davejo
November 30, 2022, 09:52:38 am

Errors with SMF2WPBridge by [chrisB]
November 29, 2022, 04:30:26 pm

"Notify all store admins of item purchase" Not Working in SMF 2.1.2 or 2.1.3 by SMFHacks
November 29, 2022, 01:15:50 pm

Undefined index: id by Shades
November 29, 2022, 12:15:20 pm

Additional Recommendations for SMF Store by Michael Vail
November 26, 2022, 12:49:58 pm

SMF Store 5.0 Beta Errors - Trying to access array offset on value of type null by Michael Vail
November 26, 2022, 12:07:42 pm

Modification: Subcategories total in main gallery view by VisiGod
November 26, 2022, 11:27:34 am

Change log for Downloads Pro 6.13 and 6.14 by Nicole
November 20, 2022, 08:24:34 am

Release date? by SMFHacks
November 20, 2022, 08:09:10 am

Powered by EzPortal