MyBB Community Forums

Full Version: Add hooks where post counters are updated.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm coding a plugin that needs to recount posts, but apparently not all places where counting occurs have hooks. The following code should add one hook. File /admin/modules/user/users.php.
while($user = $db->fetch_array($query))
{
	// Protect Super Admins
	if(is_super_admin($user['uid']) && !is_super_admin($mybb->user['uid']))
	{
		continue;
	}

	$return_array = delete_user_posts($user['uid'], $date); // Delete user posts, and grab a list of threads to delete
	if($return_array && is_array($return_array))
	{
		$prune_array = array_merge_recursive($prune_array, $return_array);
	}
}
Why does update_user_counters() lacks a hook? I think it would be helpful.
I'm not opposed to adding hooks, please open a PR with suggested hooks where they'd be helpful Smile