在PyroCMS中更改新创建的用户的组 [英] Change group of a newly created User in PyroCMS

查看:97
本文介绍了在PyroCMS中更改新创建的用户的组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用PyroCMS 2.2,如何使用注册表将用户分配到我创建的新组之一。在管理面板中,我创建了一个名为 client 的用户组。当我的模块中的注册表单被发送时,它创建客户端,但在核心中设置组的类型为 $ config ['default_group'] ='user';

Using PyroCMS 2.2, how can I have a registration form assign a user to one of the new Groups I created. Within the admin panel, I have a created a user group called client. When my registration form within my module is sent, it creates the client, but sets the type for group to $config['default_group'] = 'user'; within the core module.

这个模块中的特定注册表单是否有方法可以将组设置为客户端?

Is there a way for me to set the group to client for this specific registration form in this module?

推荐答案

我建议这样:


  • 当您将用户重定向到costum注册表单时,请使用您的服装模块名称的值设置会话变量,例如

  • 使用 PyroCMS事件 Events :: trigger('post_user_register',$ id))并构建一个事件。 php 文件,以便在每个用户注册后,此事件将被触发,并且因为您设置了会话变量,您可以决定将新创建的用户组更改为适当的用户组,确保在完成后取消设置会话变量。

  • When you redirect the user to the costum registration form, set a session variable with value of your costume module name for example
  • Use PyroCMS events (Events::trigger('post_user_register', $id)) and build a events.php file for your module so that, after every user registration this event will be triggered and since you have set the session variable, you can decide to change the user group of newly created user to an appropriate one and be sure to unset the session variable after you are done.

希望你能想到。

这篇关于在PyroCMS中更改新创建的用户的组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