1

我无法从某人的 Kunena 个人资料中获取用户 ID 来打开已插入收件人姓名的新私人消息。我得到的最接近的是以下代码,它插入了我自己的用户名......

defined('_JEXEC') or die ();

class KunenaPrivateUddeIM extends KunenaPrivate
{
protected $uddeim = null;
protected $params = null;

/**
 * @param $params
 */
public function __construct($params)
{
    $this->params = $params;

    if (!class_exists('uddeIMAPI'))
    {
        return;
    }

    $this->uddeim = new uddeIMAPI();

    if ($this->uddeim->version() < 1)
    {
        return;
    }
}

/**
 * @param $userid
 *
 * @return string
 */
protected function getURL($userid)
{
    static $itemid = false;

    if ($itemid === false)
    {
        $itemid = 0;

        if (method_exists($this->uddeim, 'getItemid'))
        {
            $itemid = $this->uddeim->getItemid();
        }

        if ($itemid)
        {
            $itemid = '&Itemid=' . (int) $itemid;
        }
        else
        {
            $itemid = '';
        }
    }

    return JRoute::_('index.php?option=com_uddeim&task=new&recip=' . (int) $userid . $itemid);
}

/**
 * @param $userid
 *
 * @return mixed
 */
public function getUnreadCount($userid)
{
    return $this->uddeim->getInboxUnreadMessages($userid);
}

/**
 * @param $text
 *
 * @return string
 */
public function getInboxLink($text)
{
    if (!$text)
    {
        $text = JText::_('COM_KUNENA_PMS_INBOX');
    }

    return '<a href="' . JRoute::_($this->uddeim->getLinkToBox('inbox', false)) . '" rel="follow">' . $text . '</a>';
}

/**
 * @return string
 */
public function getInboxURL()
{
$user = JFactory::getUser($userid);
return JRoute::_('index.php?option=com_uddeim&task=new&recip=' . ($user ->id));
}

}

4

2 回答 2

0

更改此行:

return JRoute::_('index.php?option=com_uddeim&task=new&recip=' . (JFactory::getUser()->id));

到以下 2 行:

$user = JFactory::getUser($userid);
return JRoute::_('index.php?option=com_uddeim&task=new&recip=' . ($user ->id));

你可以查看我们前段时间写的这篇文章(它是为 Joomla 2.5 编写的,但它仍然有效,除了你必须删除 &)关于如何在 Joomla 中检索非缓存用户:http://www .itoctopus.com/how-to-retrieve-the-non-cached-user-information-from-joomla

于 2015-11-16T15:59:54.737 回答
0

Ok kunena 开发人员在 github 上有一个修补程序,用于即将发布的更新。这是提交链接https://github.com/Kunena/Kunena-Forum/pull/3547

于 2015-11-24T19:26:54.290 回答