--- W:/ClearlyByDesign/Drupal/modules/6.x/alterprofilepage/6.x-2.6/alterprofilepage/alterprofilepage.module	Sun Apr 04 04:43:54 2010
+++ W:/ClearlyByDesign/Drupal/modules/6.x/alterprofilepage/6.x-2.6 patched/alterprofilepage/alterprofilepage.module	Mon Aug 16 12:55:26 2010
@@ -46,10 +46,73 @@
     $lastlogintime = strftime('%x', $account->access);
   }
   $account->content['summary']['last_access'] = array(
-  '#type' => 'user_profile_item',
-  '#title' => t('Last login'),
-  '#value' => $lastlogintime,
-  '#weight' => -18,
+    '#type' => 'user_profile_item',
+    '#title' => t('Last login'),
+    '#value' => $lastlogintime,
+    '#weight' => -18,
   );
-  drupal_set_title(t('@user\'s profile', array('@user' => $account->name)));
+  
+  $title_pattern = t( variable_get( 'alterprofilepage_title', t( '@user\'s profile' ) ),
+                  array( '@user' => $account->name, ) );
+  
+  if ( module_exists ( 'token' ) ) {
+
+    $types = array(
+      'global' => NULL,
+      'user' => user_load( $account->uid ),
+    );
+
+    // Apply token patterns by resetting the token cache first and then using token_replace_multiple to insert token values
+    token_get_values( 'global', NULL, TRUE );
+    $title = token_replace_multiple( $title_pattern, $types );
+
+  }
+  else {
+    $title = $title_pattern;
+  }
+  
+  drupal_set_title( filter_xss( $title ) );
+
+}
+
+/**
+ * Implements hook_form_FORM_ID_alter().
+ */
+function alterprofilepage_form_user_admin_settings_alter(&$form, $form_state) {
+
+  $form['alterprofilepage_title_fldset'] = array(
+    '#type' => 'fieldset',
+    '#title' => t( 'Profile Page Title' ),
+    '#collapsible' => TRUE,
+    '#collapsed' => FALSE,
+  );
+
+  $form['alterprofilepage_title_fldset']['alterprofilepage_title'] = array(
+    '#type' => 'textarea',
+    '#title' => t( 'Title pattern' ),
+    '#description' => t( 'You can specify a pattern to be used for the user
+                          profile page title instead of the default pattern.
+                          Use <em>@user</em> as a token for the user name.' ),
+    '#default_value' => variable_get( 'alterprofilepage_title', t( '@user\'s profile' ) ),
+    '#rows' => 2,
+  );
+  
+  if ( module_exists( 'token' ) ) {
+    // Add the token help to a collapsed fieldset at the end of the configuration page.
+    
+    $form['alterprofilepage_title_fldset']['alterprofilepage_title']['#description'] .= 
+                  '  ' . t( 'You can also use other tokens in the pattern (see Available Token List below).' );
+                  
+    $form['alterprofilepage_title_fldset']['token_help'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Available Tokens List'),
+      '#collapsible' => TRUE,
+      '#collapsed' => TRUE,
+    );
+    $form['alterprofilepage_title_fldset']['token_help']['content'] = array(
+      '#type' => 'markup',
+      '#value' => theme('token_help'),
+    );
+  }
+
 }
