News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Need help!(About membergroups)

Started by nunopitbull, October 24, 2009, 06:50:22 PM

Previous topic - Next topic

Arantor

Argh, I was thinking of the wrong thing. If you want to add it into the linktree rather than the rest of the template, that's actually a change to theme_linktree() in index.template.php.

The problem is, it's board specific, so the information pretty much has to be pushed from MessageIndex.php itself. I can give you a guide for you to add it in for yourself though.

nunopitbull


Arantor

In MessageIndex.php you'll see this block of code:

// Build a list of the board's moderators.
$context['moderators'] = &$board_info['moderators'];
$context['link_moderators'] = array();
if (!empty($board_info['moderators']))
{
foreach ($board_info['moderators'] as $mod)
$context['link_moderators'][] ='<a href="' . $scripturl . '?action=profile;u=' . $mod['id'] . '" title="' . $txt[62] . '">' . $mod['name'] . '</a>';

$context['linktree'][count($context['linktree']) - 1]['extra_after'] = ' (' . (count($context['link_moderators']) == 1 ? $txt[298] : $txt[299]) . ': ' . implode(', ', $context['link_moderators']) . ')';
}


You will need to make a list of the moderators for each board, their id number and their name.

Then before $context['moderators'] = &$board_info['moderators']; add:

$moderators = array(
1 => array(
array('id' => 123, 'name' => 'Moderator A'),
array('id' => 456, 'name' => 'Moderator B'),
),
5 => array(
array('id' => 789, 'name' => 'Moderator C'),
array('id' => 1234, 'name' => 'Moderator D'),
),
);
if(isset($moderators[$board_info['id']]))
$board_info['moderators'] = $moderators[$board_info['id']];


This says, Moderator A (user id 123) and Moderator B (user id 456) are moderators of board 1, and Moderator C (id 789) and Moderator D (id 1234) are moderators of board 5. Boards 2, 3, 4 etc will not show any extra moderators.

Just go through and fill that out for all your boards and moderators, adding new entries as necessary.

nunopitbull

And what Board 1 and 2 will be repective too? I'll have to play lottery and try guess if board 1 = Portuguese moderator for example? :P Or there is any kind of order?

Arantor

Look at your forum's URLs.

When you see a URL that contains board=1.0, that's board 1.

This board, for example, http://www.simplemachines.org/community/index.php?board=60.0 is board 60.

nunopitbull

I cant find that bit of code on my messageindex.template.php ...

Arantor

That's because it isn't there. As I said... MessageIndex.php - it's in Sources.

nunopitbull

With that, i still need the change on the Board description? This thing:
Post here your problems related to L2.<br /><span class="smalltext" style="padding-top:1px;"><i>Moderator: <a title="L2 Help Moderator" href="index.php?action=profile;u=80">chuchy</a></i></span>

Also, i attached the edit file, can you check if its ok?

nunopitbull

Lol, i still need to have that thing on board description, i thought this would do all the changes necessary :/

Arantor

Yes, you still need the changes to the board description. I never said it would do anything else.

Does the edit work out for you? If so I don't need to check it.

nunopitbull

Yeap, and thanks for all the help :P . But...is there any simple mod that can do both things? Or some mod that add some fileds when u Press Board that they can add it on the link tree

Arantor

You could write a mod but it'll be SPECIFIC to your forum, meaning that it won't be on the mod (since we'd never approve it) so you have to have it specific to your forum by making the edits yourself.

nunopitbull

Problem is that i have no idea how to do a mod or even know Php language :P

Arantor

Well, the code I've given you is a mod to your source.

The only difference is that it's not in a handy-dandy package for the package manager.

Were a mod to be written it would just do exactly what you've already done, really.

nunopitbull

So teach me how to "write" a mod, i mean, something that will do it automaticly :x

I mean, adding the Board ID in a field + Mod ID in other field + Mod aname or smth xD

Arantor

Like I said it would be specific to your site and would do almost nothing that the code you have above does already. All it would do would make a little interface which would be 3-4x the amount of code you already have.

nunopitbull

Yes I know that, as you noticed all around, it's only for my forum :P .

I like to program, i programed mIRC language alot. Even made a mIRC client. But i kinda not familiar with Php.
So if you can give me a hand i apreciate :).

Arantor

It's not just PHP. It's across multiple PHP files, and likely adding a database query or two.

It's a surprising amount of work. I can't just teach you to do it without teaching you PHP first or simply writing the entire mod, which to be frank I don't actually have the time to do right now given my todo list.

nunopitbull

Aw, i thought it was a smth like 15m work :P , thanks for the all support given anyways!

Nice end-of-Sunday, and see you in my next problem :D

Advertisement: