MarcV Posted September 29, 2015 Share Posted September 29, 2015 Hi, i want to set the Status of a page to hidden, so it won't be shown when a user comes from a specific hostname. I added this in _func.php: $page=$pages->get(1004); $page->addStatus(Page::statusUnpublished); $page->addStatus(Page::statusHidden); But it still shows on the Website. What am I doing wrong? Link to comment Share on other sites More sharing options...
adrian Posted September 29, 2015 Share Posted September 29, 2015 Hi @MarcV and welcome to the forums! A few comments. It's not a good idea to overwrite the $page variable because then the current page will refer to the page with ID#1004. Most of us use $p when referencing another page. You are not saving the page, so the changes are not sticking, but then you probably don't want them to stick because then they would affect all users. Can't you simply add a conditional at the top of template file for page#1004 that says to throw a 404 (throw new Wire404Exception();) if the page id is 1004 and the user's hostname is xxxxx? Does that help? 2 Link to comment Share on other sites More sharing options...
kongondo Posted September 29, 2015 Share Posted September 29, 2015 Or a redirect....it can do lots of wonders .. Welcome to the forums 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now