[英]Joomla: get the user group from the page access level using PHP
In Joomla 2.5.16: 在Joomla 2.5.16中:
My goal is to find the "right" user group for this page. 我的目标是为此页面找到“正确的”用户组。 Since the user belongs to 2 user groups and one of them (16) is contained in the array of groups allowed to see this page, how can I query the database to find that group?
由于该用户属于2个用户组,并且其中一个(16)包含在允许查看此页面的组数组中,我如何查询数据库以找到该组?
I tried: 我试过了:
$usr_id=100;
$access=6;
$query(SELECT rules from 'viewlevels' WHERE ???);
Table viewlevels has a structure like: 表视图级别具有以下结构:
ID | rules
6 |[8,16,17]
Table user_usergroup_map has a structure like: 表user_usergroup_map具有以下结构:
User_id |Group_id
100 |14
100 |16
Any help, please? 有什么帮助吗?
SELECT * FROM `#__viewlevels` AS `a`
INNER JOIN `#__usergroups` AS `b`
ON `a`.`rules` LIKE CONCAT('%',b.id,'%')
INNER JOIN `#__user_usergroup_map` AS `m`
ON m.group_id=b.id
WHERE m.user_id = 100
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.