therealsujitk/flarum-ext-gifs

Use default values when settings aren't in the database

Closed this issue · 0 comments

Flarum only saves settings in the database that have been changed, hence the default values aren't saved in the database. When settings aren't saved in the database, a default value needs to be used in the oninit() function. For example

this.engine = app.forum.attribute(`${prefix}.engine`);

needs to be changed to

this.engine = app.forum.attribute(`${prefix}.engine`) || 'giphy';

Temporary Fix

Simply change the setting in the admin panel to a different value and save it so that Flarum understands a change has been made and needs to be updated. You can change it back to it's previous value and save it again.