在 Joomla 1.5 中向特定用户显示特定内容

发布于 2024-10-13 18:13:48 字数 226 浏览 7 评论 0原文

简而言之,这是一个调查实验室的网站。 我需要向特定用户显示特定内容(实验室报告)。用户在离开时将获得用户名和密码,并被要求登录网站以使用提供给他的凭据访问他/她的报告。

所以,这是“特定用户”的“特定内容” - 迁移到 1.6 不是一个选择。

我心中有一个解决方案,但涉及大量核心黑客攻击,并且需要一些时间......如果有人遇到类似情况或有想法,我将不胜感激您的帮助。

To be short, It's a website for an investigations lab.
I need to display specific content (lab report) to specific user. Users will be given a username and a password when leaving and will be asked to login on the website to access his/her report with the credentials given to him.

So , it's a "specific content" for "specific user" - Moving to 1.6 is not an option.

I have a solution in mind but involve a lot of core hacking and will take some time ... If any one been in a similar situation or have an idea in mind I would appreciate your help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

金兰素衣 2024-10-20 18:13:48

好的,这是可以做到的,但是需要一些技巧才能实现。首先,您需要一种方法来发布实验室报告并将其与用户关联。我会为此使用 K2,因为您可以将报告作为附件添加到项目中。您还可以向 K2 添加额外的字段,这是下一步。您需要一个额外的字段,您可以在其中输入用户 ID 号,您将使用该 ID 号来确定是否允许用户查看内容。

您现在需要执行几个步骤来过滤内容,以便只有关联的用户才能看到它。

  1. 用户登录后,您需要获取用户 ID:

    $用户=& JFactory::getUser();

    $usr_id = $user->get('id');

  2. 您需要一个链接到所有实验室报告所在的 K2 类别的菜单项。

  3. 您需要一个带有修改后的category_item.php 的子模板,该类别仅显示关联报告:

    if($this->item->extra_fields[USER_ID_EXTRA_FIELD_NAME]==$usr_id){

    所有类别项目内容

    }

  4. 您需要一个带有修改后的 item.php 的子模板,该类别再次阻止除关联用户之外的用户,基本上与 #3 相同的代码来显示内容或错误

我能想到的实现此目的的唯一其他方法是使用 ACL 组件以及每个用户的组。

带有子模板的 K2 方法不需要任何核心修改,只需做一些工作即可。

Ok, this can be done but it's going to take a little trickery to get there. First, you are going to need a way to post the lab reports and associate them with a user. I would use K2 for this since you can add the report as an attachment to an item. You can also add extra fields to K2, which would be the next step. You'll need an extra field where you can enter a user ID number that you will use to determine if a user is allowed to view the content.

There are several steps you will need to take to now filter the content so only the associated user can see it.

  1. You will need to get the user ID once the user is logged in:

    $user =& JFactory::getUser();

    $usr_id = $user->get('id');

  2. You'll need a menu item that links to a K2 Category where all the lab reports go.

  3. You'll need a subtemplate with a modified category_item.php for that category that only displays the associate reports:

    if($this->item->extra_fields[USER_ID_EXTRA_FIELD_NAME]==$usr_id){

    all the category item stuff

    }

  4. You'll need a subtemplate with a modified item.php for the category that again blocks users other than the associated user, basically the same code as #3 to either display the content or an error message.

The only other way I can think of that you can accomplish this would be to use an ACL component with a group for each user.

The K2 method with subtemplates would not require any core hacks and will work with a little work.

给妤﹃绝世温柔 2024-10-20 18:13:48

您可以通过 Flexicontent http://www.flexicontent.org/ 实现您想要的目标,并且 Flexiaccess

Flexicontent 是 K2类型组件,我可以互换使用它们。使用 Flexiaccess,您可以创建仅对某些用户可用的项目。

无需黑客攻击。

You can achieve what you want with Flexicontent http://www.flexicontent.org/ and Flexiaccess

Flexicontent is a K2 type component and I use them interchangeably. With Flexiaccess you can create items that are only available to certain users.

No hacks required.

蒲公英的约定 2024-10-20 18:13:48

坏消息:标准 Joomla 1.5 无法做到这一点(无需黑客攻击)
好消息:您可以使用 Joomla 的免费或商业扩展之一来实现这一目标。我建议例如:

管理员-用户-访问
http://extensions.joomla.org /extensions/access-a-security/backend-a-full-access-control/9040

或者您可以自己搜索:
http://extensions.joomla.org/extensions /access-a-security/backend-a-full-access-control

Bad News: That cant be done with standard Joomla 1.5 (without hacking)
Good News: You can use one of the free or commercial Extensions for Joomla to accomplish that. I would suggest for example:

Admin-User-Access
http://extensions.joomla.org/extensions/access-a-security/backend-a-full-access-control/9040

Or you can search for yourself:
http://extensions.joomla.org/extensions/access-a-security/backend-a-full-access-control

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文