MyBB Community Forums

Full Version: Creating 2nd newthread.php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am looking to create another newthread.php. Basically when a user makes a post, i want the thread fields to be different for each one. This would be made possible by editing which template it calls for in the file. I have managed that however, if the user forgets to enter a title, or any required field and clicks submit, it will redirect them back to the original newthread.php and alert them saying they need to fill in the information.

So basically I am wondering what code in newthread2.php needs to be edited so it will redirect back to newthread2.php instead of newthread.php

Also, would it be possible to limit the newthread2.php to a specific forum?

Because you could just go to domain.com/newthread2.php?fid=1 or 2 or 3 or 4 etc and you would be given the same new thread page. However I want to make sure that it works only for fid=3.
I would hook to newthread_start with a plugin. Put this for code in the function that would run.

function function_name()
{
global $db, $mybb, $header, headerinclude, $footer, $theme;
if($mybb->input['fid']==3)
{
require_once MYBB_ROOT . "/newthread2.php";
die();
}
}

In newthread2.php make sure you have this line right after the require_once lines:
if($mybb->input['fid']!=3)
{
header("Location: newthread.php");
exit;
}

As for redirecting on the error, do a search in newthread2.php for redirect($url, $message);
Make sure the value of $url points to what you need.
(2014-08-08, 08:58 PM)dragonexpert Wrote: [ -> ]I would hook to newthread_start with a plugin. Put this for code in the function that would run.

function function_name()
{
global $db, $mybb, $header, headerinclude, $footer, $theme;
if($mybb->input['fid']==3)
{
require_once MYBB_ROOT . "/newthread2.php";
die();
}
}

In newthread2.php make sure you have this line right after the require_once lines:
if($mybb->input['fid']!=3)
{
header("Location: newthread.php");
exit;
}

As for redirecting on the error, do a search in newthread2.php for redirect($url, $message);
Make sure the value of $url points to what you need.

The second bit of code worked for restricting which FID can use newthread2.php but Not sure what you mean with the first bit. And I am also unsure which part needs altered as far as redirect.

EDIT: Found it, was in the template, missed it.