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:

And After:

Any help would be appreciated. Thank you in advance.