Copy a set of userlevelpermissions to another userlevelid

use the following script to easily copy one of your user level permissions to another userlevelidINSERT INTO userlevelpermissions
(userlevelid, tablename, permission)
select
[NEW_userlevelid], tablename, permission
FROM
userlevelpermissions
WHERE
userlevelid = [FROM_userlevelid]Where:
NEW_userlevelid = the new userlevelid that you want to create
FROM_userlevelid = the existing userlevelid that you want to copy

Example:INSERT INTO userlevelpermissions
(userlevelid, tablename, permission)
SELECT
101, tablename, permission
FROM
userlevelpermissions
WHERE
userlevelid = 0This will copy the “Default” userlevelid 0 into a new userlevelid 101NOTES:

  • don’t forget to create the new userlevelid in table: userlevels
  • be careful that the new userlevelid doesn’t already exist, this script will not update existing records as there is no unique key in the userlevels table. if you have a custom userlevels table with a unique key, you can look at adding the ON DUPLICATE KEY UPDATE constraint

thanks