collapse collapse

* User Info

 
 
Welcome, Guest. Please login or register.
Did you miss your activation email?

* Who's Online

  • Dot Guests: 116
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM
  • phantomm: and from what I see only patch is broken, full install package is fine
    October 21, 2016, 03:44:44 PM
  • phantomm: they say it for over 3 weeks now..
    October 21, 2016, 03:43:52 PM

* Recent Posts

If you're interested in helping other members with support requests, consider joining the Community Support Helpers group.

Author Topic: [Block] Show Members (in staff block style)  (Read 3921 times)

0 Members and 1 Guest are viewing this topic.

Offline Kaede Akamatsu

  • Hero Member
  • *****
  • Posts: 2175
  • Gender: Male
  • $("div.content:dd").hide();
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: None
[Block] Show Members (in staff block style)
« on: November 04, 2015, 07:13:26 PM »
Show Members (in staff block style)

SMF 2.0 series | SP 2.3.6

This block is identical to the staff block, however you can define groups you want and you can make certain members not show.

Code: [Select]
<?php

/**
 * @block Show Members
 * @author Rhode Fey (Sayaka Maizono)
 * @version 1.0.2
*/

/*
Usage:
fill the array with group ids of the groups you want to show.
Example for showing just one group, from group 1;
$groups_to_use = array(1);
Example for showing three groups, from group 1, 3, and 8
$groups_to_use = array(1, 3, 8);
*/

$groups_to_use = array(1);

/*
Usage:
fill the array with member ids you don't want to show up.
Example for hiding one member, user #1
$members_to_ignore = array(1);
Example for hiding multiple members, user #1, #3, and #8
$members_to_ignore = array(1, 3, 8);
*/

$members_to_ignore = array();

/*
 *
*/

global $smcFunc$sourcedir$scripturl$modSettings$txt;

// These are strings for errors...
$txt['no_groups'] = 'No groups have been defined! Please refer to the comments in the Block code!';
$txt['no_members'] = 'No members have been found...';

$groups = array();
foreach (
$groups_to_use as $group)
$groups[] = (int) $group;
$groups array_unique($groups);

$ignored_members = array();
foreach (
$members_to_ignore as $id)
$ignored_members[] = (int) $id;
$ignored_members array_unique($ignored_members);

if (empty(
$groups))
{
echo '
<span class="smalltext" style="color: red;">
'
$txt['no_groups'] . '
</span>'
;

return;
}

