[Ayuda]  New Thread plugin
Hi, I have activated "new thread" plugin, can you tell me if is possible to select only certain forums in new.php page? Thank you in advance

Hi, I have activated "new thread" plugin, can you tell me if is possible to select only certain forums in new.php page? Thank you in advance
paste here the php file
:)
Código:
<?php

if(!defined("IN_MYBB"))
{
    die("Esta prohibido el accesso directo a este archivo<br /><br />Conctata con el administrador para obtenerlo.");
}
$plugins->add_hook("new_thread_start","new_thread_function");
function new_info()
{
    return array(
        "name"            => "New Thread",
        "description"    => "Create a thread in the forum that you want",
        "website"        => "http://www.mybb-es.com",
        "author"        => "Edson Ordaz",
        "authorsite"    => "mailto:[email protected]",
        "version"        => "1.0",
        "compatibility" => "16*",
        "guid"            => "d38c8b8f8919cfccdb9596354fe510b5"
    );
}


function new_activate(){
    global $db;
      $new_thread  = array(
        "tid" => "NULL",
        "title" => "new_thread",
        "template" => $db->escape_string('<html>
<head>
<title>{$lang->newthread_in}</title>
{$headerinclude}
<script type="text/javascript" src="jscripts/post.js?ver=1400"></script>
</head>
<body>
{$header}
{$preview}
{$thread_errors}
{$attacherror}
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead"><strong>{$lang->post_new_thread}</strong></td>
</tr>
<tr>
<td class="trow2" width="100%">
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" width="100%">
<td align="left" width="60%">
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" width="100%">
<tr>
<form action="newthread.php" method="post" enctype="multipart/form-data" name="input">
<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
<td class="trow2">
<span style="font-size:18px;font-weight: bold;">{$lang->thread_subject}:</span><br />
<input type="text" class="textbox" name="subject" size="40" maxlength="85" value="{$subject}" tabindex="1" /></td>
</tr>
<td class="trow2">
<span style="font-size:18px;font-weight: bold;">{$lang->your_message}</span><br />
<textarea name="message" id="message" rows="20" cols="70" tabindex="2">{$message}</textarea>
{$codebuttons}
</td>
</tr>
</table>
</td>
<td align="rigth" valign="top" width="40%">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><span style="font-size:18px;font-weight: bold;">Forums:</span><br />
{$forumsselected}
</td>
</tr>
</table>
</td>
</table>
</td>
</tr>
<tr>
<td class="trow1" valign="top"><strong>{$lang->post_options}</strong><br/><span class="smalltext">
<label><input type="checkbox" class="checkbox" name="postoptions[signature]" value="1" tabindex="7"{$postoptionschecked[\'signature\']} />{$lang->options_sig}</label>
</span></td>
</tr>
{$modoptions}
{$subscriptionmethod}
{$pollbox}
</table>
<br />
<div style="text-align:center"><input type="submit" class="button" name="submit" value="{$lang->post_thread}" tabindex="4" accesskey="s" />  <input type="submit" class="button" name="previewpost" value="{$lang->preview_post}" tabindex="5" />{$savedraftbutton}</div>
<input type="hidden" name="action" value="do_newthread" />
<input type="hidden" name="posthash" value="{$posthash}" />
<input type="hidden" name="attachmentaid" value="" />
<input type="hidden" name="attachmentact" value="" />
<input type="hidden" name="quoted_ids" value="{$quoted_ids}" />
<input type="hidden" name="tid" value="{$tid}" />
{$editdraftpid}
</form>
{$forumrules}
{$footer}
</body>
</html>'),
        "sid" => "-1",
    );
    $new_thread_modoptions  = array(
        "tid" => "NULL",
        "title" => "new_thread_modoptions",
        "template" => $db->escape_string('<tr>
<td class="trow2" valign="top"><strong>{$lang->mod_options}</strong>
<br />
<label><input type="checkbox" class="checkbox" name="modoptions[closethread]" value="1"{$closecheck} />&nbsp;{$lang->close_thread}</label><br />
<label><input type="checkbox" class="checkbox" name="modoptions[stickthread]" value="1"{$stickycheck} />&nbsp;{$lang->stick_thread}</label>
</span></td>
</tr>'),
        "sid" => "-1",
    );
    $new_thread_postpoll  = array(
        "tid" => "NULL",
        "title" => "new_thread_postpoll",
        "template" => $db->escape_string('<tr>
<td class="trow1" valign="top">
<strong>{$lang->poll}</strong><br /><span class="smalltext">{$lang->poll_desc}</span>
<br />
<span class="smalltext"><label><input type="checkbox" class="checkbox" name="postpoll" value="1" {$postpollchecked} /><strong>{$lang->poll_check}</strong></label><br />
{$lang->num_options} <input type="text" class="textbox" name="numpolloptions" value="{$numpolloptions}" size="10" /> {$lang->max_options}</span>
</td>
</tr>'),
        "sid" => "-1",
    );
    $new_thread_subscription  = array(
        "tid" => "NULL",
        "title" => "new_thread_subscription",
        "template" => $db->escape_string('<tr>
<td class="{$bgcolor}" valign="top">{$lang->thread_subscription_method}
<br />
    <label><input type="radio" name="postoptions[subscriptionmethod]" {$postoptions_subscriptionmethod_dont} value="" style="vertical-align: middle;" /> {$lang->no_subscribe}</label><br />
    <label><input type="radio" name="postoptions[subscriptionmethod]" {$postoptions_subscriptionmethod_none} value="none" style="vertical-align: middle;" /> {$lang->no_email_subscribe}</label><br />
    <label><input type="radio" name="postoptions[subscriptionmethod]" {$postoptions_subscriptionmethod_instant} value="instant" style="vertical-align: middle;" /> {$lang->instant_email_subscribe}</label><br />
</td>
</tr>'),
        "sid" => "-1",
    );
    $db->insert_query("templates", $new_thread);
    $db->insert_query("templates", $new_thread_modoptions);
    $db->insert_query("templates", $new_thread_postpoll);
    $db->insert_query("templates", $new_thread_subscription);
}

function new_deactivate(){
    global $db;
    $db->delete_query("templates","title = 'new_thread'");
    $db->delete_query("templates","title = 'new_thread_modoptions'");
    $db->delete_query("templates","title = 'new_thread_postpoll'");
    $db->delete_query("templates","title = 'new_thread_subscription'");
}

function new_thread_function()
{
    function cache_forums_select($size=24,$width=230)
    {
        global $forum_cache, $cache;
        
        if(!$forum_cache)
        {
            $forum_cache = $cache->read("forums");
            if(!$forum_cache)
            {
                $cache->update_forums();
                $forum_cache = $cache->read("forums", 1);
            }
        }
        $forum = array();
        foreach($forum_cache as $forums)
        {
            if($forums['type'] != "c")
            {
                $forum .= "<option value=\"".$forums[fid]."\">".$forums[name]."</option>";
            }
        }
        $forum_selected = "<select name=\"fid\" size=\"{$size}\" style=\"width: {$width}px\">
        ".$forum."</select>";
        return $forum_selected;
    }
}
?>

I think need edit in $forums[fid] but I don't know how..for example to show only forum fid number 1,5 and 6 and "hide" other fid forums (2,3,4,7) in the list.

Thank you
Última modificación: 25 Sep, 2012, 10:54 am por stomozo.