How to create custom User Group programmatically in Joomla 3.x?

亡梦爱人 提交于 2019-12-04 20:56:32

You can add it to the #__usergroups table programmatically, ensuring the user group is not there already; or get an instance of JTableUsergroup (declared in libraries/joomla/table/usergroup.php). Since it extends JTable you can use its save() method, passing an array with the values you wish to store.

Then in order to have proper lft and rgt values, you need to invoke the rebuild() method on JTableUsergroup.

Please ensure adding it programmatically is really necessary, it may cause issues on sites that already make heavy use of usergroups.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!