Jump to content

Two problems maybe same origin


manlio
 Share

Recommended Posts

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

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

  • Like 1
Link to comment
Share on other sites

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. 

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...