I've searched all over for a solution but I've either missed something or this has never been asked
I've read the tut on forcing a thread prefix but it didn't include the proper instructions for applying the forced thread prefix to an existing forum or multiple ones at that.
A descriptive tutorial or plugin would be nice if you can help
(2013-03-20, 10:27 PM)Johnny S Wrote: [ -> ]Require thread prefix plugin - http://mods.mybb.com/view/require-thread-prefixes
Yeah, I reviewed that plugin and it would be a great alternative however... I prefer to have the prefix added automatically on thread creation for the selected forum or forums but thanks for your input
Do you want to force a thread prefix in a forum? Mass editing thread prefixes should be possible via a MySQL query.
Hey Omar,
I want to force a thread prefix in two forums that fall under the same category. If a MySQL query is a solution can you please be as descriptive as you can in telling me how to do this?
* Prosper sips a cup of coffee.
Anyone else have any input?
* Krytic asks Propser to put down the coffee for a moment.
If you knew the tids and the pids (prefix ID's), the MySQL query for a single thread would look like this:
UPDATE `prefix_threads` SET `prefix` = 'pid' WHERE `tid` = 'tidoftopic'
Replacements:
Replace prefix_ with your table prefix
Replace "pid" with the pid of the prefix
Replace "tidoftopic" with the tid of the topic to update.
If you wanted to update many at a time, the query would look like this:
UPDATE `prefix_threads` SET `prefix` = 'pid' WHERE `tid` IN(tidsoftopics)
For example:
UPDATE `mybb_threads` SET `prefix` = '3' WHERE `tid` IN(1,2,3,4,5,6,7,8,9)
* Prosper fixes Seabody a cup of coffee.
Thanks, that could be very useful! "+rep" What about if I want a thread prefix to be defaulted for a newly created thread in which becomes editable when an admin or mod edits the users post?
For new created threads, open MYBB_ROOT/inc/datahandlers/post.php and find:
function verify_prefix()
{
$prefix = &$this->data['prefix'];
// If a valid prefix isn't supplied, don't assign one.
if(!$prefix || $prefix < 1)
{
$prefix = 0;
}
return true;
}
Replace with:
function verify_prefix()
{
$prefix = &$this->data['prefix'];
if($this->method == 'insert')
{
switch((int)$this->data['fid'])
{
case FID1:
$prefix = PID1;
break;
case FID2:
$prefix = PID2;
break;
}
}
// If a valid prefix isn't supplied, don't assign one.
if(!$prefix || $prefix < 1)
{
$prefix = 0;
}
return true;
}
Change FID1 with the
FID of one forum and
PID1 with the prefix ID for that forum. Do the same with
FID2 and
PID2.
Understand the logic on switch and you will be able to add as many as you want to.
I edited the code, double check.