collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 385
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ 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

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

NEED HELP? If you're looking for support with Simple Portal, look no further than the Support Board!

Author Topic: Staff list icon  (Read 6760 times)

0 Members and 1 Guest are viewing this topic.

Offline Kyba

  • Newbie
  • Posts: 2
  • SMF Version: 2.0.10
  • SP Version: 2.3.6
Staff list icon
« on: August 22, 2015, 03:18:27 PM »
Hi there!

The situation is the following.
There are the administrators, the global mods, the local mods. Now, I also created my own membergroup which called "Moderator". It is basically a Global moderator because that group has global moderating priviledges but not as many possiblities as the actual GMods. I have edited the admin, gmod and lmod pictures to the red, blue and green star representing the admins/global mods/local mods AND the "mods" in the Themes/mytheme/images/sp.

I as administrator have so the red star next to my name on the staff list.
If I set someone to be a global mod, they have a blue star next to to their names.
So far everything good!
But if I set someone as a "Moderator" -> my membergroup, so not a local moderator, they still have a blue star!
How can I edit the stuff so if someone has the membergoup "Moderator" (with the id: 15) they get the fancy green star next to their names on the staff list?

I assume it's somewhere in here:
Code: [Select]
<?php
function sp_staff($parameters$id$return_parameters false)
{
global $smcFunc$sourcedir$scripturl$modSettings$color_profile;

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

if ($return_parameters)
return $block_parameters;

require_once($sourcedir '/Subs-Members.php');

if (empty($parameters['lmod']))
{
$request $smcFunc['db_query']('''
SELECT id_member
FROM {db_prefix}moderators AS mods'
,
array(
)
);
$local_mods = array();
while ($row $smcFunc['db_fetch_assoc']($request))
$local_mods[$row['id_member']] = $row['id_member'];
$smcFunc['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 $smcFunc['db_query']('''
SELECT
m.id_member, m.real_name, m.avatar, 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 $smcFunc['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' => 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);

ksort($staff_list);
$staff_count count($staff_list);
$count 0;
$icons = array(=> '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 sp_center">'
, !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 class="sp_staff_info'
$staff_count != ++$count ' sp_staff_divider' '''">
'
sp_embed_image($icons[$staff['type']]), ' '$staff['link'], '<br />
'
$staff['group'], '
</td>
</tr>'
;

echo '
</table>'
;
}
?>


I thought the part
Code: [Select]
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;
might be it, as 1=membergroup id 1 - admins
2= membergroup id 2 - global mods
3 = membergroup id 3 - local mods
So I changed the "3" to "15" (my membergroup's id) but it didn't work :D

If it's unclear, please let me know.

Screenshot:
https://gyazo.com/5011ebbf4c2253a50b0f43809fd71dc0

Thank a lot,
Kyba

Offline ccbtimewiz

  • Hero Member
  • *****
  • Posts: 2185
  • Gender: Male
  • $("div.content:dd").hide();
  • SMF Version: None
  • SP Version: None
  • Elkarte Version: None
  • EhPortal Version: None
Re: Staff list icon
« Reply #1 on: September 23, 2015, 06:58:16 PM »
Do you still need help with this?

Offline Kyba

  • Newbie
  • Posts: 2
  • SMF Version: 2.0.10
  • SP Version: 2.3.6
Re: Staff list icon
« Reply #2 on: September 23, 2015, 07:40:56 PM »
Yes! Please.
K

Offline ccbtimewiz

  • Hero Member
  • *****
  • Posts: 2185
  • Gender: Male
  • $("div.content:dd").hide();
  • SMF Version: None
  • SP Version: None
  • Elkarte Version: None
  • EhPortal Version: None
Re: Staff list icon
« Reply #3 on: September 23, 2015, 08:17:58 PM »
Alright I'm looking at the source file now.

These are how these two groups are determined:

Code: [Select]
$global_mods = membersAllowedTo('moderate_board', 0);
$admins = membersAllowedTo('admin_forum');

Since your custom group meets the criteria for $global_mods, it recognizes them as global moderators and gives you the blue star. The reason your edit to $row['type'] = 3 did not work was because it was passing at the second criteria before it even hits.

You can do this....

./Sources/PortalBlocks.php

Find:
Code: [Select]
$all_staff = array_merge($local_mods, $global_mods, $admins);
$all_staff = array_unique($all_staff);

$request = $smcFunc['db_query']('', '
SELECT
m.id_member, m.real_name, m.avatar, mg.group_name,

Replace with:
Code: [Select]
$all_staff = array_merge($local_mods, $global_mods, $admins);
$all_staff = array_unique($all_staff);

$request = $smcFunc['db_query']('', '
SELECT
m.id_member, m.real_name, m.avatar, m.id_group, mg.group_name,

Find:
Code: [Select]
$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'],

Replace with:
Code: [Select]
$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'],
'id_group' => $row['id_group'],

Find:
Code: [Select]
foreach ($staff_list as $staff)
echo '
<tr>
<td class="sp_staff sp_center">', !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 class="sp_staff_info', $staff_count != ++$count ? ' sp_staff_divider' : '', '">
', sp_embed_image($icons[$staff['type']]), ' ', $staff['link'], '<br />
', $staff['group'], '
</td>
</tr>';

Replace with:
Code: [Select]
foreach ($staff_list as $staff)
echo '
<tr>
<td class="sp_staff sp_center">', !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 class="sp_staff_info', $staff_count != ++$count ? ' sp_staff_divider' : '', '">
', $staff['id_group'] == 15 ? sp_embed_image($icons[3]) : sp_embed_image($icons[$staff['type']]) ' ', $staff['link'], '<br />
', $staff['group'], '
</td>
</tr>';

Offline ccbtimewiz

  • Hero Member
  • *****
  • Posts: 2185
  • Gender: Male
  • $("div.content:dd").hide();
  • SMF Version: None
  • SP Version: None
  • Elkarte Version: None
  • EhPortal Version: None
Re: Staff list icon
« Reply #4 on: September 28, 2015, 11:19:10 PM »
Was this solution enough? If so could you mark the topic as solved? o:

Offline ♦ Ninja ZX-10RR ♦

  • Spammer Hammer
  • Support
  • *
  • Posts: 1193
  • Gender: Male
  • Sniper Legends
    • Virtual Interactive Games Entertainment™
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: 1.0.6
Re: Staff list icon
« Reply #5 on: September 29, 2015, 06:59:27 AM »
Last time he was active has been earlier than your code-reply, so I don't really know when he will login again, if at all (in which case I ask myself if users really need what they ask for).
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