Almost a year on and this plugin still suffers from an incredible number of basic issues with the code quality causing the plugin to fail spectacularly under even the most basic usage.
I'm outside of the support period which is fine; I'm a senior WP developer, but here's the latest in a long string of issues:
Notice: Undefined offset: 5 in D:\wamp64\www\tnh-staging\wp-content\plugins\ultra-admin\lib\ultra-menu-settings.php on line 614
This is caused by your spaghetti function ultra_rename_menu_getnewID which makes no attempt to check that the array index or even the passed object exists before you go to access it as if it was an array.
In this case it fails because a null value is being passed across to it from some other piece of code. I don't know why this is the case as I honestly just don't have time to chase up even more issues with this plugin - it's not the first time I've had problems with it and I was really hoping that the 2018 version would fix these basic things however this is obviously not going to happen.
For those running into the same issue, the fix is:
function ultra_rename_menu_getnewID($menuarr, $field, $value) {
//Go through each of the keys in the menu:
foreach($menuarr as $key => $product) {
//If the product is not null (menu has been removed somewhere), then continue to access it:
if ( $product != null && isset( $product[ $field ] ) ) { //Check object exists and index is set
if ( $product[ $field ] === $value ) { //Check whether value matches field
return $key;
} //End getting field value
} else { //Field does not match:
return false; //Return a false value
} //Finish handling exception
} //End going through each item on the menu
}
Notice the succinct commenting and clean code alongside error handling and verification of the existence of objects before accessing them?
It's a great way to do professional plugin development :)
Author response
Thank you for your guidance Mr. The Web developer. :)