Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: Михаило on February 19, 2018, 10:05:12 AM

Title: Moderators of the board
Post by: Михаило on February 19, 2018, 10:05:12 AM
Hi,

is it possible to add a new 'section' here https://i.imgur.com/HngPHvI.png ?
After the box where it says 'Last post' I would like to add a special section where it can show a list of moderators for that board. Is it possible?

This is from vBulletin 3.x. https://prnt.sc/igvubu


Thanks in advance.
Title: Re: Moderators of the board
Post by: vii on March 01, 2018, 09:38:16 PM
Sure

I assume you want this for the default theme: Open Themes/default/BoardIndex.php


1. You need to adjust the board list table's colspan from 4 to 5, since we are adding a new column.

Find (around line 103):

<td colspan="4">

Replace with:

<td colspan="5">


2. Add the new column

Find (around line 184):


/* The board's and children's 'last_post's have:
time, timestamp (a number that represents the time.), id (of the post), topic (topic id.),
link, href, subject, start (where they should go for the first unread post.),
and member. (which has id, name, link, href, username in it.) */
if (!empty($board['last_post']['id']))
echo '
<p><strong>', $txt['last_post'], '</strong>  ', $txt['by'], ' ', $board['last_post']['member']['link'] , '<br />
', $txt['in'], ' ', $board['last_post']['link'], '<br />
', $txt['on'], ' ', $board['last_post']['time'],'
</p>';
echo '
</td>
</tr>';


Replace with:


/* The board's and children's 'last_post's have:
time, timestamp (a number that represents the time.), id (of the post), topic (topic id.),
link, href, subject, start (where they should go for the first unread post.),
and member. (which has id, name, link, href, username in it.) */
if (!empty($board['last_post']['id']))
echo '
<p><strong>', $txt['last_post'], '</strong>  ', $txt['by'], ' ', $board['last_post']['member']['link'] , '<br />
', $txt['in'], ' ', $board['last_post']['link'], '<br />
', $txt['on'], ' ', $board['last_post']['time'],'
</p>';
echo '
</td>';

// Moderator box at the end
if (!empty($board['moderators'])) {
echo '
<td class="windowbg">
<p><strong>Moderators</strong><br />
', (count($board['moderators']) ? implode(', ', $board['link_moderators']) : 'None'), '
</p>';
echo '
</td>';
}

// End table
echo '</tr>';



Result: I attached a screenshot of what the result looks like (ModBox_SMF2.png)


Note: Keep in mind that it already lists the Moderators below each board. The code for that is around line 169