Skip to content

Node.js based forum software built for the modern web

add profile cover/position + profile picture on every account page

psychobunnya5b754eac312
diff --git a/src/controllers/accounts/helpers.js b/src/controllers/accounts/helpers.js
index 9a881ddab5..63a25a992a 100644
--- a/src/controllers/accounts/helpers.js
+++ b/src/controllers/accounts/helpers.js
@@ -3,6 +3,7 @@
var async = require('async'),
validator = require('validator'),
+ nconf = require('nconf'),
user = require('../../user'),
groups = require('../../groups'),
@@ -118,7 +119,7 @@ helpers.getBaseUser = function(userslug, callerUID, callback) {
async.parallel({
user: function(next) {
- user.getUserFields(uid, ['uid', 'username', 'userslug'], next);
+ user.getUserFields(uid, ['uid', 'username', 'userslug', 'picture', 'cover:url', 'cover:position'], next);
},
isAdmin: function(next) {
user.isAdministrator(callerUID, next);
@@ -138,6 +139,10 @@ helpers.getBaseUser = function(userslug, callerUID, callback) {
results.user.isSelf = parseInt(callerUID, 10) === parseInt(results.user.uid, 10);
results.user.showHidden = results.user.isSelf || results.isAdmin;
results.user.profile_links = results.profile_links;
+
+ results['cover:url'] = results['cover:url'] || nconf.get('relative_path') + '/images/cover-default.png';
+ results['cover:position'] = results['cover:position'] || '50% 50%';
+
next(null, results.user);
}
], callback);
diff --git a/src/controllers/accounts/profile.js b/src/controllers/accounts/profile.js
index 5d06a62b3e..e55ee0d157 100644
--- a/src/controllers/accounts/profile.js
+++ b/src/controllers/accounts/profile.js
@@ -76,9 +76,6 @@ profileController.get = function(req, res, callback) {
userData.profileviews = 1;
}
- userData['cover:url'] = userData['cover:url'] || nconf.get('relative_path') + '/images/cover-default.png';
- userData['cover:position'] = userData['cover:position'] || '50% 50%';
-
plugins.fireHook('filter:user.account', {userData: userData, uid: req.uid}, next);
}
], function(err, results) {