Page 1 of 1

Avatar in User Menu changes when looking at other profiles

Posted: 28. February 2009 23:35
by luminosity
Your Portal Version:
Your phpBB Type: Standard phpBB3
MODs installed: No
Your knowledge: Basic Knowledge

What have you done before the problem was there?


What have you already tryed to solve the problem?


Description and Message
I have noticed something strange about the User Menu. When a user clicks on another user and sees their profile, the Avatar, username and user's rank in the User Menu changes to reflect the person you are looking at, not your own. Then when you navigate away from that user's profile, the User Menu returns to normal; displaying your avatar and username. I think that is confusing for the user. The User Menu should always show the user's info. How can I correct this?

Re: Avatar in User Menu changes when looking at other profiles

Posted: 1. March 2009 02:01
by Kevin
Erm, are you using the mod portalview?
Otherwise i can't imagine how it would be possible to see a user profile at the same time with the portal user menu. :?

Re: Avatar in User Menu changes when looking at other profiles

Posted: 1. March 2009 02:35
by luminosity
Yes, I am using the mod portalview. Sorry for not mentioning it before.

Re: Avatar in User Menu changes when looking at other profiles

Posted: 1. March 2009 12:58
by Kevin
Moved to the proper forum.
Funny bug. It comes from double assigned template vars. User menu / memberlist. The user menu gets now the template vars from the memberlist.php, as they have been processed last (with the data from the user you are watching the profile).
So we need to name them different in the user_menu.php and user_menu.html

Open user_menu.php
search:

Code: Select all

'AVATAR_IMG'    => $avatar_img,
    
    'RANK_TITLE'    => $rank_title,
    'RANK_IMG'        => $rank_img,
    'RANK_IMG_SRC'    => $rank_img_src,

    'USERNAME_FULL'        => get_username_string('full', $user_id, $username, $colour),
    'USERNAME'            => get_username_string('username', $user_id, $username, $colour),
    'USER_COLOR'        => get_username_string('colour', $user_id, $username, $colour),
    'U_VIEW_PROFILE'    => get_username_string('profile', $user_id, $username, $colour), 
replace with:

Code: Select all

'AVATAR_IMG_P'    => $avatar_img,
    
    'RANK_TITLE_P'    => $rank_title,
    'RANK_IMG_P'        => $rank_img,
    'RANK_IMG_SRC_P'    => $rank_img_src,

    'USERNAME_FULL_P'        => get_username_string('full', $user_id, $username, $colour),
    'USERNAME_P'            => get_username_string('username', $user_id, $username, $colour),
    'USER_COLOR_P'        => get_username_string('colour', $user_id, $username, $colour),
    'U_PROFILE_P'    => get_username_string('profile', $user_id, $username, $colour), 
As you see i have just added _P to the names. Now go and do the same for these 8 template vars in the user_menu.html.
e.g the subsilver user_menu would look like this:

Code: Select all

<!--version $Id: user_menu.html 344 2008-08-24 20:50:39Z kevin74 $ //-->
<table class="tablebg" cellspacing="1" width="100%">
    <tr>
        <th><span style="float: left"><img src="{T_THEME_PATH}/images/portal/portal_user.png" width="16px" height="16px" alt="" />&nbsp;{L_USER_MENU}</span></th>
    </tr>
    <tr class="row1">
        <td>
            <div align="center">
                <a href="{U_VIEW_PROFILE_P}"><!-- IF USER_COLOR --><span style="color: {USER_COLOR_P}; font-weight: bold;"><!-- ELSE --><span><!-- ENDIF -->{USERNAME_P}</span></a><br />
                <a href="{U_PROFILE_P}"><!-- IF AVATAR_IMG -->{AVATAR_IMG_P}<!-- ELSE --><img src="{T_THEME_PATH}/images/no_avatar.gif" alt="" /><!-- ENDIF --></a>
                <!-- IF RANK_TITLE --><br /><span class="gensmall">{RANK_TITLE_P}</span><!-- ENDIF -->
                <!-- IF RANK_IMG --><br />{RANK_IMG_P}<!-- ENDIF -->
            </div><hr />
        <!-- IF S_DISPLAY_SEARCH -->
            <a href="{U_NEW_POSTS}">{L_NEW_POSTS}</a><br />
            <a href="{U_SELF_POSTS}">{L_SELF_POSTS}</a><br />
        <!-- ENDIF -->
        <!-- IF U_UM_BOOKMARKS -->
            <a href="{U_UM_BOOKMARKS}">{L_UM_BOOKMARKS}</a><br />
        <!-- ENDIF -->
            <a href="{U_UM_MAIN_SUBSCRIBED}">{L_UM_MAIN_SUBSCRIBED}</a><br />
        <!-- IF S_DISPLAY_PM -->
            <a href="{U_PRIVATEMSGS}">{PRIVATE_MESSAGE_INFO}</a>
        <!-- ENDIF -->
            <hr />
            <a href="{U_LOGIN_LOGOUT}">{L_LOGIN_LOGOUT}</a>
        </td>
    </tr>
</table>
<br /> 
That will fix it.

Re: Avatar in User Menu changes when looking at other profiles

Posted: 1. March 2009 23:42
by luminosity
Thanks! That worked beautifully !!