The first thing to do to implements such task is to be able to recognise which page an user can edit.
There are different ways to do it. It could be a user meta, some configuration value… For the sake of this answer, I will assume that a function line this exists:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | function wpse_user_can_edit( $user_id, $page_id ) { $page = get_post( $page_id ); // let's find the topmost page in the hierarchy while( $page && (int) $page->parent ) { $page = get_post( $page->parent ); } if ( ! $page ) { return false; } // now $page is the top page in the hierarchy // how to know if an user can edit it, it's up to you... } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.