Skip to content

Node.js based forum software built for the modern web

new hooks to customize registration queue with custom data

barisusaklibecacdefb055
diff --git a/src/controllers/admin/users.js b/src/controllers/admin/users.js
index bbfa71df95..6be5af1e73 100644
--- a/src/controllers/admin/users.js
+++ b/src/controllers/admin/users.js
@@ -6,7 +6,7 @@ var meta = require('../../meta');
var db = require('../../database');
var pagination = require('../../pagination');
var events = require('../../events');
-
+var plugins = require('../../plugins');
var usersController = {};
@@ -87,6 +87,7 @@ usersController.registrationQueue = function(req, res, next) {
var start = (page - 1) * 20;
var stop = start + itemsPerPage - 1;
var invitations;
+
async.parallel({
registrationQueueCount: function(next) {
db.sortedSetCard('registration:queue', next);
@@ -94,6 +95,9 @@ usersController.registrationQueue = function(req, res, next) {
users: function(next) {
user.getRegistrationQueue(start, stop, next);
},
+ customHeaders: function(next) {
+ plugins.fireHook('filter:admin.registrationQueue.customHeaders', {headers: []}, next);
+ },
invites: function(next) {
async.waterfall([
function(next) {
@@ -132,6 +136,7 @@ usersController.registrationQueue = function(req, res, next) {
}
var pageCount = Math.max(1, Math.ceil(data.registrationQueueCount / itemsPerPage));
data.pagination = pagination.create(page, pageCount);
+ data.customHeaders = data.customHeaders.headers;
res.render('admin/manage/registration', data);
});
};
diff --git a/src/user/approval.js b/src/user/approval.js
index 95b2daa68b..25dcf3479a 100644
--- a/src/user/approval.js
+++ b/src/user/approval.js
@@ -11,7 +11,7 @@ var notifications = require('../notifications');
var groups = require('../groups');
var translator = require('../../public/src/modules/translator');
var utils = require('../../public/src/utils');
-
+var plugins = require('../plugins');
module.exports = function(User) {
@@ -31,8 +31,10 @@ module.exports = function(User) {
ip: userData.ip,
hashedPassword: hashedPassword
};
-
- db.setObject('registration:queue:name:' + userData.username, data, next);
+ plugins.fireHook('filter:user.addToApprovalQueue', {data: data, userData: userData}, next);
+ },
+ function(results, next) {
+ db.setObject('registration:queue:name:' + userData.username, results.data, next);
},
function(next) {
db.sortedSetAdd('registration:queue', Date.now(), userData.username, next);
@@ -206,6 +208,12 @@ module.exports = function(User) {
next(err, user);
});
}, next);
+ },
+ function(users, next) {
+ plugins.fireHook('filter:user.getRegistrationQueue', {users: users}, next);
+ },
+ function(results, next) {
+ next(null, results.users);
}
], callback);
};
diff --git a/src/views/admin/manage/registration.tpl b/src/views/admin/manage/registration.tpl
index 5944219794..99c6517c93 100644
--- a/src/views/admin/manage/registration.tpl
+++ b/src/views/admin/manage/registration.tpl
@@ -15,6 +15,9 @@
<th>Email</th>
<th class="hidden-xs">IP</th>
<th class="hidden-xs">Time</th>
+ <!-- BEGIN customHeaders -->
+ <th class="hidden-xs">{customHeaders.label}</th>
+ <!-- END customHeaders -->
<th></th>
</tr>
<!-- BEGIN users -->
@@ -55,6 +58,11 @@
<td class="hidden-xs">
<span class="timeago" title="{users.timestampISO}"></span>
</td>
+
+ <!-- BEGIN users.customRows -->
+ <td class="hidden-xs">{users.customRows.value}</td>
+ <!-- END users.customRows -->
+
<td>
<div class="btn-group pull-right">
<button class="btn btn-success btn-xs" data-action="accept"><i class="fa fa-check"></i></button>