mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-20 23:40:38 +01:00
new hooks to customize registration queue with custom data
This commit is contained in:
@@ -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);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user