MyBB Community Forums
Private Message title in dropdown of header_welcomeblock_member? - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: 1.8 Support (https://community.mybb.com/forum-175.html)
+--- Forum: General Support (https://community.mybb.com/forum-176.html)
+--- Thread: Private Message title in dropdown of header_welcomeblock_member? (/thread-182241.html)

Pages: 1 2


RE: Private Message title in dropdown of header_welcomeblock_member? - kylesw555 - 2016-03-11

Is anyone able to help me add the senders avatar to the pm dropdown list?


RE: Private Message title in dropdown of header_welcomeblock_member? - niere8 - 2016-03-13

Sorry, very bad period.


It should works:

[Image: pEqQYlY.png]



in global.php edit in:

$query = $db->query("
        SELECT pm.subject, pm.pmid, pm.status, pm.dateline, fu.username AS fromusername, fu.uid AS fromuid, fu.avatar AS useravatar
        FROM ".TABLE_PREFIX."privatemessages pm
        LEFT JOIN ".TABLE_PREFIX."users fu on (fu.uid=pm.fromid)
        WHERE pm.folder = '1' AND pm.uid = '{$mybb->user['uid']}'
        ORDER BY pm.dateline DESC
        LIMIT 5
    ");
    $private_dropdown_dateline = my_date($mybb->settings['dateformat'], $private_dropdown['dateline']);
        
    while($private_dropdown = $db->fetch_array($query))
    {
	$private_dropdown['avatar'] = $private_dropdown['useravatar'];
        $private_dropdown_link = htmlspecialchars_uni($private_dropdown['pmid']);
        $private_dropdown_status = htmlspecialchars_uni($private_dropdown['status']);
        $private_dropdown_subject = htmlspecialchars_uni($private_dropdown['subject']);
        $private_dropdown_fromuser = htmlspecialchars_uni($private_dropdown['fromusername']);
        $private_dropdown_dateline = my_date($mybb->settings['dateformat'], $private_dropdown['dateline']);
            
    eval("\$private_dropdown_template_template .= \"".$templates->get("private_dropdown_template_template")."\";");
    }
eval("\$private_dropdown_template = \"".$templates->get("private_dropdown_template")."\";"); 


I have added only fu.avatar AS useravatar and $private_dropdown['avatar'] = $private_dropdown['useravatar'];



and in private_dropdown_template_template add:


<img src="{$private_dropdown['avatar']}" alt="" />


where you want add avatar. Obviously you will have to change the style of the avatar (size, position, etc.).


RE: Private Message title in dropdown of header_welcomeblock_member? - kylesw555 - 2016-03-13

Hi

Thank you very much for your help with that, that has worked for me great.

One more thing though, could it be set up so that if the user doesn't have an avatar it uses the default avatar?

Thanks,
Kyle


RE: Private Message title in dropdown of header_welcomeblock_member? - Supryk - 2016-03-13

http://community.mybb.com/thread-164685-post-1127976.html#pid1127976


RE: Private Message title in dropdown of header_welcomeblock_member? - kylesw555 - 2016-03-13

I don't want to use a different method now, I just want the default avatar to display if the member doesn't have an avatar.


RE: Private Message title in dropdown of header_welcomeblock_member? - kylesw555 - 2016-05-12

Anyone able to help with this last thing? Smile


RE: Private Message title in dropdown of header_welcomeblock_member? - kylesw555 - 2016-05-13

Still need help with this Smile


RE: Private Message title in dropdown of header_welcomeblock_member? - kylesw555 - 2016-09-28

Still need help to display the default avatar if no user avatar is present, currently it just displays a blank space.