Skip to main content
Topic: Add action=pm to Portal-Block "Staff List"  (Read 1918 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Add action=pm to Portal-Block "Staff List"

Hello!

I dont't know, if this is possible, it is just an idea, to change the block "Staff List" in Simple Portal to a tiny "Team Page".

At the moment this block looks like this and the avatars and the names of the staff members lead you to their profiles. The icons for Admin and Global Mod have not really a function and I don't like them very much. ;)

Code: [Select]
/**
 * Staff Block, show the list of forum staff members
 *
 * @param mixed[] $parameters
 * 'lmod' => set to include local moderators as well
 * @param int $id - not used in this block
 * @param boolean $return_parameters if true returns the configuration options for the block
 */
function sp_staff($parameters, $id, $return_parameters = false)
{
global $scripturl, $modSettings, $color_profile;

$db = database();

$block_parameters = array(
'lmod' => 'check',
);

if ($return_parameters)
return $block_parameters;

require_once(SUBSDIR . '/Members.subs.php');

// Including local board moderators
if (empty($parameters['lmod']))
{
$request = $db->query('', '
SELECT id_member
FROM {db_prefix}moderators',
array(
)
);
$local_mods = array();
while ($row = $db->fetch_assoc($request))
$local_mods[$row['id_member']] = $row['id_member'];
$db->free_result($request);

if (count($local_mods) > 10)
$local_mods = array();
}
else
$local_mods = array();

$global_mods = membersAllowedTo('moderate_board', 0);
$admins = membersAllowedTo('admin_forum');

$all_staff = array_merge($local_mods, $global_mods, $admins);
$all_staff = array_unique($all_staff);

$request = $db->query('', '
SELECT
m.id_member, m.real_name, m.avatar, m.email_address,
mg.group_name,
a.id_attach, a.attachment_type, a.filename
FROM {db_prefix}members AS m
LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = m.id_member)
LEFT JOIN {db_prefix}membergroups AS mg ON (mg.id_group = CASE WHEN m.id_group = {int:reg_group_id} THEN m.id_post_group ELSE m.id_group END)
WHERE m.id_member IN ({array_int:staff_list})',
array(
'staff_list' => $all_staff,
'reg_group_id' => 0,
)
);
$staff_list = array();
$colorids = array();
while ($row = $db->fetch_assoc($request))
{
$colorids[$row['id_member']] = $row['id_member'];

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 = '';
}

if (in_array($row['id_member'], $admins))
$row['type'] = 1;
elseif (in_array($row['id_member'], $global_mods))
$row['type'] = 2;
else
$row['type'] = 3;

$staff_list[$row['type'] . '-' . $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'],
'type' => $row['type'],
'avatar' => determineAvatar(array(
'avatar' => $row['avatar'],
'filename' => $row['filename'],
'id_attach' => $row['id_attach'],
'email_address' => $row['email_address'],
'attachment_type' => $row['attachment_type'],
)),
);
}
$db->free_result($request);

ksort($staff_list);
$staff_count = count($staff_list);
$count = 0;
$icons = array(1 => 'admin', 'gmod', 'lmod');

if (!empty($colorids) && sp_loadColors($colorids) !== false)
{
foreach ($staff_list as $k => $p)
{
if (!empty($color_profile[$p['id']]['link']))
$staff_list[$k]['link'] = $color_profile[$p['id']]['link'];
}
}

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

foreach ($staff_list as $staff)
echo '
<tr>
<td class="sp_staff centertext">', !empty($staff['avatar']['href']) ? '
<a href="' . $scripturl . '?action=profile;u=' . $staff['id'] . '"><img src="' . $staff['avatar']['href'] . '" alt="' . $staff['name'] . '" width="40" /></a>' : '', '
</td>
<td ', sp_embed_class($icons[$staff['type']], '', 'sp_staff_info'. $staff_count != ++$count ? ' sp_staff_divider' : ''), '>',
$staff['link'], '<br />', $staff['group'], '
</td>
</tr>';

echo '
</table>';
}


Re: Add action=pm to Portal-Block "Staff List"

Reply #1

Maybe it would be possible to replace this icons with the icons for online/offline as they are shown in the poster info in the posts or in the member list and add the function "send pm" to this block? Or choose other icons for this?

Can "action pm" and other icons added here? What else must be added to have a pm-function in this block?

Code: [Select]
<td class="sp_staff centertext">', !empty($staff['avatar']['href']) ? '
<a href="' . $scripturl . '?action=profile;u=' . $staff['id'] . '"><img src="' . $staff['avatar']['href'] . '" alt="' . $staff['name'] . '" width="40" /></a>' : '', '
</td>
<td ', sp_embed_class($icons[$staff['type']], '', 'sp_staff_info'. $staff_count != ++$count ? ' sp_staff_divider' : ''), '>',
$staff['link'], '<br />', $staff['group'], '
</td>

It would be nice to see by the color of the icon, wich Team Members are online and it would be nice if you can send them a PM by using this icon. After changing the Block "Staff List" could maybe look like this: