What I'm trying to achieve:
User can see block only on his own "user/[uid]/my-page" - he cant see that block on other users my-page.
Users who belong to administrator role can see user block on user own page.
Right now my code shows block for user himself and also to administrator role users BUT for administrator role users it shows block on every page - not only in "my-page".
How to modify code to show block only in "my-page" also for administrator role users?
Here is the code:
<?php
global $user;
if (in_array('administrator', ($user->roles))) {
return TRUE;
}
if (arg(0) == 'user' && $user->uid == arg(1) && arg(2) == "my-page" ) {
return TRUE;
}
else {
return FALSE;
}
?>
I used this code as a base: https://drupal.org/node/134433