Skip to content

Node.js based forum software built for the modern web

up'ing templates.js

psychobunny2b5d0e89a5e7
diff --git a/src/meta/themes.js b/src/meta/themes.js
index f41620cc1b..d7511592c0 100644
--- a/src/meta/themes.js
+++ b/src/meta/themes.js
@@ -92,6 +92,9 @@ module.exports = function(Meta) {
themeData['theme:src'] = '';
db.setObject('config', themeData, next);
+
+ // Re-set the themes path (for when NodeBB is reloaded)
+ Meta.themes.setPath(config);
}
], callback);
@@ -104,4 +107,17 @@ module.exports = function(Meta) {
}
};
+ Meta.themes.setPath = function(themeObj) {
+ console.log(themeObj);
+ // Theme's templates path
+ var themePath = nconf.get('base_templates_path'),
+ fallback = path.join(nconf.get('themes_path'), themeObj.id, 'templates');
+ if (themeObj.templates) {
+ themePath = path.join(nconf.get('themes_path'), themeObj.id, themeObj.templates);
+ } else if (fs.existsSync(fallback)) {
+ themePath = fallback;
+ }
+
+ nconf.set('theme_templates_path', themePath);
+ };
};
\ No newline at end of file