2008-08-24, 11:05 AM
MyBB version 1.4.1
Steps to reproduce:
1. Default style is "Style A".
2. I set "Style B" for one forum and checked "override" flag.
3. Go to adding new thread on this forum. I see "Style B" - OK.
4. Fill in subject and leave message empty, submit the form.
5. You will go back to new thread page (message cannot be empty), I see "Style A" now - not OK.
6. It's because there is a field "tid" with empty value in the form on new thread page and the condition
The following plugin also helps:
Steps to reproduce:
1. Default style is "Style A".
2. I set "Style B" for one forum and checked "override" flag.
3. Go to adding new thread on this forum. I see "Style B" - OK.
4. Fill in subject and leave message empty, submit the form.
5. You will go back to new thread page (message cannot be empty), I see "Style A" now - not OK.
6. It's because there is a field "tid" with empty value in the form on new thread page and the condition
if(isset($mybb->input['tid']))
in line #138 in file 'global.php' is true however $mybb->input['tid'] is empty. It should be if(isset($mybb->input['tid']) && $mybb->input['tid'] > 0)
or if(!empty($mybb->input['tid']))
or sth like this.The following plugin also helps:
function wc_remove_empty_tid() {
global $mybb;
if (isset($mybb->input['tid']) && empty($mybb->input['tid'])) {
unset($mybb->input['tid']);
}
}
$plugins->add_hook("global_start", "wc_remove_empty_tid");