Skip to content

[5.4] Allow PATCH /api/users/{super-user-id}#46768

Merged
muhme merged 2 commits intojoomla:5.4-devfrom
OctavianC:patch-9
Feb 3, 2026
Merged

[5.4] Allow PATCH /api/users/{super-user-id}#46768
muhme merged 2 commits intojoomla:5.4-devfrom
OctavianC:patch-9

Conversation

@OctavianC
Copy link
Contributor

Pull Request for Issue #46766 .

Summary of Changes

The System - Action Logs plugin loads a form in the onContentPrepareForm event if the following conditions match:

  • The context is com_users.profile or com_users.user - so whenever a com_users form is loaded
  • The user ID is that of a Super User (core.admin permission)
  • The Action Log - Joomla Plugin must be enabled
    This form prevents saving a Super User through an API PATCH request because it contains this field:
<field
	name="actionlogsNotify"
	type="radio"
	label="PLG_SYSTEM_ACTIONLOGS_NOTIFICATIONS"
	layout="joomla.form.field.radio.switcher"
	default="0"
	filter="integer"
	required="true"
	>
	<option value="0">JNO</option>
	<option value="1">JYES</option>
</field>

This field is required and fails validation since it's missing from the request. In my opinion the best way to handle this is to remove the required attribute as it also creates the illusion that the field must be turned on due to the required asterisk next to it (think of agreement mandatory fields).
image

Testing Instructions

  • Look for your own (or another Super User) ID
image
  • Create a PATCH request to that ID eg. https://[joomla-url]/api/index.php/v1/users/581 with a simple payload:
{
    "block": 1
}

If the above results in an error message such as:
Save failed with the following error: You can't save a user account without selecting at least one user group.
Either apply the PR #46750, download the latest nightly since that PR is already merged or adjust your payload to include some groups to speed things up and bypass the error:

{
    "block": 1,
    "groups": [8]
}
  • Make sure that the field can be turned on from the administrator client:
image - And turned off as well: image

Actual result BEFORE applying this Pull Request

{"errors":[{"title":"Field required: Email Notifications"}]}

Expected result AFTER applying this Pull Request

{"errors":[{"title":"Save failed with the following error: You can't block yourself.","code":400}]}

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@exlemor
Copy link

exlemor commented Jan 29, 2026

I have tested this item ✅ successfully on bcbbc19

I have tested this successfully! Thanks @OctavianC! :)

I got the message: "title": "Save failed with the following error: You can't block yourself.", "code": 400 for my SU user and it worked/blocked for another SU user.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46768.

@Megharaj170804
Copy link

I have tested this item ✅ successfully on bcbbc19

I inspected the file plugins/system/actionlogs/forms/actionlogs.xml and confirmed that the required="true" attribute has been removed from the actionlogsNotify field


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46768.

@brianteeman
Copy link
Contributor

@Megharaj170804 it is NOT enough to just check the code has changed - you must check that the code change does what it says it will do as written in the test instructions. That INCLUDES using the api to Create a PATCH request

I have removed your test at this time until you have done that

@Megharaj170804
Copy link

Megharaj170804 commented Jan 30, 2026 via email

@richard67
Copy link
Member

@Megharaj170804 To correctly submit a test result it needs to go to the PR in the issue tracker here https://issues.joomla.org/tracker/joomla-cms/46768 and use the blue "Test this" button to submit a test result, otherwise it is not properly counted. I will set the result for you now, but please remember next time when testing PRs. Thanks in advance, and thanks for testing this one.

@richard67 richard67 added the bug label Feb 1, 2026
@richard67
Copy link
Member

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46768.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Feb 1, 2026
@richard67 richard67 added this to the Joomla! 5.4.3 milestone Feb 1, 2026
@muhme
Copy link
Contributor

muhme commented Feb 3, 2026

✅ Final test before merge with JBT

  • Seen error 400 'Field required: Email Notifications' and User > User Actions Log Options > Email Notifications is mandatory field before PR
  • Applied PR with Patch Tester
  • Changing only email address via API call for the same user account that owns the API token is possible, also for other user
  • User > User Actions Log Options > Email Notifications is no more marked as mandatory field, it is still possible to enable and disable this field

@muhme muhme merged commit 527cd34 into joomla:5.4-dev Feb 3, 2026
69 checks passed
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Feb 3, 2026
@muhme
Copy link
Contributor

muhme commented Feb 3, 2026

Thank you @OctavianC for your contribution. Thank you @exlemor and @Megharaj170804 for testing. Thank you @brianteeman for supporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants