SimplePortal

Customization => Blocks and Modifications => Block Requests => Topic started by: Laughoften on December 23, 2008, 11:53:08 AM

Title: Blocks Request
Post by: Laughoften on December 23, 2008, 11:53:08 AM
Hi,

Could we please get the following blocks added?

Staff Block
Hacks Classifieds Block

Thanks alot!! :)
Title: Re: Blocks Request
Post by: [SiNaN] on January 01, 2009, 09:48:19 AM
What does staff block should supposed to do? List staff members?

Also I'm not sure about Hacks Classifieds. Is it related to Classifieds mod by vbgamer45?
Title: Re: Blocks Request
Post by: Laughoften on January 01, 2009, 11:38:03 AM
Hi,

Staff Block to list staff members with avatar
SM Classifieds-Yes
Title: Re: Blocks Request
Post by: [SiNaN] on January 01, 2009, 11:42:51 AM
First one might be possible, I'll check that tonight.

But AFAIK, SMF Classifieds is a paid mod, which I don't have. It would be a better idea to ask a block code from vbgamer45.
Title: Re: Blocks Request
Post by: Laughoften on January 01, 2009, 11:58:30 AM
Okay.

Thanks alot  :)
Title: Re: Blocks Request
Post by: [SiNaN] on February 02, 2009, 10:36:18 AM
Sorry for delay, I never forget this. But didn't had time.

Use these codes in a PHP block:

Code: [Select]
global $db_prefix, $scripturl, $modSettings, $color_profile;

$staff_groups = array(1, 2);

$request = db_query("
SELECT
mem.ID_MEMBER, mem.realName, mem.avatar, a.ID_ATTACH, a.attachmentType, a.filename,
mem.ID_GROUP, mg.groupName AS member_group, pg.groupName AS post_group
FROM {$db_prefix}members AS mem
LEFT JOIN {$db_prefix}moderators AS mods ON (mods.ID_MEMBER = mem.ID_MEMBER)
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 = mem.ID_GROUP)
LEFT JOIN {$db_prefix}membergroups AS pg ON (pg.ID_GROUP = mem.ID_POST_GROUP)
WHERE (mods.ID_MEMBER IS NOT NULL OR mem.ID_GROUP IN (" . implode(', ', $staff_groups) . ") OR FIND_IN_SET(" . implode(', mem.additionalGroups) OR FIND_IN_SET(', $staff_groups) . ", mem.additionalGroups))", __FILE__, __LINE__);
$members = array();
while ($row = mysql_fetch_assoc($request))
{
if (isset($members[$row['ID_MEMBER']]))
continue;

if (stristr($row['avatar'], 'http://') && !empty($modSettings['avatar_check_size']))
{
$sizes = url_image_size($row['avatar']);

if ($modSettings['avatar_action_too_large'] == 'option_refuse' && is_array($sizes) && (($sizes[0] > $modSettings['avatar_max_width_external'] && !empty($modSettings['avatar_max_width_external'])) || ($sizes[1] > $modSettings['avatar_max_height_external'] && !empty($modSettings['avatar_max_height_external']))))
{
$row['avatar'] = '';
updateMemberData($row['ID_MEMBER'], array('avatar' => '\'\''));
}
}

$colorids[$row['ID_MEMBER']] = $row['ID_MEMBER'];

$members[$row['ID_MEMBER']] = array(
'id' => $row['ID_MEMBER'],
'name' => $row['realName'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>',
'group' => !empty($row['member_group']) ? $row['member_group'] : $row['post_group'],
'group_id' => !empty($row['ID_GROUP']) ? $row['ID_GROUP'] : 200,
'avatar' => array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? '<img src="' . (empty($row['attachmentType']) ? $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'] . '" alt="" class="avatar" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? (empty($row['attachmentType']) ? $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']),
)
);
}
mysql_free_result($request);

if (empty($members))
return 'There are no members.';

$position = array();
$member_ids = array();

foreach ($members as $key => $member)
{
$position[$key] = $member['group_id'];
$member_ids[$key] = $member['id'];
}

array_multisort($position, SORT_ASC, $member_ids, SORT_ASC, $members);

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

echo '
<table>';

foreach ($members as $member)
echo '
<tr>
<td style="width: 55px; text-align: center;">', !empty($member['avatar']['href']) ? '
<img src="' . $member['avatar']['href'] . '" alt="' . $member['name'] . '" width="50" />' : '', '
</td>
<td>
', $member['link'], '<br />', $member['group'], '
</td>
</tr>';

echo '
</table>';

Added to the Bug Tracker also.

http://simpleportal.net/index.php?issue=124.0
Title: Re: Blocks Request
Post by: dougsbrat on February 02, 2009, 01:09:25 PM
Just tried this block..
while it looks great!  ;D

it shows there are about 40 of me (only staff)

I upgraded my test user to staff,
now it shows 40 of me and 1 test user as staff

prob a typo in the code causing a loop?


oops I guess I sould have put it in the bug tracker, sorry will c/p
Title: Re: Blocks Request
Post by: [SiNaN] on February 02, 2009, 03:09:22 PM
Well, I have 6 users in my test from.

sinan
+ Administrator
+ Global Moderator
+ Board Moderator

another
+ Administrator
+ Global Moderator

mod
+ Global Moderator
+ Board Moderator

New One
+ Global Moderator

gmod
+ Board Moderator

tester
+ Board Moderator

Result is:

sinan
+ Administrator
another
+ Administrator
mod
+ Global Moderator
New one
+ Global Moderator
gmod
+ Newbie
tester
+ Newbie

which is just perfect.

Have you modified anything in the code? May I see your forum?

And you better post in this topic as the code that will go into SimplePortal will probably be different.
Title: Re: Blocks Request
Post by: dougsbrat on February 02, 2009, 04:06:10 PM
Have you modified anything in the code? May I see your forum?

And you better post in this topic as the code that will go into SimplePortal will probably be different.

no modification, just cut and paste from above

I used it in a smaller forum I have...
5 catagories of which 2 users moderate 4 of them, one has no moderator set

there were 4 listings of the 2 users that were listed
I suspect it is counting one person for each categories they moderate.

http://ditchbug.x10hosting.com/smf/
Title: Re: Blocks Request
Post by: [SiNaN] on February 02, 2009, 04:18:24 PM
Fixed the codes above, would you give it a try?
Title: Re: Blocks Request
Post by: dougsbrat on February 02, 2009, 04:24:27 PM
PERFECT on both forums

Thanks  ;D
Title: Re: Blocks Request
Post by: [SiNaN] on February 02, 2009, 04:25:09 PM
My pleasure.
Title: Re: Blocks Request
Post by: codered1702 on September 21, 2009, 07:40:48 PM
Is there a way to add a custom group to this and make it scrollable as i have many members as a part of this. I have over 40 members of a gaming site that I want a custom group to be added to it so people can see who the actual members are.
SimplePortal 2.3.8 © 2008-2024, SimplePortal