customization – Category selectable homepage

I’ve got a local WordPress install that I’ve tried to make customisable by users, so it only shows pages from categories they have selected.
I’ve used the code that I’ve found in the thread How to Set an Individual Homepage for Each User?
and while it works, it breaks the menu on every page, it just dissapears.

Example before:
https://i.stack.imgur.com/dVvLb.png

And After:
https://i.stack.imgur.com/aNqWX.png

Any help would be appreciated. Thank you in advance.