PDA

View Full Version : Moderator Dropdown Listing


Feran
01-19-2004, 10:00 PM
Yeah, I found it kinda annoying how having multiple moderators for one forum would make things rather ugly and cluttery and jumble up my front page. So, I made this nifty little hack ^_^

Features:
- Upon choosing a moderator, it will link to that moderator's profile
- A link to showgroups.php

Download, install, enjoy. Only one edit!! 8)

Open includes/functions_forumlist.php, find this:

//////////////////////////////////////////////////////////////////

// get moderators ( this is why we needed cache_moderators() )
if ($vboptions['showmoderatorcolumn'])
{
$showmods = array();
$listexploded = explode(',', $forum['parentlist']);
foreach ($listexploded AS $parentforumid)
{
if (!isset($imodcache["$parentforumid"]))
{
continue;
}
foreach($imodcache["$parentforumid"] AS $moderator)
{
if ($showmods["$moderator[userid]"] === true)
{
continue;
}

$showmods["$moderator[userid]"] = true;
if (!isset($forum['moderators']))
{
eval('$forum[\'moderators\'] = "' . fetch_template('forumhome_moderator') . '";');
}
else
{
eval('$forum[\'moderators\'] .= ", ' . fetch_template('forumhome_moderator') . '";');
}
}
}
if (!isset($forum['moderators']))
{
$forum['moderators'] = '';
}
}


//////////////////////////////////////////////////////////////////

Replace it with this:

//////////////////////////////////////////////////////////////////

// get moderators ( this is why we needed cache_moderators() )
if ($vboptions['showmoderatorcolumn'])
{
$showmods = array();
$listexploded = explode(',', $forum['parentlist']);
foreach ($listexploded AS $parentforumid)
{
if (!isset($imodcache["$parentforumid"]))
{
continue;
}
foreach($imodcache["$parentforumid"] AS $moderator)
{
if ($showmods["$moderator[userid]"] === true)
{
continue;
}

$forum['moderators'] .= "<option value='{$moderator[userid]}'>{$moderator[username]}</option>";
}

}

$modhack_head = <<< CONTENT

<script>
<!--
function moddrophack_redir(tparam)
{
if (tparam != -1) {
location.href = 'member.php?userid=' + tparam;
}
else {
location.href = 'showgroups.php';
}
}
// -->
</script>

<form method="post">

<select id="moddrophack" onchange="moddrophack_redir(this.options[selectedIndex].value)">
<option value="-1">--------------</option>

CONTENT;

$modhack_foot = '<option value="-1">View All Mods</option></select></form>';

if (!isset($forum['moderators']))
{
$forum['moderators'] = '';
}
else {
$forum['moderators'] = $modhack_head . $forum['moderators'] . $modhack_foot;
}
}

Exero
01-20-2004, 07:56 PM
hey cool
i could use this for my new style on my forum
thanks :D

NTLDR
01-20-2004, 08:51 PM
You really shouldn't hard code all that HTML into the file.

Zachery
01-20-2004, 09:20 PM
i was planning on releasing this as a template mod ... lmao guess i still will :)
have it done just didnt get to releasing it today

Feran
01-20-2004, 10:47 PM
You really shouldn't hard code all that HTML into the file.
Everyone's a critic -.- I swear I can't release one hack here without some negative commentary.

