MyBB Community Forums

Full Version: [F] Moderator Tools / Thread Tool / New Reply Subject [C-Michael83]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I created a moderator tool that is supposed to add new reply to threads.

Under 'Add new reply' I put:
- "some text" for the new reply
- "some {subject}" for the subject of the new reply

Now when you select a bunch of threads and apply this 'new reply' tool to those threads, the new reply will be added to all threads like it's supposed to be, but the subject of the new reply will be "some subject of the first thread", i.e. {subject} is not replaced with the subject of the current thread, but of one of the selected threads. The variable doesn't seem to be reset properly for each thread.
Considering this is a custom tool, I'm not sure if it's a bug in MyBB. Did you check all the settings or whatever for that tool?
(2009-01-04, 09:09 AM)TomL Wrote: [ -> ]Considering this is a custom tool, I'm not sure if it's a bug in MyBB. Did you check all the settings or whatever for that tool?
No, this would be a bug.
Alright, I wasn't sure - my bad:p I just wasn't sure if you make a custom tool if it is still a bug. Thanks for telling me though, I learned something today:p
It's a custom moderator tool, but an official MyBB feature (moderator tools option in MyBB Admin CP, Add new thread tool function). I.e. no third party / plugin / mod / hack code involved, all pure MyBB Smile
From the looks of it, it sounds like it's just setting it once(or not resetting it). I PMed you a question I have.
Bit out of time here, so haven't checked, but this probably fixes it.

In inc/class_custommoderation.php, find:
					if(empty($thread_options['replysubject']))
					{
						$thread_options['replysubject'] = 'RE: '.$thread['subject'];
					}
					else
					{
						$thread_options['replysubject'] = str_ireplace('{username}', $mybb->user['username'], $thread_options['replysubject']);
						$thread_options['replysubject'] = str_ireplace('{subject}', $thread['subject'], $thread_options['replysubject']);
					}
	
					// Set the post data that came from the input to the $post array.
					$post = array(
						"tid" => $thread['tid'],
						"replyto" => $thread['firstpost'],
						"fid" => $thread['fid'],
						"subject" => $thread_options['replysubject'],
replace with:
					if(empty($thread_options['replysubject']))
					{
						$new_subject = 'RE: '.$thread['subject'];
					}
					else
					{
						$new_subject = str_ireplace('{username}', $mybb->user['username'], $thread_options['replysubject']);
						$new_subject = str_ireplace('{subject}', $thread['subject'], $new_subject);
					}
	
					// Set the post data that came from the input to the $post array.
					$post = array(
						"tid" => $thread['tid'],
						"replyto" => $thread['firstpost'],
						"fid" => $thread['fid'],
						"subject" => $new_subject,
It's weird. I got the tool to work the first time I created it, without having to make a change or apply the "fix" Yumi applied. But yet on the OpensourceCMS MyBB demo I couldn't get it to work. It works fine on my localhost forums.
^ Try creating a Thread mod tool which gives a reply, with a subject of "blah {subject}".
Then create two threads, one with the subject "A Thread", second with subject "B Thread", and apply mod tool to both. Both replies should have a subject of "blah A Thread" or "blah B Thread" I assume that's what frostschutz is talking about.
I think I might just send him a screenshot of my settings for the tool(which works fine) and have him apply it like that. I created 15 threads(thread X), and applied the tool and they all replied perfectly fine.
Pages: 1 2