Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 4255
Latest: andreios
New This Month: 3
New This Week: 1
New Today: 0
Stats
Total Posts: 43259
Total Topics: 7518
Most Online Today: 297
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 249
Total: 249

Author Topic: Portal Block  (Read 2134 times)

0 Members and 1 Guest are viewing this topic.

Offline PapaFrizArcade

  • 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: 16436
    • 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

  • 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: 16436
    • 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: 185
    • 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: 16436
    • 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: 185
    • 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: 16436
    • 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: 185
    • 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: 16436
    • 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
6286 Views
Last post April 01, 2010, 07:39:09 am
by Pegasys
1 Replies
5026 Views
Last post June 08, 2010, 03:18:26 pm
by SMFHacks
7 Replies
5424 Views
Last post September 25, 2011, 11:35:12 am
by cosmicx
52 Replies
37608 Views
Last post May 06, 2021, 12:24:32 pm
by Shades
9 Replies
1533 Views
Last post April 05, 2022, 01:29:19 pm
by SMFHacks

+- Recent Topics

No thumbnails on new uploads by SMFHacks
March 27, 2024, 02:10:41 pm

Display the Contact Page for guests by SMFHacks
March 27, 2024, 10:55:43 am

is it possible to add support for odysee.com by fvlog19
March 21, 2024, 08:47:51 am

Request for admin notification by davejo
March 10, 2024, 01:31:59 am

I need help with torrent upload by Ineedsmfhelp
March 09, 2024, 10:01:13 pm

an idea for new mod (( content type with different display )) by SMFHacks
February 27, 2024, 01:36:27 pm

[Mod] RSS Feed Poster by SMFHacks
February 27, 2024, 11:57:18 am

find duplicate pictures by fvlog19
February 14, 2024, 02:22:40 pm

Error uploading video. by SMFHacks
February 08, 2024, 02:04:16 pm

Gallery icon as last added image by fvlog19
February 01, 2024, 01:04:56 pm

Powered by EzPortal