The proper way it to use menu_makecallback to set a callback, then add this callback in menu_additem, then return ITEM_ENABLE or ITEM_DISABLE in the callback function
I figured there was a better way. I don't know much about the callback functionality so I made a work-around.