Move thes test inside `if (!empty($community_menu))` and test only `if (!empty($event_menu))`