Since the $kirby variable isn’t available, you can use the kirby() helper to get the same object. So kirby()->user()->name(). Please notice that it’s not $user in this case but user(). Variables (starting with a $) will only be a starting point of such a chained command. For what you’re doing you need to call the user() method on the kirby object (which you get from the kirby helper).