SimplePortal

Customization => Custom Coding => Topic started by: mredd on July 30, 2013, 06:55:55 PM

Title: forum staff block
Post by: mredd on July 30, 2013, 06:55:55 PM
Hi All.

I have read posts regarding forum staff but cant find any that answer the mod I would like to make to it.

I am running SMF Version: 2.0.4 and SP Version:  2.3.5

What I would like to do is add a new group to the staff list called ( Bailiff  ) so they are listed in the staff block list.

How could I do this, would this involve much code modification.

Thanks for any help offered.

Regards.
mredd.
Title: Re: forum staff block
Post by: [SiNaN] on July 31, 2013, 12:55:18 PM
Welcome to SimplePortal!

This is a little edit a SimplePortal source file. First you need to figure out the id of the group (Bailiff) to be used in the code we're going to add. Just go to Admin > Members > Membergroups page. See the address for the Modify link of the group that you want to include in your staff list. (you can copy the link and paste it to somewhere to have a better view) You need the number at end of the address. For example:

yoursite.com/index.php?action=admin;area=membergroups;sa=edit;group=36

Once you take a note of the id of the group, then make this change in your files:

Sources/PortalBlocks.php

Code: (Find) [Select]
$global_mods = membersAllowedTo('moderate_board', 0);
Code: (Replace) [Select]
$request = $smcFunc['db_query']('', '
SELECT id_member
FROM {db_prefix}members
WHERE id_group = {int:custom_group}',
array(
'custom_group' => 36,
)
);
while ($row = $smcFunc['db_fetch_assoc']($request))
$local_mods[$row['id_member']] = $row['id_member'];
$smcFunc['db_free_result']($request);

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

Note that you need to change 36 as the number you got from the link. Hope that works for you!
Title: Re: forum staff block
Post by: mredd on August 03, 2013, 11:27:08 AM
Thanks [SINaN]

would I have to do this for each group, I have 5 of them.

Thanks for your help.
Regards.
mredd.
Title: Re: forum staff block
Post by: [SiNaN] on August 14, 2013, 11:56:46 AM
You're welcome! If you have multiple groups this should be better:

Sources/PortalBlocks.php

Code: (Find) [Select]
$global_mods = membersAllowedTo('moderate_board', 0);
Code: (Replace) [Select]
$request = $smcFunc['db_query']('', '
SELECT id_member
FROM {db_prefix}members
WHERE id_group IN ({int:custom_groups})',
array(
'custom_groups' => array(36, 39, 42),
)
);
while ($row = $smcFunc['db_fetch_assoc']($request))
$local_mods[$row['id_member']] = $row['id_member'];
$smcFunc['db_free_result']($request);

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

36, 39, 42 are the group ids, separated by commas.
SimplePortal 2.3.8 © 2008-2024, SimplePortal