$request $smcFunc['db_query']('''
SELECT
mem.id_member, mem.real_name, mem.avatar, mem.id_group, mem.id_post_group, mg.group_name,
a.id_attach, a.attachment_type, a.filename
FROM {db_prefix}members AS mem
LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member)
LEFT JOIN {db_prefix}membergroups AS mg ON (mg.id_group = CASE WHEN mem.id_group = {int:reg_group_id} THEN mem.id_post_group ELSE mem.id_group END)
WHERE mem.id_group IN ({array_int:groups_to_use}) OR mem.id_post_group IN ({array_int:groups_to_use})'
,
array(
'groups_to_use' => $groups,
'reg_group_id' => 0,
)
);

$member_list = array();
while (
$row $smcFunc['db_fetch_assoc']($request))
{
if ($modSettings['avatar_action_too_large'] == 'option_html_resize' || $modSettings['avatar_action_too_large'] == 'option_js_resize')
{
$avatar_width = !empty($modSettings['avatar_max_width_external']) ? ' width="' $modSettings['avatar_max_width_external'] . '"' '';
$avatar_height = !empty($modSettings['avatar_max_height_external']) ? ' height="' $modSettings['avatar_max_height_external'] . '"' '';
}
else
{
$avatar_width '';
$avatar_height '';
}

$member_list[$row['id_member']] = array(
'id' => $row['id_member'],
'name' => $row['real_name'],
'link' => '<a href="' $scripturl '?action=profile;u=' $row['id_member'] . '">' $row['real_name'] . '</a>',
'group' => $row['group_name'],
'avatar' => array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['id_attach'] > '<img src="' . (empty($row['attachment_type']) ? $scripturl '?action=dlattach;attach=' $row['id_attach'] . ';type=avatar' $modSettings['custom_avatar_url'] . '/' $row['filename']) . '" alt="" class="avatar" border="0" />' '') : (stristr($row['avatar'], 'http://') ? '<img src="' $row['avatar'] . '"' $avatar_width $avatar_height ' alt="" class="avatar" border="0" />' '<img src="' $modSettings['avatar_url'] . '/' htmlspecialchars($row['avatar']) . '" alt="" class="avatar" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['id_attach'] > ? (empty($row['attachment_type']) ? $scripturl '?action=dlattach;attach=' $row['id_attach'] . ';type=avatar' $modSettings['custom_avatar_url'] . '/' $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' $row['avatar']),
'url' => $row['avatar'] == '' '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' $row['avatar'])
),
);
}
$smcFunc['db_free_result']($request);

if (empty(
$member_list))
{
echo '
<span class="smalltext" style="color: red;">
'
$txt['no_members'] . '
</span>'
;

return;
}

ksort($member_list);
$member_count count($member_list);
$count 0;

echo 
'
<table class="sp_fullwidth">'
;

foreach (
$member_list as $member)
{
if (!empty($ignored_members))
if (in_array($member['id'], $ignored_members))
return;

echo '
<tr>
<td class="sp_staff sp_center">'
, !empty($member['avatar']['href']) ? '<a href="' $scripturl '?action=profile;u=' $member['id'] . '"><img src="' $member['avatar']['href'] . '" alt="' $member['name'] . '" width="40" /></a>' '''</td>
<td class="sp_staff_info'
$member_count != ++$count ' sp_staff_divider' '''">
'
$member['link'], '<br />
'
$member['group'], '
</td>
</tr>'
;

echo '
</table>'
;
}

?>
« Last Edit: November 04, 2015, 07:15:51 PM by Sayaka Maizono »

Offline LittleFang

  • Semi Newbie
  • *
  • Posts: 8
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: [Block] Show Members (in staff block style)
« Reply #1 on: September 11, 2018, 06:22:59 PM »
I love this mod!  However I have a problem: I can't get admins to show up in the block no matter what I do.  Nobody is set to ignored.   :'(

Offline ♦ Ninja ZX-10RR ♦

  • Spammer Hammer
  • Support
  • *
  • Posts: 1173
  • Gender: Male
  • Sniper Legends
    • Virtual Interactive Games Entertainment™
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: 1.0.6
Re: [Block] Show Members (in staff block style)
« Reply #2 on: September 13, 2018, 08:32:35 AM »
I love this mod!  However I have a problem: I can't get admins to show up in the block no matter what I do.  Nobody is set to ignored.   :'(
Add the administrator group to
Code: [Select]
$groups_to_use = array(X);
Have you tried SimplePortal Documentation before asking? ;)
F.A.Q.  English Support  |  Blocks Support
Fancy Feature idea ?!  |  Blocks Requests
Themes & Graphics

▼ My job! ▼

No PMs for support unless it's a paid request. Thank you! :)
#OpIsis

Offline LittleFang

  • Semi Newbie
  • *
  • Posts: 8
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: [Block] Show Members (in staff block style)
« Reply #3 on: September 19, 2018, 03:12:55 PM »
Thank you!

However, when I add any other group to that array, it breaks the forum formatting. 
Also I want to only show the admin if they are in group 16 as well.  I should have specified that!

So my account (Little Fang) is in group 16 as a sub group.  However I don't show up on the widget.
« Last Edit: September 19, 2018, 03:32:36 PM by LittleFang »

Offline ♦ Ninja ZX-10RR ♦

  • Spammer Hammer
  • Support
  • *
  • Posts: 1173
  • Gender: Male
  • Sniper Legends
    • Virtual Interactive Games Entertainment™
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: 1.0.6
Re: [Block] Show Members (in staff block style)
« Reply #4 on: September 19, 2018, 03:38:29 PM »
Code: [Select]
$groups_to_use = array(16);And if group 16 includes more than the ones you want to show, use the
Code: [Select]
$members_to_ignore = array(); and fill it up with each and every user ID you do not want to be displayed.
Have you tried SimplePortal Documentation before asking? ;)
F.A.Q.  English Support  |  Blocks Support
Fancy Feature idea ?!  |  Blocks Requests
Themes & Graphics

▼ My job! ▼

No PMs for support unless it's a paid request. Thank you! :)
#OpIsis

Offline LittleFang

  • Semi Newbie
  • *
  • Posts: 8
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: [Block] Show Members (in staff block style)
« Reply #5 on: September 19, 2018, 06:29:56 PM »
Aha!  I fixed my people appearing issue, but the box still breaks with more than one member showing, and destroys the formatting as shown in the screenshot.

Offline ♦ Ninja ZX-10RR ♦

  • Spammer Hammer
  • Support
  • *
  • Posts: 1173
  • Gender: Male
  • Sniper Legends
    • Virtual Interactive Games Entertainment™
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: 1.0.6
Re: [Block] Show Members (in staff block style)
« Reply #6 on: September 19, 2018, 07:29:13 PM »
I feel you either screwed up somewhere in the code (please post it), or the theme is weird (need link with visible block).
Have you tried SimplePortal Documentation before asking? ;)
F.A.Q.  English Support  |  Blocks Support
Fancy Feature idea ?!  |  Blocks Requests
Themes & Graphics

▼ My job! ▼

No PMs for support unless it's a paid request. Thank you! :)
#OpIsis

Offline LittleFang

  • Semi Newbie
  • *
  • Posts: 8
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: [Block] Show Members (in staff block style)
« Reply #7 on: September 20, 2018, 02:37:03 PM »
I went to the simple portal php for the staff block and Frankenstein'd a code that works. Now I'm just trying to tweak it with custom links. I can post what I created if it would help others

Offline ♦ Ninja ZX-10RR ♦

  • Spammer Hammer
  • Support
  • *
  • Posts: 1173
  • Gender: Male
  • Sniper Legends
    • Virtual Interactive Games Entertainment™
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: 1.0.6
Re: [Block] Show Members (in staff block style)
« Reply #8 on: September 20, 2018, 08:44:49 PM »
You're not meant to put any links into the above code O.o
Have you tried SimplePortal Documentation before asking? ;)
F.A.Q.  English Support  |  Blocks Support
Fancy Feature idea ?!  |  Blocks Requests
Themes & Graphics

▼ My job! ▼

No PMs for support unless it's a paid request. Thank you! :)
#OpIsis

Offline LittleFang

  • Semi Newbie
  • *
  • Posts: 8
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: [Block] Show Members (in staff block style)
« Reply #9 on: September 21, 2018, 01:40:24 PM »
Yes somebody posted another mod I'm trying to work through