mybb how to set default prefix for some forums adding a trigger to mybb_threads table

282 views Asked by At

what i need is to add a default prefix to all new thread in one forum.

i tried to create a trigger in php admin

this is the code:

CREATE TRIGGER set_thread_prefix BEFORE INSERT ON mybb_threads
FOR EACH ROW SET NEW.prefix=46

1142 - TRIGGER command denied to user 'xxx'@'localhost' for table 'mybb_threads'

the forum is hosted in altervista.

1

There are 1 answers

0
Abhik Chakraborty On BEST ANSWER

Ok the trigger should look like below. You had else if but in mysql its elseif no space in between

delimiter //
create trigger set_thread_prefix before insert on mybb_threads
for each row
begin
 if new.fid = 46 then
   set new.prefix = 2;
 elseif new.fid = 49 then
   set new.prefix = 3;
 elseif new.fid = 54 then
  set new.prefix = 4;
 end if;
end ;//

delimiter ;