How to select modal / normal based on user level?

I’m wondering if it’s possible to use a modal edit page for some user levels (staff), and a normal edit page for others (clients)?

Staff have access to the list page so I would like to use modal mode for them.

Clients can only edit their own profile record and cannot access the list page (because of advanced security), so I just want to direct them straight to a normal edit page via a custom menu item.

I have this code in the Menu_Adding event which enables the custom menu item, and the edit page restricts access to the client in question:

if ($item->Name == ‘mci_User_Profile’) {
$item->Icon = ‘fas fa-user’;
$item->Text = $Language->phrase(‘Profile’);
$item->Url = ‘user_profilesedit.php’;

return (UserLevelID() == 0);
}

Has anyone worked out how to achieve something like this?

You may use different URL based on the user level. Check the generated code to find the javascript to open the modal dialog.