I admit that repeating the <script> tag so many times is silly (I'm lazy, remember!), but the <option value="x"> is contingent upon the moderator userid! I don't see how I'm going to incorporate for loops into the template, and remember that the moderator template is for every moderator name listing on your forums, meaning that if I threw <option> into the template it would appear that way.. in wayyy too many places :p

If you're going to complain, at least do me the decency of providing the solution for the benefit of the users :p

Boofo
01-21-2004, 12:01 AM
Can this be done in the forums manager where we choose a mod for that forum? Right now you have to enter a name manually and sometimes the name isn't spelled as we think it is. ;)

NTLDR
01-21-2004, 12:11 AM
I don't see how I'm going to incorporate for loops into the template, and remember that the moderator template is for every moderator name listing on your forums, meaning that if I threw <option> into the template it would appear that way.. in Way too many places :p

You don't, you eval the template multiple times from within the for loop, just like the existing moderator template is evaled multiple times in the loop. vB3 has Template Conditionals too, which make it very simple to only use the option code in the places you want it to appear ;)

If you're going to complain, at least do me the decency of providing the solution for the benefit of the users :p

If I wanted this hack I'd have coded it myself :p I was just providing constructive criticism like I do with many hacks.

Merjawy
01-22-2004, 08:22 PM
I have tried it but I get errors and forum won't load

I made sure I did it right few times, but no luck here

usinin vB3.0 RC3

Parse error: parse error, unexpected T_SL in D:\home\public_html\forums\includes\functions_foru mlist.php on line 373

Fatal error: Call to undefined function: construct_forum_bit() in D:\home\public_html\forums\index.php on line 387

Allan
01-24-2004, 07:04 AM
I have tried it but I get errors and forum won't load

I made sure I did it right few times, but no luck here

usinin vB3.0 RC3

Parse error: parse error, unexpected T_SL in D:\home\public_html\forums\includes\functions_foru mlist.php on line 373

Fatal error: Call to undefined function: construct_forum_bit() in D:\home\public_html\forums\index.php on line 387

idem

SunderlandJ
01-24-2004, 07:45 PM
I'm a complete newbie, and I keep getting parse errors on line 373. I have no idea as to what to do with scripts, so I can't edit this myself, and I don't know anyone that is good with php.

I really want this script, but have no idea how I can install it without getting all these errors - Please can someone help?

Zachery
01-24-2004, 09:01 PM
see the big [vB3.0.0] in the version number?

its a big arsed no nothing for vB3 will work with vB2

try vbulletintemplates.com for a vB2 version of moderator drop downs

SunderlandJ
01-24-2004, 09:06 PM
Just thought that I would make my post clear that the problem I am having is for version 3.0 and not the 2x

sjau
01-29-2004, 07:49 PM
Is there now a fix for 3.0.0 RC 3?

alshehi
01-29-2004, 09:24 PM
>>...

AN-net
02-06-2004, 04:02 PM
yeah this doesnt work with rc3, someone should edit the version to vb3 gama or whatever this hack works with

Feran
02-10-2004, 12:39 AM
yeah this doesnt work with rc3, someone should edit the version to vb3 gama or whatever this hack works with
Rofl, that sucks. I'll have to look into it <.< Um, i'll fix it by tomorrow.

Papino
02-13-2004, 03:21 PM
no fix yet? im very interested to this nice hack..


pls Feran :)

Solid-Snake
02-22-2004, 04:37 AM
<_<
Can you pleasssse do this?
Your going to force me to have to do it myself...thats not a pretty site when a lazy ass like me does something useful.

gmarik
02-22-2004, 06:38 AM
who neeeds them anyway ...

LordJMann
02-24-2004, 01:09 AM
For everybody who was waiting for a template version of this, and that works with the latest version of vB3, check this out:

http://www.vbulletintemplates.com/mods/showthread.php?p=46831#post46831

Enjoy! :)

aloha
04-30-2004, 09:05 AM
<_<
Can you pleasssse do this?
Your going to force me to have to do it myself...thats not a pretty site when a lazy ass like me does something useful.


LMAO

Alfi
03-12-2005, 12:51 PM
Hmm, I dont know why, but it works on the main forums, but not on sudforums. Does anyone else face the same problem?

Lol, it could be just me, I installed it at 4 in the morning :P

FuZE
05-16-2005, 02:20 PM
Will This Work On 3.0.7?

HarryBO
05-20-2005, 04:44 PM
Thx very nice Add on!