获取其他人的用户 ID 用于消息

Get someone else's User ID for Message

我无法从某人的 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));
}

}

更改此行:

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));

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

好的,kunena 开发人员在 github 上为即将发布的版本更新提供了修补程序。这是提交 link https://github.com/Kunena/Kunena-Forum/pull/3547