Disable Create Record ... only Edit

Hello,
Helped with some guides i’ve extended view.edit.php for my custom module to disable some fileds based on user’s role.

This works very well, now i need to disable new record creation while permitting only to edit existing data(both in editview, detailview and quickcreate).

Any hint?

Thanks

Hi,
You can use a simple workaround for this-
As you have successfully disabled some fields based on roles, extend the same logic and within that condition add a jQuery statement to hide the create button.
This is not a perfect solution, just a workaround to get things done quickly.
Hope this helps.

Thank you.

yes…but in this case i need to create a view.list.php and view.detail.php because i need to disable “Create” button in:

  • List view of the module
  • SubPanel on the Parent module which has the relationship
  • Action link on top left in the details view of the module(so view.detail.php must be created)

AM i right?

Thanks

Yeah, you need to insert your jquery logic in all the places where the create button is being displayed from.
I’ll still look for a proper way instead of a workaround for this and post if i found any.

Thank you.

Update…i was able to inercept Create button and Top Subpanel but i’m not able to make jquery selection of Top Left Action Button,inmy case “Create Items” both on detail view and list view.

Seems that that portion is placed in different location…any hint?
See attached Screenshot…but of course…not an elegant way…hope to find anything else better…
Thank you

In your folder, there would be a file named “Menu.php” The Options that you mention are rendered from this files.
Replace the Create Button’s line by your own with your Role permission check.

Hope this helps.
Thanks

Yes…it helps…and it works…

not elegant but working well…

Thanks again

Hello rainolf
I have same requirements.
Just want to ask in which files you made changes for this requirement?

Thanks