mybb2 icon indicating copy to clipboard operation
mybb2 copied to clipboard

Viewing profiles as Guest

Open Hackmastr opened this issue 9 years ago • 3 comments

An error is thrown:

ErrorException in profile_basic.twig line 6:

 An exception has been thrown during the rendering of a template ("Argument 1 passed to 
MyBB\Core\Database\Repositories\Eloquent\UserProfileFieldRepository::hasForProfileField() must
 be an instance of MyBB\Core\Database\Models\User, null given, called in C:\xampp\htdocs\mybbv2
\app\Presenters\ProfileField.php on line 135 and defined") in "user.profile_basic" at line 6.

If the user logs in, he can view them just fine.

Hackmastr avatar Apr 10 '16 20:04 Hackmastr

Again, looks like a lack of permission checking.

euantorano avatar Apr 10 '16 21:04 euantorano

I think I see what's wrong. We're getting the currently authenticated user (null for guest) from the guard and trying to fetch its profile fields, rather than fetching the profile fields of the relevant user based on URL.

return $this->userProfileFields->hasForProfileField($this->guard->user(), $this->getWrappedObject());

JoshHarmon avatar Jun 16 '16 20:06 JoshHarmon

Yes, the past version of the auth package returned a default User for guests. We need to fix the conditions elsewhere to handle the new default case (null).

On 16 Jun 2016, at 21:12, Josh Harmon [email protected] wrote:

I think I see what's wrong. We're getting the currently authenticated user (null for guest) from the guard and trying to fetch its profile field repository.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

euantorano avatar Jun 16 '16 20:06 euantorano