Sorry about that.
My code editor completes parentheses automatically, so I often forget the closing one when entering code freehand.
I would not expose the user ID or username in the alias, but you certainly can if you're not that worried about security. A compromise would be this:
$alias = $resource->cleanAlias($pagetitle) . base64_encode($userId);
To store the user ID in the page, you could use a TV, but it would be much faster and easier if you're not using one of these resource fields: description, introtext, longtitle, or menutitle, to just put it in that unused field.
Remember that if you want to get a user's profile with the user ID, you have to retrieve it through the 'internalKey' field of the profile:
$profile = $modx->getObject('modUserProfile', array('internalKey' => $userID));
If it's for the current user, you can do this:
$profile = $modx->user->getOne('Profile');
If you have the user object, you can do this:
$profile = $user->getOne('Profile');
If the user has just been created, sometimes getOne() will put an annoying error in the Error Log. In that case, just use the internalKey version.