Issue Bug Closed

#106860When using the event "ModifyEditFormUserAccessEvent" in an event listener "new" creates a new content element although it is forbidden with "denyUserAccess()"

Michael Perlbach 06/10/25, 22:42 updated 10/02/26, 06:45

Description

I have a custom content element of which I only want to have one instance on one page.

As I want to disable the creation of new content elements on this certain page for a certain user group my custom content element uses the event “ModifyEditFormUserAccessEvent” to prevent a user group from creating new content – which works fine in the backend column view of web->pages. Once a user from this user group clicks on “Create new content” the user is shown some content elements he is allowed to have edit access to (in my case, just one). When the user selects the content element a message is shown that he has no permission to create new content.
I do this in my event listener by checking “$event->getCommand() === ‘new’”. This works like a charm.

However – when the user opens the edit form for the one content element that is already on the page, another “new” button shows up at at the top (and of course, it’s impossible to get rid of it). When the user clicks on this button the edit form for a new content element is shown – which is already inconsistent with expected behaviour. “New” should in this case just show the same error message as when the user clicks on “Create new content” in the column view. This is not the case. When the user clicks on “save” the error message is finally shown – but the new content is created anyway.

If this “works as it should” then it’s not a programming error – it’s a conceptional bug.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 5

  1. Michael Perlbach commented <span data-processor="relativetime" data-value="2025-06-11T17:30:27+00:00" > 06/11/25, 17:30 </span>

    At least, the “new” option in the edit interface can be disabled with user.tsconfig
    options.saveDocNew = 0

    But again, it took me hours to find out.

  2. Oliver Bartsch commented and changed status New Needs Feedback <span data-processor="relativetime" data-value="2025-06-24T10:57:37+00:00" > 06/24/25, 10:57 </span>

    Hi,

    I unfortunately can’t reproduce this. When clicking the “new” button inside a record, the event is triggered since it is dispatched by a form data provider, executed on generating the edit form.

    Can you please verify whether your listener called?

    Best,
    Oli

  3. Georg Ringer commented and changed status Needs Feedback Closed <span data-processor="relativetime" data-value="2026-10-02T06:45:00+00:00" > 10/02/26, 06:45 </span>

    Hey,

    closing the issue due to lack of feedback. If this issue is still valid in v14, please open a new issue and provide information how to reproduce it.

    thanks for your understanding