I don't think there's a single function that makes it quite that easy (well, there could be but I don't know of one). But you could look in inlinemod.php around line 1225, the section that starts like this:
switch ($vbulletin->GPC['useraction'])
{
case 'ban':
It uses a user data manager to set the user's usergroup to the banned group, and also writes a record to the userban table.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.