Skip to content

Instantly share code, notes, and snippets.

@barisusakli
Last active August 29, 2015 13:56
Show Gist options
  • Save barisusakli/8994811 to your computer and use it in GitHub Desktop.
Save barisusakli/8994811 to your computer and use it in GitHub Desktop.
Change absolute user image urls to relative
db.getSortedSetRange('users:joindate', 0, -1, function(err, uids) {
function updateUploadedPicture(uid, next) {
User.getUserFields(uid, ['picture', 'uploadedpicture'], function(err, userData) {
var newPicture = userData.uploadedPicture.replace('http://coinunity.sk', '');
if(userData.uploadedPicture === userData.picture) {
User.setUserField(uid, 'picture', newPicture);
}
User.setUserField(uid, 'uploadedPicture', newPicture, next);
});
}
async.each(uids, updateUploadedPicture, next);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment