mybb / mybb2

The repository for the MyBB 2 forum software. Not to be used on live boards.
https://www.mybb.com
BSD 3-Clause "New" or "Revised" License
111 stars 45 forks source link

User page #221

Closed chack1172 closed 6 years ago

chack1172 commented 8 years ago

I'm trying to fix some issues of the repositories. I fixed user page but I have 2 alternatives. Which one you are going to use? user_1 user_2

euantorano commented 8 years ago

Hi, what are the URLs of the pages? I thought there was only meant to be one user page, with different content depending on what profile fields are filled out.

On 26 Jun 2016, at 23:07, chack1172 notifications@github.com wrote:

I'm trying to fix some issues of the repositories. I fixed user page but I have 2 alternatives. Which one you are going to use?

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

chack1172 commented 8 years ago

euantorano the url is only one: mysite.com/public/index.php/user/1/Admin

So the correct page is the second image?

euantorano commented 8 years ago

Yes, the second one looks right to me. The two are similar, the only difference is that empty fields are hidden in the second image.

euantorano commented 8 years ago

There are some issues with the styling though. The registration date should all be on one line, same with visit date. Paging @justinsoltesz!

chack1172 commented 8 years ago

Ok, I have another questions. If I go to Admin profile I see the two profile fields because I set them in the database. If I go to another user (e.g. Registered) I see the two fields empty, why they aren't hidden? user_3

euantorano commented 8 years ago

They should be hidden, there's obviously something missing in the query. This method probably needs to exclude NULL profile fields: https://github.com/mybb/mybb2/blob/master/app/Database/Repositories/Eloquent/ProfileFieldRepository.php#L66

I'll have a look tonight after work.

chack1172 commented 8 years ago

euantorano I only changed function hasForProfileField() in app/Database/Repositories/Eloquent/ because $user is not passes/empty/null.


    public function hasForProfileField(User $user=NULL, ProfileField $profileField)
    {
        if($user === NULL)
            return $this->userProfileField->where('profile_field_id', $profileField->id)
                ->count() > 0;
        else
            return $this->userProfileField->where('user_id', $user->getId())
                ->where('profile_field_id', $profileField->id)
                ->count() > 0;
    }
euantorano commented 8 years ago

Yep, that would also do it. $user is null for guests (which will be changed soon).

chack1172 commented 8 years ago

Why is it null for guests? It shouldn't contain user data we are looking at?

euantorano commented 8 years ago

Oops, it shouldn't be null actually. I was thinking $user was the currently logged in user. It should never be null for that method. if it is, there's another problem somewhere.

I'm still at work right now so it's difficult for me to debug until I get home unfortunately.