diff --git a/app.js b/app.js
index 492faf9609..05ba01c22f 100644
--- a/app.js
+++ b/app.js
@@ -86,6 +86,7 @@
webserver = require('./src/webserver.js'),
SocketIO = require('socket.io').listen(global.server, { log: false, transports: ['websocket', 'xhr-polling', 'jsonp-polling', 'flashsocket']}),
websockets = require('./src/websockets.js'),
+ posts = require('./src/posts.js'),
plugins = require('./src/plugins'); // Don't remove this - plugins initializes itself
websockets.init(SocketIO);
diff --git a/public/src/app.js b/public/src/app.js
index 9681e293f3..9098cce749 100644
--- a/public/src/app.js
+++ b/public/src/app.js
@@ -136,6 +136,7 @@ var socket,
var alert_id = 'alert_button_' + ((params.alert_id) ? params.alert_id : new Date().getTime());
var alert = $('#' + alert_id);
+ var title = params.title || '';
function startTimeout(div, timeout) {
var timeoutId = setTimeout(function () {
@@ -148,7 +149,7 @@ var socket,
}
if (alert.length > 0) {
- alert.find('strong').html(params.title);
+ alert.find('strong').html(title);
alert.find('p').html(params.message);
alert.attr('class', "alert toaster-alert " + "alert-" + params.type);
@@ -161,7 +162,7 @@ var socket,
p = document.createElement('p');
p.innerHTML = params.message;
- strong.innerHTML = params.title;
+ strong.innerHTML = title;
div.className = "alert toaster-alert " + "alert-" + params.type;
diff --git a/public/templates/topic.tpl b/public/templates/topic.tpl
index 1488af1e3a..5db4ea3fd2 100644
--- a/public/templates/topic.tpl
+++ b/public/templates/topic.tpl
@@ -66,6 +66,9 @@
{main_posts.content}
{main_posts.signature}
+
+ {main_posts.additional_profile_info}
+
posted
| last edited by {main_posts.editorname}
@@ -127,6 +130,9 @@
{posts.content}
{posts.signature}
+
+ {posts.additional_profile_info}
+
posted
| last edited by {posts.editorname}
diff --git a/src/posts.js b/src/posts.js
index 411610ee5e..60899e68c6 100644
--- a/src/posts.js
+++ b/src/posts.js
@@ -16,6 +16,7 @@ var RDB = require('./redis.js'),
winston = require('winston');
(function(Posts) {
+ var customUserInfo = {};
Posts.getPostsByTid = function(tid, start, end, callback) {
RDB.lrange('tid:' + tid + ':posts', start, end, function(err, pids) {
@@ -46,17 +47,27 @@ var RDB = require('./redis.js'),
post.picture = userData.picture || require('gravatar').url('', {}, https = nconf.get('https'));
post.signature = signature;
- if (post.editor !== '') {
- user.getUserFields(post.editor, ['username', 'userslug'], function(err, editorData) {
- if (err) return callback();
-
- post.editorname = editorData.username;
- post.editorslug = editorData.userslug;
- callback();
- });
- } else {
- callback();
+ for (var info in customUserInfo) {
+ if (customUserInfo.hasOwnProperty(info)) {
+ post[info] = userData[info] || customUserInfo[info];
+ }
}
+
+ plugins.fireHook('filter:posts.custom_profile_info', {profile: "", uid: post.uid}, function(err, profile_info) {
+ post.additional_profile_info = profile_info.profile;
+
+ if (post.editor !== '') {
+ user.getUserFields(post.editor, ['username', 'userslug'], function(err, editorData) {
+ if (err) return callback();
+
+ post.editorname = editorData.username;
+ post.editorslug = editorData.userslug;
+ callback();
+ });
+ } else {
+ callback();
+ }
+ });
});
});
};