I hacked myself a fix by inserting a row in the usermeta table to give myself an appropriate user level.
By the way there’s another unrelated bug in the code: you use
$site_path = trailingslashit(get_settings('home'));
This is usually fine and dandy for most people, but those who keep their index.php in a separate directory from their WordPress files will find that the admin links point to the wrong place, and the CSS file doesn’t load.
Both instances of that line should be changed to:
$site_path = trailingslashit(get_settings('siteurl'));
This will yield the correct path to the WordPress folder.