Search code examples
joomla

Joomla admin add new group with custom default group parent


in Joolma admin

administrator/index.php?option=com_users&view=group&layout=edit

when adding a new group the default Group Parent = Public

any idea how to get another default group selected? (my customer needs it daily and sometimes forget to choose the good Group Parent)

Thank you


Solution

  • It is not advisable to alter core files because when you update Joomla it may change this modified files. But currently I dont find any other alternative method to achieve what you need. If you visit the user group page you will see on the right side the group ID's

    enter image description here

    if you open this file administrator\components\com_users\models\forms\group.xml you will find this code

    <field name="parent_id" type="groupparent"
                description="COM_USERS_GROUP_FIELD_PARENT_DESC"
                label="COM_USERS_GROUP_FIELD_PARENT_LABEL"
                required="true"
            />
    

    There is no default mentioned in this but you can add a default parent id here like this

    <field name="parent_id" type="groupparent"
                description="COM_USERS_GROUP_FIELD_PARENT_DESC"
                label="COM_USERS_GROUP_FIELD_PARENT_LABEL"
                default="5"
                required="true"
            />
    

    This will make Publisher as default parent. There is even one more way to do this but it may need several code changes i.e changing the file administrator\components\com_users\models\fields\groupparent.php. Hope this helps.