Add user home pages. #3616

v1.18.x
yariplus 10 years ago
parent ceaa3a334d
commit 853aa37cd2

@ -15,6 +15,7 @@
"allowLocalLogin": 1,
"allowAccountDelete": 1,
"allowFileUploads": 0,
"allowUserHomePage": 1,
"maximumFileSize": 2048,
"minimumTitleLength": 3,
"maximumTitleLength": 255,

@ -68,7 +68,20 @@ define('forum/account/settings', ['forum/account/header'], function(header) {
css.attr('href', val);
});
$('[data-property="homePageRoute"]').on('change', toggleCustomRoute);
toggleCustomRoute();
};
function toggleCustomRoute() {
$('[data-property="homePageCustom"]').val('');
if ($('[data-property="homePageRoute"]').val() === 'custom') {
$('#homePageCustom').show();
}else{
$('#homePageCustom').hide();
}
}
return AccountSettings;
});

@ -11,5 +11,4 @@ var accountsController = {
chats: require('./accounts/chats')
};
module.exports = accountsController;

@ -57,6 +57,7 @@ apiController.getConfig = function(req, res, next) {
config.allowProfileImageUploads = parseInt(meta.config.allowProfileImageUploads) === 1;
config.allowTopicsThumbnail = parseInt(meta.config.allowTopicsThumbnail, 10) === 1;
config.allowAccountDelete = parseInt(meta.config.allowAccountDelete, 10) === 1;
config.allowUserHomePage = parseInt(meta.config.allowUserHomePage, 10) === 1;
config.privateUserInfo = parseInt(meta.config.privateUserInfo, 10) === 1;
config.privateTagListing = parseInt(meta.config.privateTagListing, 10) === 1;
config.usePagination = parseInt(meta.config.usePagination, 10) === 1;

@ -33,8 +33,12 @@ var Controllers = {
Controllers.home = function(req, res, next) {
var route = meta.config.homePageRoute || meta.config.homePageCustom || 'categories',
hook = 'action:homepage.get:' + route;
var route = meta.config.homePageRoute || meta.config.homePageCustom || 'categories';
user.getSettings(req.uid, function(err, settings) {
if (!err) route = settings.homePageRoute || route;
var hook = 'action:homepage.get:' + route;
if (plugins.hasListeners(hook)) {
plugins.fireHook(hook, {req: req, res: res, next: next});
@ -49,6 +53,7 @@ Controllers.home = function(req, res, next) {
res.redirect(route);
}
}
});
};
Controllers.reset = function(req, res, next) {

@ -115,7 +115,8 @@ module.exports = function(User) {
sendPostNotifications: data.sendPostNotifications,
restrictChat: data.restrictChat,
topicSearchEnabled: data.topicSearchEnabled,
groupTitle: data.groupTitle
groupTitle: data.groupTitle,
homePageRoute: data.homePageCustom || data.homePageRoute
};
if (data.bootswatchSkin) {

@ -12,11 +12,18 @@
<option value="{routes.route}">{routes.name}</option>
<!-- END routes -->
</select>
<br>
<div id="homePageCustom" style="display: none;">
<br>
<label>Custom Route</label>
<input type="text" class="form-control" data-field="homePageCustom"/>
</div>
<br>
<div class="checkbox">
<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
<input class="mdl-switch__input" type="checkbox" data-field="allowUserHomePage">
<span class="mdl-switch__label"><strong>Allow User Home Pages</strong></span>
</label>
</div>
</div>
</form>
</div>

Loading…
Cancel
Save