vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Moderator Dropdown Listing (https://vborg.vbsupport.ru/showthread.php?t=60526)

Feran 01-19-2004 10:00 PM

Moderator Dropdown Listing
 
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)

PHP Code:

Open includes/functions_forumlist.phpfind 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

Quote:

Originally Posted by NTLDR
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

Quote:

Originally Posted by Feran
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 ;)

Quote:

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

Quote:

Originally Posted by Merjawy
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?


All times are GMT. The time now is 07:44 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01219 seconds
  • Memory Usage 1,781KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete