I have a custom page which lives under user/%user/foobar path.
function MY_MODULE_menu() {
$items = array();
$items['user/%user/foobar'] = array(
'title' => 'Foobar',
'title callback' => 'MY_MODULE_foobar_title_callback',
'title arguments' => array(1),
'description' => 'Displays account balance of the current user.',
'access callback' => 'MY_MODULE_foobar_access_callback',
'access arguments' => array(1),
'page callback' => 'MY_MODULE_foobar_page_callback',
'page arguments' => array(1),
'type' => MENU_LOCAL_TASK,
);
return $items;
}
(Title callback appends %user's name as a suffix to this page's title.)
When I check the foobar page with my administrator user (uid = 21) the result is correct, I see my user's name in the page title, but when I check an another user's (uid = 13671) page I still see my user's name in the page title, however it should be user 13671's username. If I put a dpm() to MY_MODULE_foobar_access_callback() callback to see what arguments this function gets in the $account parameter then the result speaks for itself.

| Comment | File | Size | Author |
|---|---|---|---|
| #2 | me-incorrect-user-loaded-by-argument-handler-2868208-2.patch | 1.12 KB | mxr576 |
| Screen Shot 2017-04-10 at 10.08.11.png | 48.3 KB | mxr576 |
Comments
Comment #2
mxr576Comment #3
mxr576Comment #4
anybody#1400314: Shows logged in user's name for page title, breadcrumb on any user page is possibly related! We need more review here to check if this works as expected or has side-effects.