I always prefer returning early, so I would write this:

```php
if (!drupal_session_started()) {
  return;
}
```

Also, since ``$user`` is a partial object, I think we should

```php
global $user;
return user_load($user->uid);
```