简体   繁体   English

[Joomla 3+]如何向分配给它的用户显示K2类别

[英][Joomla 3+]How to show K2 Category, to a user assigned to it

I have this problem or situation that I want to show K2 category/categories only to a user who is assigned to the specific category, if a user is logged in. Right now it will display all the categories even if the user is logged in or not, and can add items/articles to a specific category assigned to it if he/she's logged in which works as expected. 我有这个问题或情况,我想仅向分配给特定类别的用户显示K2类别(如果已登录)。现在,即使该用户已登录,它也将显示所有类别。不能,并且可以在他/她登录后按预期工作的方式将项目/物品添加到分配给它的特定类别中。 Does anyone here knows how to solve it? 这里有人知道如何解决吗? Or any suggestions how can I make it work? 或有任何建议如何使它起作用? Any help will be much appreciated. 任何帮助都感激不尽。 Joomla 3.3.6 K2 v2.6.7 Joomla 3.3.6 K2 v2.6.7

If you can code then create a plugin in which 如果可以编码,则创建一个插件,其中

  1. maintain mapping of k2 usergroup with allowed k2 categories 维护k2用户组与允许的k2类别的映射

  2. catch onAfterRoute trigger and add your code to check the k2 usergroup of user and its allowed k2 category. 捕获onAfterRoute触发器并添加代码以检查用户的k2用户组及其允许的k2类别。

     function onAfterRoute() { $user = JFactory::getUser(); $groups = $user->groups; $jinput = JFactory::getApplication()->input; $option = $jinput->get('option', ''); $view = $jinput->get('view', ''); $task = $jinput->get('task', ''); // place k2-USER-GROUP related checking here } 

I am not sure about the view, task and other variables which k2 adds in the url while displaying category in front-end so you need to check this first. 我不确定在前端显示类别时k2在URL中添加的视图,任务和其他变量,因此您需要首先进行检查。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM