Customizing SMF > Tips and Tricks

Adding mod drop down box to forum index

(1/1)

codenaught:
I think I want to try out using a moderator drop down box on the far right after where it says Last Post.

So it would look something like how iB does it.

Example: (Scoll Right To see Mod Drop Down Box)



Basically I would want it just like that. So it would say moderator and then you could click it to drop down to see the moderators of that forum.

Does anyone think they can help me with that?

I was able to do that myself when I used IPB, but now as SMF uses php in their template files it gets me confused.  :P

[edit] I think this would be done using BoardIndex.template.php right? I think I want this done with the classic BoardIndex.template.php file but if you want you can explain how to do it with the default one and I can figure out how to adjust it to the classic one[/edit]

A.M.A:
in the default theme BoardIndex.template.php look for:

--- Code: --- <td colspan="4" class="catbg', $category['new'] ? '2' : '', '" height="18">';
--- End code ---
replace it with:

--- Code: --- <td colspan="5" class="catbg', $category['new'] ? '2' : '', '" height="18">';
--- End code ---


look for:

--- Code: --- ', $txt['smf88'], ' ', $board['last_post']['link'], ' ', $txt[525], ' ', $board['last_post']['member']['link'];

echo '
</td>

--- End code ---
add after:

--- Code: --- <td class="smalltext" valign="middle">
<select name="ModLst">
<option value="" style="font-weight: bold;">Moderator(s)</option>';

// Show the Moderators drop down list!
foreach ($board['link_moderators'] as $boardI=> $boardM)
{
echo '
<option value="">',$boardM,'</option>';
}
echo '
</select>
</td>

--- End code ---


finally find and delete this:

--- Code: --- // Show the "Moderators: ".  Each has name, href, link, and id. (but we're gonna use link_moderators.)
if (!empty($board['moderators']))
echo '
<div style="padding-top: 1px;" class="smalltext"><i>', count($board['moderators']) == 1 ? $txt[298] : $txt[299], ': ', implode(', ', $board['link_moderators']), '</i></div>';

--- End code ---
Do not forget to backup the template first.

codenaught:
Thanks. I adjusted that code for the classic BoardIndex.template and it worked very well! Now I think I may increase the width of my forum a bit as now I have 5 boxes using the classic one and so it looks a bit cluttered.  ;)

Navigation

[0] Message Index

Go to full version