summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/util.php11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/util.php b/lib/util.php
index cb3d7e63c..e137799f2 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -415,14 +415,11 @@ function common_set_user($nickname) {
# who is the current user?
function common_current_user() {
- $user = NULL;
- if (common_have_session()) {
- $id = $_SESSION['userid'];
- if ($id) {
- $user = User::staticGet($id);
- }
+ common_ensure_session();
+ $id = $_SESSION['userid'];
+ if ($id) {
+ $user = User::staticGet($id);
}
-
return $user;
}