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

v1.18.x
psychobunny 9 years ago
parent f611e8bc45
commit a5b754eac3

@ -3,6 +3,7 @@
var async = require('async'), var async = require('async'),
validator = require('validator'), validator = require('validator'),
nconf = require('nconf'),
user = require('../../user'), user = require('../../user'),
groups = require('../../groups'), groups = require('../../groups'),
@ -118,7 +119,7 @@ helpers.getBaseUser = function(userslug, callerUID, callback) {
async.parallel({ async.parallel({
user: function(next) { 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) { isAdmin: function(next) {
user.isAdministrator(callerUID, 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.isSelf = parseInt(callerUID, 10) === parseInt(results.user.uid, 10);
results.user.showHidden = results.user.isSelf || results.isAdmin; results.user.showHidden = results.user.isSelf || results.isAdmin;
results.user.profile_links = results.profile_links; 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); next(null, results.user);
} }
], callback); ], callback);

@ -76,9 +76,6 @@ profileController.get = function(req, res, callback) {
userData.profileviews = 1; 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); plugins.fireHook('filter:user.account', {userData: userData, uid: req.uid}, next);
} }
], function(err, results) { ], function(err, results) {

Loading…
Cancel
Save