manlio Posted September 20, 2014 Share Posted September 20, 2014 Hello! (PW version 2.5 after updating from dev branch) I have two different pages ("instructors" and "courses") with their children. I was trying to run a script like this $itm = $wire->pages->get("/instructors/"); $items = $itm->children(); foreach ($items as $item) { echo $item->title; } My problem is that it returns nothing (no errors - debug is on). The vardump($items) return an empty array. If I change get("/instructors/") to get("/courses/") everything works fine and it returns the titles of the children. If I echo the first line I get the proper ID of "instructors".The main difference I can see between the pages is that instructors have the "user" system template. Is there any possible reason why I can't access these children? But here comes tha bad news (for me ). While trying to solve this problem I discovered that if I change data of an instructor and save, the instructor page "is moving" from the instructors parent to admin->access->user parent and this seems strange to me. But if I try to move it back I get an error that state that I don't have the permission to change the parent. I don't understand if anything is broken in the users or if I missed something, thanks for any help. Previously I found that there was one duplicate user (result of old test) under the admin->access->user page that maybe originate some problems. I deleted the user but the situation is like before. N.B. Instructors is the result of Import CSV Module and I would try to avoid to reimport them because there are other imported pages that are linked with a page reference to the PW id of the users, and new import will change that. Link to comment Share on other sites More sharing options...
marcus Posted September 20, 2014 Share Posted September 20, 2014 Haven't been in said situation, but I assume strongly that pages of template user get a special treatmeant from PW within selectors. Could you try: $items = $itm->children("include=all"); 1 Link to comment Share on other sites More sharing options...
manlio Posted September 20, 2014 Author Share Posted September 20, 2014 Thank you marcus! This solved the first problem and now woks! While searching I noticed that user template can affect children and find behaviours so you have given me the key . Now can someone help me to understand why when I edit an instructor it change parent and moves to admin->access->user. I really want to avoid this. Thank you 1 Link to comment Share on other sites More sharing options...
marcus Posted September 20, 2014 Share Posted September 20, 2014 Thank you marcus! This solved the first problem and now woks! While searching I noticed that user template can affect children and find behaviours so you have given me the key . Now can someone help me to understand why when I edit an instructor it change parent and moves to admin->access->user. I really want to avoid this. Thank you Sounds like a design decision, maybe pages of user template aren't intended to "live" outside admin › access › user, and there's some "correcting" hook kicking in on page save. 1 Link to comment Share on other sites More sharing options...
manlio Posted September 20, 2014 Author Share Posted September 20, 2014 This really sounds like a good thing, I'm feeling better. I was worried to have encountered a more serious problem. Hope that someone can confirm. Thanks for your time and precious advices marcus. Link to comment Share on other sites More sharing options...
Soma Posted September 20, 2014 Share Posted September 20, 2014 User pages are not allowed outside users folder. 1 Link to comment Share on other sites More sharing options...
manlio Posted September 20, 2014 Author Share Posted September 20, 2014 Thank you very much to clarify and for the excellent support. Now everything is clearer and I prefer managing them as "normal" users. Regards 1 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