Fix for Example of using 'title callback' and 'title arguments' in Drupal 6

  1. /**
  2.  * Implementation of hook_menu().
  3.  */
  4. function cck_gallery_menu() {
  5.   $items['cck-galleries/%user'] = array(
  6.     //define the function that generates the page title
  7.     'title callback' => 'cck_gallery_user_titles',
  8.     //pass it the loaded $user object from the wildcard loader - see http://drupal.org/node/224170
  9.     'title arguments' => array(1),
  10.     'description' => t('A list of galleries created by @user.', array('@user' => user_load(arg(2))->name)),
  11.     'page callback' => 'views_embed_view',
  12.     'page arguments' => array(variable_get('cck_gallery_list_view', 'gallery_list_page'), variable_get('cck_gallery_list_view_display', 'default')),
  13.     'access arguments' => array('view cck galleries'),
  14.   );
  15.   return $items;
  16. }
  17.  
  18. /**
  19.  * Function loading the gallery titles per user
  20.  *
  21.  * @param $thisuser
  22.  * Drupal user object received from hook_menu()
  23.  *
  24.  * @return
  25.  * text string for hook_menu() to use as the page title
  26.  */
  27. function cck_gallery_user_titles($thisuser) {
  28.   return t('@user\'s galleries', array('@user' => $thisuser->name));
  29. }

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.