<?php
function b_legacy_usermenu_show()
{
    $root =& XCube_Root::getSingleton();
    $xoopsUser =& $root->mController->mXoopsUser;

    if (is_object($xoopsUser)) {
        $pm_handler =& xoops_gethandler('privmessage');
        $block = array();
        
        $block['uid'] = $xoopsUser->getVar('uid');
		$block['flagShowInbox']=false;

		// Check does this system have PrivateMessage feature.
		$root=&XCube_Root::getSingleton();
		$service=&$root->mServiceManager->searchXCubeService("PrivateMessage");
		if($service) {
			$client=new XCube_ServiceClient($service);
			$parameters=array("uid"=>$xoopsUser->getVar('uid'));
			$block['new_messages'] = $client->call("getCountUnread",$parameters);
			$block['flagShowInbox']=true;
		}
        return $block;
    }
    return false;
}
?>
