Profile::current() suits better here.
authorRoland Haeder <roland@mxchange.org>
Fri, 27 Mar 2015 22:00:21 +0000 (23:00 +0100)
committerRoland Haeder <roland@mxchange.org>
Fri, 27 Mar 2015 22:00:21 +0000 (23:00 +0100)
Signed-off-by: Roland Haeder <roland@mxchange.org>
classes/Notice.php

index 02b8ce3549f3b79ca4fb6715e6c762a997f87f0e..9f0575228da0f745c37ec6b83b2feabb827463d5 100644 (file)
@@ -2506,16 +2506,12 @@ class Notice extends Managed_DataObject
         // Check default scope (non-private notices)
         $inScope = (!$this->isPrivateScope());
 
-        // Get current user
-        $user = common_current_user();
+        // Get current profile
+        $profile = Profile::current();
 
         // Is the general scope check okay and the user in logged in?
-        /* NOISY-DEBUG: */ common_debug('[' . __METHOD__ . ':' . __LINE__ . ']: inScope=' . intval($inScope) . ',user[]=' . gettype($user));
-        if (($inScope === TRUE) && ($user instanceof User)) {
-            // Get profile from it
-            $profile = $user->getProfile();
-            /* NOISY-DEBUG: */ common_debug('[' . __METHOD__ . ':' . __LINE__ . ']: inScope=' . intval($inScope) . ',profile[]=' . gettype($profile));
-
+        /* NOISY-DEBUG: */ common_debug('[' . __METHOD__ . ':' . __LINE__ . ']: inScope=' . intval($inScope) . ',profile[]=' . gettype($profile));
+        if (($inScope === TRUE) && ($profile instanceof Profile)) {
             /*
              * Check scope, else a privacy leaks happens this way:
              *