[6.0] add cli usergroup id support
Summary of Changes
This PR extends the user:add CLI command to support assigning user groups either by name (as before) or by numeric ID (new).
The --usergroup option now accepts: • a group name (e.g. "Super Users") • a group ID (e.g. 8) • or a comma-separated list of mixed values (e.g. "2,8,Registered")
Each value is internally checked: • If it’s numeric and matches an existing ID → accepted • If it matches an existing group name → accepted • Otherwise → error
This provides a more flexible developer and automation experience, especially when working with provisioning tools.
Example CLI calls (all valid now):
php cli/joomla.php user:add \ --username="cliadmin" \ --password="Sup3rS3cur3_P4ssw0rt!" \ --email="[email protected]" \ --name="CLI User" \ --usergroup="8"
Testing Instructions
php cli/joomla.php user:add --username=test1 --password=abc123 [email protected] --name="Test User" --usergroup="8"
php cli/joomla.php user:add --username=test2 --password=abc123 [email protected] --name="Test User" --usergroup="Super Users"
php cli/joomla.php user:add --username=test3 --password=abc123 [email protected] --name="Test User" --usergroup="2,3"
php cli/joomla.php user:add --username=test4 --password=abc123 [email protected] --name="Test User" --usergroup="Registered,Author,8"
Actual result BEFORE applying this Pull Request
The parameter --usergroup does not work with a user group ID.
Expected result AFTER applying this Pull Request
An ID for a user group is accepted and the user is created.
Link to documentations
Please select:
-
[ ] Documentation link for docs.joomla.org:
-
[x] No documentation changes for docs.joomla.org needed
-
[ ] Pull Request link for manual.joomla.org:
-
[x] No documentation changes for manual.joomla.org needed
@tecpromotion Just a small nudge to get this over the line, then we can get tests arranged.
I have tested this item :white_check_mark: successfully on 9dcc28b35110e053a54847ad7de915cc0f3a7667
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45433.
I'm wondering that ShortcutPlugin.cy.js failed three times when running Drone, in both System Tests; but it is passes local test (single and overall System Tests, HTTP and HTTPS in Docker container). Checking the System Tests log (simple to download) shows PHP Warning was found:
> [Fri May 30 16:46:26.805419 2025] [php:warn] [pid 51:tid 51] [client 127.0.0.1:45938] PHP Warning: Undefined array key "status" in /tests/www/cmysql/administrator/components/com_joomlaupdate/src/Model/UpdateModel.php on line 598, referer: https://localhost/cmysql/administrator/index.php
This code was introduced with PR 45143. @laoneo Checking the logs is working :smile: @SniperSister Could you please take a look at this and give a fix in 5.4 so we can upmerge this in 6.0? @richard67 fyi, we have the same issue in 5.4
Update: Fix is already in work:
The system test failure is unrelated from this PR and will be fixed in https://github.com/joomla/joomla-cms/pull/45547