2021-01-30, 01:46 AM
(2021-01-30, 01:16 AM)PARADOXP Wrote: [ -> ]Thank You So Much Brother 😘 for this.
You don't know what you have just done this. I was trying myself to solve thsese problems and also was successful but not as much you. You did this very well and amazing.
No worries, I am sorry that I did not have much free-time to look at this much further, but, I am glad to hear that it got it sorted out for you.
oh, one other thing I had noticed on just a thought, but that, perhaps:
<td align="left" width="60%">
and:
<td align="right" valign="top" width="40%">
might perhaps change to:
<td align="left" width="80%">
<td align="right" valign="top" width="20%">
ie:
note: changed in previous attachment 1.1 https://community.mybb.com/attachment.php?aid=43707 * also corrected the existing misspelling of "right" ex:"rihgt" that caused issue with the 40%er
Though in this one "1.1.2" I kinda changed the layout a lil and added prefix selector and posticons [attachment=43710]
ie:
forum(root)/inc/plugins/new.php:
<?php
/**
* MyBB 1.8
* New Thread
* Create a thread in the forum that you want
* Website: http://www.mybb-es.com
*
* Author(s): Edson Ordaz & Vintagedaddyo
*
* File: inc/plugins/new.php
*
* Version: 1.1.2
*
*/
if(!defined("IN_MYBB"))
{
die("This file cannot be accessed directly.");
}
$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 & minor edits by Vintagedaddyo",
"authorsite" => "mailto:[email protected]",
"version" => "1.1.2",
"compatibility" => "18*",
"guid" => "d38c8b8f8919cfccdb9596354fe510b5"
);
}
function new_activate(){
global $db;
$new_thread = array(
"tid" => "0",
"title" => "new_thread",
"template" => $db->escape_string('<html>
<head>
<title>{$lang->post_new_thread}</title>
{$headerinclude}
{$post_javascript}
</head>
<body>
{$header}
{$preview}
{$thread_errors}
{$moderation_notice}
<form action="newthread.php" method="post" enctype="multipart/form-data" name="input">
<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead" colspan="2"><strong>{$lang->post_new_thread}</strong></td>
</tr>
{$loginbox}
<tr>
<td class="trow2" width="20%"><strong>{$lang->thread_subject}</strong></td>
<td class="trow2">{$prefixselect} <input type="text" class="textbox" name="subject" size="40" maxlength="85" value="{$subject}" tabindex="1" /></td>
</tr>
{$posticons}
<tr>
<td class="trow2" valign="top"><strong>{$lang->your_message}</strong><br /><span style="font-size:18px"><strong>{$lang->forumbit_forum}:</strong></span><br />{$forumsselected}</td>
<td class="trow2" valign="top">
<textarea name="message" id="message" rows="20" cols="70" tabindex="2" style="height: 540px;">{$message}</textarea>
{$codebuttons}
</td>
</tr>
{$postoptions}
{$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_postoptions = array(
"tid" => "0",
"title" => "new_thread_postoptions",
"template" => $db->escape_string('<tr>
<td class="trow1" valign="top"><strong>{$lang->post_options}</strong></td>
<td class="trow1"><span class="smalltext">
<label><input type="checkbox" class="checkbox" name="postoptions[signature]" value="1" tabindex="7"{$postoptionschecked[\'signature\']} /> {$lang->options_sig}</label><br />
<label><input type="checkbox" class="checkbox" name="postoptions[disablesmilies]" value="1" tabindex="9"{$postoptionschecked[\'disablesmilies\']} /> {$lang->options_disablesmilies}</label></span>
</td>
</tr>'),
"sid" => "-1",
);
$new_thread_modoptions = array(
"tid" => "0",
"title" => "new_thread_modoptions",
"template" => $db->escape_string('<tr>
<td class="trow1" valign="top"><strong>{$lang->mod_options}</strong></td>
<td class="trow1"><span class="smalltext">
<label><input type="checkbox" class="checkbox" name="modoptions[closethread]" value="1"{$closecheck} /> {$lang->close_thread}</label><br />
<label><input type="checkbox" class="checkbox" name="modoptions[stickthread]" value="1"{$stickycheck} /> {$lang->stick_thread}</label></span>
</td>
</tr>'),
"sid" => "-1",
);
$new_thread_postpoll = array(
"tid" => "0",
"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></td>
<td class="trow1">
<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_subscriptionmethod = array(
"tid" => "0",
"title" => "new_thread_subscriptionmethod",
"template" => $db->escape_string('<tr>
<td class="trow1" valign="top"><strong>{$lang->thread_subscription_method}</strong><br /><span class="smalltext">{$lang->thread_subscription_method_desc}</span></td>
<td class="trow1"><span class="smalltext">
<label><input type="radio" name="postoptions[subscriptionmethod]" {$subscribe}value="" style="vertical-align: middle;" /> {$lang->no_subscribe}</label><br />
<label><input type="radio" name="postoptions[subscriptionmethod]" {$nonesubscribe}value="none" style="vertical-align: middle;" /> {$lang->no_subscribe_notification}</label><br />
<label><input type="radio" name="postoptions[subscriptionmethod]" {$emailsubscribe}value="email" style="vertical-align: middle;" /> {$lang->instant_email_subscribe}</label><br />
<label><input type="radio" name="postoptions[subscriptionmethod]" {$pmsubscribe}value="pm" style="vertical-align: middle;" /> {$lang->instant_pm_subscribe}</label></span>
</td>
</tr>'),
"sid" => "-1",
);
$db->insert_query("templates", $new_thread);
$db->insert_query("templates", $new_thread_postoptions);
$db->insert_query("templates", $new_thread_modoptions);
$db->insert_query("templates", $new_thread_postpoll);
$db->insert_query("templates", $new_thread_subscriptionmethod);
}
function new_deactivate(){
global $db;
$db->delete_query("templates","title = 'new_thread'");
$db->delete_query("templates","title = 'new_thread_postoptions'");
$db->delete_query("templates","title = 'new_thread_modoptions'");
$db->delete_query("templates","title = 'new_thread_postpoll'");
$db->delete_query("templates","title = 'new_thread_subscriptionmethod'");
}
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;
}
}
?>
forum(root)/new.php:
<?php
/**
* MyBB 1.8
* New Thread
* Create a thread in the forum that you want
* Website: http://www.mybb-es.com
*
* Author(s): Edson Ordaz & Vintagedaddyo
*
* File: new.php
*
* Version: 1.1.2
*
*/
define("IN_MYBB", 1);
define("KILL_GLOBALS", 1);
require_once "./global.php";
$lang->load("newthread", false, true);
$lang->max_options = $lang->sprintf($lang->max_options, $mybb->settings['maxpolloptions']);
add_breadcrumb("{$lang->nav_newthread}", "new.php");
$plugins->run_hooks('new_thread_start');
global $db, $mybb, $lang, $user;
$prefixselect = build_prefix_select($forum['fid'], $mybb->get_input('threadprefix', MyBB::INPUT_INT));
$icon = $post['icon'];
$posticons = get_post_icons();
// If we have a currently logged in user then fetch the change user box.
if($mybb->user['uid'] != 0)
{
$mybb->user['username'] = htmlspecialchars_uni($mybb->user['username']);
eval("\$loginbox = \"".$templates->get("changeuserbox")."\";");
}
// Otherwise we have a guest, determine the "username" and get the login box.
else
{
if(!isset($mybb->input['previewpost']) && $mybb->input['action'] != "do_newthread")
{
$username = '';
}
else
{
$username = htmlspecialchars_uni($mybb->get_input('username'));
}
eval("\$loginbox = \"".$templates->get("loginbox")."\";");
}
$codebuttons = build_mycode_inserter();
$modoptions = $mybb->input['modoptions'];
if($modoptions['closethread'] == 1) {
$closecheck = "checked=\"checked\"";
}
else {
$closecheck = '';
}
if($modoptions['stickthread'] == 1) {
$stickycheck = "checked=\"checked\"";
}
else {
$stickycheck = '';
}
unset($modoptions);
$bgcolor = alt_trow();
if($mybb->usergroup['canmodcp']) {
eval("\$modoptions = \"".$templates->get("new_thread_modoptions")."\";");
}
if($mybb->user['uid']) {
eval("\$postoptions = \"".$templates->get("new_thread_postoptions")."\";");
eval("\$subscriptionmethod = \"".$templates->get("new_thread_subscriptionmethod")."\";");
eval("\$pollbox = \"".$templates->get("new_thread_postpoll")."\";");
eval("\$savedraftbutton = \"".$templates->get("post_savedraftbutton", 1, 0)."\";");
require_once MYBB_ROOT."/inc/cachehandlers/interface.php";
$forumsselected = cache_forums_select();
eval("\$page_new_thread = \"".$templates->get("new_thread", 1, 0)."\";");
output_page($page_new_thread);
}
if($mybb->user['uid'] == 0) {
error_no_permission();
}
?>