Merge pull request #2270 from stevelacy/master

Add user.updateProfile - hook user profile updates
v1.18.x
Barış Soner Uşaklı 10 years ago
commit 591a8b6b12

@ -9,11 +9,19 @@ var async = require('async'),
meta = require('../meta'), meta = require('../meta'),
events = require('../events'), events = require('../events'),
db = require('../database'), db = require('../database'),
Password = require('../password'); Password = require('../password'),
plugins = require('./../plugins');
module.exports = function(User) { module.exports = function(User) {
User.updateProfile = function(uid, data, callback) { User.updateProfile = function(uid, data, callback) {
plugins.fireHook('filter:user.updateProfile', {uid: uid, settings: data}, function(err, data) {
if(err) {
return callback(err);
}
data = data.settings;
var fields = ['username', 'email', 'fullname', 'website', 'location', 'birthday', 'signature']; var fields = ['username', 'email', 'fullname', 'website', 'location', 'birthday', 'signature'];
function isSignatureValid(next) { function isSignatureValid(next) {
@ -115,6 +123,7 @@ module.exports = function(User) {
User.setUserField(uid, field, data[field], next); User.setUserField(uid, field, data[field], next);
} }
});
}; };
function updateEmail(uid, newEmail, callback) { function updateEmail(uid, newEmail, callback) {

Loading…
Cancel
Save