You would have to run a custom script like below. Place it in your nodebb folder, change the group name your special access group and run it with node myscript.js. It will add all users who have 10 posts or more into that group.
'use strict';
const nconf = require('nconf');
nconf.file({
file: 'config.json',
});
nconf.defaults({
base_dir: __dirname,
views_dir: './build/public/templates',
upload_path: 'public/uploads',
});
const db = require('./src/database');
const groupName = '<Replace with your groupname>';
db.init((err) => {
if (err) {
console.log(`NodeBB could not connect to your database. Error: ${err.message}`);
process.exit();
}
addUsersToGroup((err) => {
if (err) {
console.error(err);
process.exit();
}
console.log('done');
process.exit();
});
});
async function addUsersToGroup(callback) {
const user = require('./src/user');
const groups = require('./src/groups');
const batch = require('./src/batch');
// check if target group exists
const exists = await groups.exists(groupName);
if (!exists) {
return callback(new Error('group does not exist'));
}
try {
const now = Date.now();
await batch.processSortedSet('users:joindate', async (uids) => {
const userData = (await user.getUsersData(uids))
.filter(u => u && u.postcount >= 10);
await db.sortedSetAdd(
`group:${groupName}:members`,
userData.map(() => now),
userData.map(u => u.uid)
);
}, {
batch: 500,
});
const memberCount = await db.sortedSetCard(`group:${groupName}:members`);
console.log('total count', memberCount);
await db.setObjectField(`group:${groupName}`, 'memberCount', memberCount);
await db.sortedSetAdd(
'groups:visible:memberCount',
memberCount,
groupName,
);
callback();
} catch (err) {
callback(err);
}
}