Chapter 6. Working with Users, Page 123
case 'insert':
// Record information for future lawsuit.
watchdog('user', t('User %user agreed to legal terms',
array('%user' => $user->name)));
break;
case 'insert':
// Record information for future lawsuit.
$name = $edit['name'];
watchdog('user', t('User %user agreed to legal terms',
array('%user' => $name)));
break;
when operation insert happen, the user object is still loaded as anonymous, so $user->name get any information.
To get the new user's name you have to use the $edit variable who content the value submit by the new user in a array. So to get the name you have to use $edit['name'].
