Download & Extend

user_page_title_alter() and user_page_title_pattern_alter() fail to trigger due to call to menu_get_object()

Project:Page Title
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Setting a custom pattern for User Profile doesn't work for me because the calls to menu_get_object() from user_page_title_alter() and user_page_title_pattern_alter() fail. They fail (return NULL) because the following check in menu_get_object() fails:

$router_item['load_functions'][$position] == $type .'_load'

because the load function is user_uid_optional_load(), not user_load(). And this is in core, specified in user.module:

  $items['user/%user_uid_optional'] = array(
    'title' => 'My account',
    'title callback' => 'user_page_title',
    'title arguments' => array(1),
    'page callback' => 'user_view',
    'page arguments' => array(1),
    'access callback' => 'user_view_access',
    'access arguments' => array(1),
    'parent' => '',
    'file' => 'user.pages.inc',
  );

Happy to try for a patch if provided a little direction.

Comments

#1

Happy to accept a patch. That function does exist:
http://api.drupal.org/api/drupal/modules--user--user.module/function/use...

It either returns the current user, if there is no argument provided, or the user provided by the argument.

How do you mean they "fail"?

#2

Version:6.x-2.5» 6.x-2.x-dev
Status:active» needs work

Ohhh wait - I see... fixing now.

#3

Status:needs work» fixed

Fixed in Dev. Will be in 2.6 release.

See: http://drupalcode.org/project/page_title.git/commitdiff/2830a791270ada95...

#4

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.