? .DS_Store
? TYLOR_NOTES.txt
? privatemsg_url_prefix_10.patch
? privatemsg_url_prefix_11.patch
? privatemsg_url_prefix_12.patch
Index: privatemsg.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/privatemsg/privatemsg.admin.inc,v
retrieving revision 1.8
diff -u -p -r1.8 privatemsg.admin.inc
--- privatemsg.admin.inc	21 Jul 2010 21:22:44 -0000	1.8
+++ privatemsg.admin.inc	7 Sep 2010 22:22:01 -0000
@@ -125,6 +125,14 @@ function privatemsg_admin_settings() {
     '#default_value' => variable_get('privatemsg_display_fields', array('participants')),
   );
 
+  $form['privatemsg_url_prefix'] = array(
+    '#type' => 'textfield',
+    '#title' => t('URL Prefix'),
+    '#required' => TRUE,
+    '#description' => t('Specify the url prefix to use for all privatemsg pages. Default is "messages". %user will be replaced with the current user id.'),
+    '#default_value' => variable_get('privatemsg_url_prefix', 'messages'),
+  );
+
   $amounts = drupal_map_assoc(array(5, 10, 20, 30, 50, 70, 90, 150, 200, 250, 300));
   $form['privatemsg_listing']['privatemsg_view_max_amount'] = array(
     '#type'          => 'select',
@@ -198,10 +206,14 @@ function privatemsg_admin_settings() {
   );
   drupal_add_js(drupal_get_path('module', 'privatemsg') .'/privatemsg-admin.js');
 
+  $form = system_settings_form($form);
   $form['#submit'][] = 'privatemsg_admin_settings_submit';
-  return system_settings_form($form);
+  return $form;
 }
 
-function privatemsg_admin_settings_submit() {
-  drupal_rebuild_theme_registry();
-}
\ No newline at end of file
+function privatemsg_admin_settings_submit($form, &$form_state) {
+  // Only rebuild menu if url prefix has changed
+  if ($form_state['values']['privatemsg_url_prefix'] != $form['privatemsg_url_prefix']['#default_value']) {
+    menu_rebuild();
+  }
+}
Index: privatemsg.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/privatemsg/privatemsg.module,v
retrieving revision 1.146
diff -u -p -r1.146 privatemsg.module
--- privatemsg.module	17 Aug 2010 13:05:41 -0000	1.146
+++ privatemsg.module	7 Sep 2010 22:22:02 -0000
@@ -14,12 +14,23 @@ define('PRIVATEMSG_READ', 0);
  * Status constant for unread messages.
  */
 define('PRIVATEMSG_UNREAD', 1);
+
 /**
  * Show unlimited messages in a thread.
  */
 define('PRIVATEMSG_UNLIMITED', 'unlimited');
 
 /**
+ * Url constant for specifying url path prefix.
+ */
+define('PRIVATEMSG_URL_PREFIX', variable_get('privatemsg_url_prefix', 'messages') );
+
+/**
+ * Integer constant for specifying argument count in url path prefix.
+ */
+define('PRIVATEMSG_URL_PREFIX_ARG_COUNT', substr_count(PRIVATEMSG_URL_PREFIX, '/') + 1 );
+
+/**
  * Implements hook_perm().
  */
 function privatemsg_perm() {
@@ -129,16 +140,19 @@ function _privatemsg_format_participants
  * Implements hook_menu().
  */
 function privatemsg_menu() {
-  $items['messages'] = array(
+  $url_prefix = variable_get('privatemsg_url_prefix', 'messages');
+  $arg_count = substr_count($url_prefix, '/') + 1;
+
+  $items[$url_prefix] = array(
     'title'            => 'Messages',
     'title callback'   => 'privatemsg_title_callback',
     'page callback'    => 'privatemsg_list_page',
     'page arguments'   => array('list'),
     'file'             => 'privatemsg.pages.inc',
     'access callback'  => 'privatemsg_user_access',
-    'type'             => MENU_NORMAL_ITEM,
+    'type'             => strpos($url_prefix, '%user') === FALSE ? MENU_NORMAL_ITEM : MENU_LOCAL_TASK,
   );
-  $items['messages/list'] = array(
+  $items[$url_prefix . '/list'] = array(
     'title'            => 'Messages',
     'page callback'    => 'privatemsg_list_page',
     'page arguments'   => array('list'),
@@ -147,16 +161,16 @@ function privatemsg_menu() {
     'type'             => MENU_DEFAULT_LOCAL_TASK,
     'weight'           => -10,
   );
-  $items['messages/view/%privatemsg_thread'] = array(
+  $items[$url_prefix . '/view/%privatemsg_thread'] = array(
     'title'            => 'Read message',
     // Set the third argument to TRUE so that we can show access denied instead
     // of not found.
     'load arguments'   => array(NULL, NULL, TRUE),
     'page callback'    => 'privatemsg_view',
-    'page arguments'   => array(2),
+    'page arguments'   => array($arg_count + 1),
     'file'             => 'privatemsg.pages.inc',
     'access callback'  => 'privatemsg_view_access',
-    'access arguments' => array(2),
+    'access arguments' => array($arg_count + 1),
     'type'             => MENU_LOCAL_TASK,
     'weight'           => -5,
   );
@@ -169,10 +183,10 @@ function privatemsg_menu() {
     'access arguments' => array('delete privatemsg'),
     'type'             => MENU_CALLBACK,
   );
-  $items['messages/new'] = array(
+  $items[$url_prefix . '/new'] = array(
     'title'            => 'Write new message',
     'page callback'    => 'drupal_get_form',
-    'page arguments'   => array('privatemsg_new', 2, 3, NULL),
+    'page arguments'   => array('privatemsg_new', $arg_count + 1, $arg_count + 2, NULL),
     'file'             => 'privatemsg.pages.inc',
     'access callback'  => 'privatemsg_user_access',
     'access arguments' => array('write privatemsg'),
@@ -215,20 +229,40 @@ function privatemsg_menu() {
     'access arguments' => array('read privatemsg'),
     'type'             => MENU_CALLBACK,
   );
-  $items['user/%/messages'] = array(
-    'title' => 'Messages',
-    'page callback'    => 'privatemsg_list_page',
-    'page arguments'   => array('list', 1),
-    'file'             => 'privatemsg.pages.inc',
-    'access callback'  => 'privatemsg_user_access',
-    'access arguments' => array('read all private messages'),
-    'type' => MENU_LOCAL_TASK,
-  );
-
+  if(strpos($url_prefix, '%user') === FALSE) {
+    $items['user/%/messages'] = array(
+      'title' => 'Messages',
+      'page callback'    => 'privatemsg_list_page',
+      'page arguments'   => array('list', 1),
+      'file'             => 'privatemsg.pages.inc',
+      'access callback'  => 'privatemsg_user_access',
+      'access arguments' => array('read all private messages'),
+      'type' => MENU_LOCAL_TASK,
+    );
+  }
   return $items;
 }
 
 /**
+ * Returns the current dynamic url prefix.
+ *
+ * Does replace %user with the uid.
+ *
+ * @param $uid
+ *   Use this uid instead of global $user.
+ *
+ * @return
+ *   The privatemsg url prefix for the current request.
+ */
+ function privatemsg_get_dynamic_url_prefix($uid = NULL) {
+   global $user;
+   if (!$uid) {
+     $uid = $user->uid;
+   }
+   return str_replace('%user', $uid, variable_get('privatemsg_url_prefix', 'messages'));
+ }
+
+/**
  * Privatemsg  wrapper for user_access.
  *
  * Never allows anonymous user access as that doesn't makes sense.
@@ -247,11 +281,20 @@ function privatemsg_user_access($permiss
     global $user;
     $account = $user;
   }
-  if (!$account->uid) { // Disallow anonymous access, regardless of permissions
+  // Disallow anonymous access, regardless of permissions
+  if (!$account->uid) {
     return FALSE;
   }
+  // Check that we are not viewing another user's private messages under their account page.
+  $url_prefix = variable_get('privatemsg_url_prefix', 'messages');
+  $user_arg_position = array_search('%user', explode('/', $url_prefix));
+  if($user_arg_position !== FALSE && !user_access('read all messages', $account)) {
+    if($account->uid != arg($user_arg_position) && is_numeric(arg($user_arg_position))) {
+      return FALSE;
+    }
+  }
   if (privatemsg_is_disabled($account) && ($permission == 'write privatemsg') ) {
-    if (arg(0) == 'messages' && variable_get('privatemsg_display_disabled_message', TRUE) && !$disabled_displayed) {
+    if (strpos($_GET['q'], variable_get('privatemsg_url_prefix', 'messages')) === 0  && variable_get('privatemsg_display_disabled_message', TRUE) && !$disabled_displayed) {
       $disabled_displayed = TRUE;
       drupal_set_message(t('You have disabled Privatemsg and are not allowed to write messages. Go to your <a href="@settings_url">Account settings</a> to enable it again.', array('@settings_url' => url('user/' . $account->uid . '/edit'))), 'warning');
     }
@@ -282,7 +325,8 @@ function privatemsg_view_access($thread)
     // Count all messages, if there
     return FALSE;
   }
-  if (privatemsg_user_access('read privatemsg') && arg(1) == 'view') {
+  $arg = substr_count(variable_get('privatemsg_url_prefix', 'messages'), '/') + 1;
+  if (privatemsg_user_access('read privatemsg') && arg($arg) == 'view') {
     return TRUE;
   }
   return FALSE;
@@ -339,7 +383,7 @@ function privatemsg_is_disabled(&$accoun
  *
  *   If no messages are found, or the thread_id is invalid, the function returns
  *   FALSE.
-
+ *
  * @ingroup api
  */
 function privatemsg_thread_load($thread_id, $account = NULL, $start = NULL, $useAccessDenied = FALSE) {
@@ -1141,7 +1185,7 @@ function privatemsg_user($op, &$edit, &$
       if (variable_get('privatemsg_display_loginmessage', TRUE) && privatemsg_user_access()) {
         $count = privatemsg_unread_count();
         if ($count) {
-          drupal_set_message(format_plural($count, 'You have <a href="@messages">1 unread message</a>.', 'You have <a href="@messages">@count unread messages</a>', array('@messages' => url('messages'))));
+          drupal_set_message(format_plural($count, 'You have <a href="@messages">1 unread message</a>.', 'You have <a href="@messages">@count unread messages</a>', array('@messages' => url(privatemsg_get_dynamic_url_prefix()))));
         }
       }
       break;
@@ -1244,10 +1288,10 @@ function _privatemsg_block_menu() {
 
   $links = array();
   if (privatemsg_user_access('write privatemsg')) {
-    $links[] = l(t('Write new message'), 'messages/new', array('attributes' => array('title' => t('Write new message'))));
+    $links[] = l(t('Write new message'), privatemsg_get_dynamic_url_prefix() . '/new', array('attributes' => array('title' => t('Write new message'))));
   }
   if (privatemsg_user_access('read privatemsg') || privatemsg_user_access('read all private messages') ) {
-    $links[] = l(privatemsg_title_callback(), 'messages');
+    $links[] = l(privatemsg_title_callback(), privatemsg_get_dynamic_url_prefix());
   }
   if ( count( $links ) ) {
     $block = array(
@@ -1652,7 +1696,7 @@ function privatemsg_get_link($recipients
   if (empty($validated)) {
     return FALSE;
   }
-  $url = 'messages/new/'. implode(',', $validated);
+  $url = privatemsg_get_dynamic_url_prefix() . '/new/'. implode(',', $validated);
   if (!is_null($subject)) {
     $url .= '/'. $subject;
   }
Index: privatemsg.pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/privatemsg/privatemsg.pages.inc,v
retrieving revision 1.14
diff -u -p -r1.14 privatemsg.pages.inc
--- privatemsg.pages.inc	16 Aug 2010 08:12:25 -0000	1.14
+++ privatemsg.pages.inc	7 Sep 2010 22:22:02 -0000
@@ -118,7 +118,7 @@ function privatemsg_view($thread) {
       'query' => array('start' => $thread['older_start']),
       'title' => t('Display older messages'),
     );
-    $older = l(t('<<'), 'messages/view/' . $thread['thread_id'], $options);
+    $older = l(t('<<'), privatemsg_get_dynamic_url_prefix() . '/view/' . $thread['thread_id'], $options);
   }
   $newer = '';
   if (isset($thread['newer_start'])) {
@@ -126,7 +126,7 @@ function privatemsg_view($thread) {
       'query' => array('start' => $thread['newer_start']),
       'title' => t('Display newer messages'),
     );
-    $newer = l(t('>>'), 'messages/view/' . $thread['thread_id'], $options);
+    $newer = l(t('>>'), privatemsg_get_dynamic_url_prefix() . '/view/' . $thread['thread_id'], $options);
   }
   $substitutions = array('@from' => $thread['from'], '@to' => $thread['to'], '@total' => $thread['message_count'], '!previous_link' => $older, '!newer_link' => $newer);
   $title = t('!previous_link Displaying messages @from - @to of @total !newer_link', $substitutions);
@@ -327,7 +327,7 @@ function privatemsg_new(&$form_state, $r
     '#value'              => t('Send message'),
     '#weight'             => 15,
   );
-  $url = 'messages';
+  $url = privatemsg_get_dynamic_url_prefix();
   $title = t('Cancel');
   if (isset($_REQUEST['destination'])) {
     $url = $_REQUEST['destination'];
@@ -419,7 +419,7 @@ function privatemsg_new_submit($form, &$
       $redirect = variable_get('privatemsg_default_redirect', '<new-message>');
       if ($redirect == '<new-message>') {
         // Forward to the new message in the thread.
-        $form_state['redirect'] = array('messages/view/' . $status['thread_id'], NULL, 'privatemsg-mid-' . $status['mid']);
+        $form_state['redirect'] = array(privatemsg_get_dynamic_url_prefix() . '/view/' . $status['thread_id'], NULL, 'privatemsg-mid-' . $status['mid']);
       }
       elseif (!empty($redirect)) {
         $form_state['redirect'] = $redirect;
@@ -429,7 +429,7 @@ function privatemsg_new_submit($form, &$
     if (!empty($_REQUEST['destination']) && $_REQUEST['destination'] == '[new-message]') {
       // url() can not be used because it does create an path with base path and
       // prefix.
-      $_REQUEST['destination'] =  urlencode(('messages/view/' . $status['thread_id'] . '#' . 'privatemsg-mid-' . $status['mid']));
+      $_REQUEST['destination'] =  urlencode((privatemsg_get_dynamic_url_prefix() . '/view/' . $status['thread_id'] . '#' . 'privatemsg-mid-' . $status['mid']));
     }
   }
   else {
@@ -453,7 +453,7 @@ function privatemsg_delete($form_state, 
   );
   $form['delete_destination'] = array(
     '#type' => 'value',
-    '#value' => count($thread['messages']) > 1 ? 'messages/view/' . $message['thread_id'] : 'messages',
+    '#value' => count($thread['messages']) > 1 ? privatemsg_get_dynamic_url_prefix() . '/view/' . $message['thread_id'] : privatemsg_get_dynamic_url_prefix(),
   );
 
   if (privatemsg_user_access('read all private messages')) {
@@ -466,7 +466,7 @@ function privatemsg_delete($form_state, 
   }
   return confirm_form($form,
     t('Are you sure you want to delete this message?'),
-    isset($_GET['destination']) ? $_GET['destination'] : 'messages/view/'. $message['thread_id'],
+    isset($_GET['destination']) ? $_GET['destination'] : privatemsg_get_dynamic_url_prefix() . '/view/'. $message['thread_id'],
     t('This action cannot be undone.'),
     t('Delete'),
     t('Cancel')
Index: privatemsg.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/privatemsg/privatemsg.test,v
retrieving revision 1.22
diff -u -p -r1.22 privatemsg.test
--- privatemsg.test	17 Aug 2010 13:05:41 -0000	1.22
+++ privatemsg.test	7 Sep 2010 22:22:02 -0000
@@ -885,3 +885,128 @@ class PrivatemsgLinksTestCase extends Dr
     $this->assertText(t('You have a new message! Click here to read it.'), t('New message indication displayed.'));
   }
 }
+
+/**
+ * Test privatemsg URL prefixes.
+ */
+class PrivatemsgURLPrefixCase extends DrupalWebTestCase {
+  /**
+   * Implements getInfo().
+   */
+  function getInfo() {
+    return array
+    (
+      // 'name' should start with what is being tested (menu item) followed by what about it
+      // is being tested (creation/deletion).
+      'name' => t('Privatemsg URL prefixes.'),
+      // 'description' should be one or more complete sentences that provide more details on what
+      // exactly is being tested.
+      'description' => t('Test URL prefixes functionality for privatemsg.'),
+      // 'group' should be a logical grouping of test cases, like a category.  In most cases, that
+      // is the module the test case is for.
+      'group' => t('Privatemsg'),
+    );
+  }
+
+  /**
+   * Implements setUp().
+   */
+  function setUp() {
+    // Each of these modules depends on URL prefixes.
+    parent::setUp('privatemsg', 'pm_block_user', 'pm_email_notify', 'privatemsg_filter');
+  }
+
+  function checkPrefix($url_prefix) {
+    $author    = $this->drupalCreateUser(array('write privatemsg', 'read privatemsg'));
+    $recipient = $this->drupalCreateUser(array('write privatemsg', 'read privatemsg'));
+    $admin     = $this->drupalCreateUser(array('write privatemsg', 'read privatemsg', 'read all private messages', 'administer privatemsg settings', 'administer blocks'));
+
+    // Login as admin, set prefix, and set blocks.
+    $this->drupalLogin($admin);
+    $this->drupalPost('admin/settings/messages', array('privatemsg_url_prefix' => $url_prefix), t('Save configuration'));
+    $this->assertText(t('The configuration options have been saved.'));
+
+    // Check that 'Messages' link does not show up in main nav if using %user token. Do this before enabling blocks.
+    if(strpos($url_prefix, '%user') !== FALSE) {
+      $this->drupalGet('');
+      $this->assertNoText(t('Messages'), t('Messages link should not be found in navigation menu.'));
+    }
+
+    $blocks = array(
+      'privatemsg_privatemsg-new[region]' => 'left',
+      'privatemsg_privatemsg-menu[region]' => 'left',
+    );
+    $this->drupalPost('admin/build/block', $blocks, t('Save blocks'));
+
+    // Login as author.
+    $this->drupalLogin($author);
+
+    // Create new message.
+    $edit = array(
+      'recipient' => $recipient->name,
+      'subject'   => $this->randomName(20),
+      'body'      => $this->randomName(100),
+    );
+    $this->drupalPost(privatemsg_get_dynamic_url_prefix($author->uid) . '/new', $edit, t('Send message'));
+
+    $this->assertText(t('A message has been sent to @recipients.', array('@recipients' => $recipient->name)), t('Message sent confirmation displayed'));
+    $this->assertText($edit['body'], t('Message body found using default submit redirect (&lt;new-message&gt;).'));
+
+    // From privatemsg_filter.
+    $this->drupalGet(privatemsg_get_dynamic_url_prefix($author->uid) . '/sent');
+    $this->assertText($edit['subject'], t('Message found on message sent page.'));
+
+    // Check for correct !message URL in sent email from pm_email_notify.
+    $captured_emails = $this->drupalGetMails();
+    $this->drupalSetContent($captured_emails['0']['body']);
+    $this->assertText(privatemsg_get_dynamic_url_prefix($recipient->uid) . '/view/', t('Found correct message link (' . privatemsg_get_dynamic_url_prefix($recipient->uid) . ') in email body: ') . $captured_emails['0']['body']);
+
+    // Login as recipient.
+    $this->drupalLogin($recipient);
+
+    $this->drupalGet(privatemsg_get_dynamic_url_prefix($recipient->uid));
+    $this->assertText($edit['subject'], t('Message found on root message list page.'));
+
+    // Try the private message block links.
+    $this->clickLink(t('Messages (@count new)', array('@count' => 1)));
+    $this->assertText($edit['subject'], t('Message found on root message after clicking from Private Messages block.'));
+    $this->clickLink(t('Write new message'));
+    $this->assertText(t('Write new message'), t('Write new message title found.'));
+    $this->clickLink(t('You have a new message! Click here to read it.'));
+    $this->assertText($edit['subject'], t('Message found after clicking link on new message block.'));
+
+    // From privatemsg_filter.
+    $this->drupalGet(privatemsg_get_dynamic_url_prefix($recipient->uid) . '/inbox');
+    $this->assertText($edit['subject'], t('Message found on inbox message list page.'));
+
+    $this->drupalGet(privatemsg_get_dynamic_url_prefix($recipient->uid) . '/list');
+    $this->assertText($edit['subject'], t('Message found on message list page.'));
+
+    // Click on the message.
+    $this->clickLink($edit['subject']);
+    $this->assertText($edit['body'], t('Message body found on message view.'));
+
+    // Check that blocked users path works as expected.
+    $this->clickLink('Block author');
+    $this->drupalPost(NULL, NULL, t('Block @user', array('@user' => $author->name)));
+    $this->assertText(t('@author has been blocked from sending you any further messages.', array('@author' => $author->name)), 'Check for block confirmation text.');
+    $this->assertText($edit['body'], t('Check that we were taken back to message after block.'));
+    $this->drupalGet(privatemsg_get_dynamic_url_prefix($recipient->uid) . '/blocked');
+    $this->assertText($author->name, t('Author name found on blocked user page.'));
+  }
+
+  /**
+   * Test that basic URL prefixes work properly.
+   */
+  function testPrefix() {
+    $this->checkPrefix($this->randomName(20));
+  }
+
+  /**
+   * Test that basic URL prefixes with %user work properly.
+   */
+  function testPrefixUser() {
+    $this->checkPrefix("user/%user/" . $this->randomName(5));
+  }
+
+}
Index: privatemsg.theme.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/privatemsg/privatemsg.theme.inc,v
retrieving revision 1.4
diff -u -p -r1.4 privatemsg.theme.inc
--- privatemsg.theme.inc	17 Aug 2010 13:05:41 -0000	1.4
+++ privatemsg.theme.inc	7 Sep 2010 22:22:03 -0000
@@ -96,7 +96,7 @@ function phptemplate_privatemsg_list_fie
     $is_new = theme_mark(MARK_NEW);
     $options['fragment'] = 'new';
   }
-  $field['data'] = l($thread['subject'], 'messages/view/' . $thread['thread_id'], $options) . $is_new;
+  $field['data'] = l($thread['subject'], privatemsg_get_dynamic_url_prefix() . '/view/' . $thread['thread_id'], $options) . $is_new;
   $field['class'] = 'privatemsg-list-subject';
   return $field;
 }
@@ -112,7 +112,7 @@ function phptemplate_privatemsg_list_fie
   $options = array();
   if (!empty($thread['is_new']) && $thread['is_new'] < $thread['count']) {
     $options['fragment'] = 'new';
-    $field['data'] .= '<br />' . l((format_plural($thread['is_new'], '(1 new)', '(@count new)')), 'messages/view/' . $thread['thread_id'], $options);
+    $field['data'] .= '<br />' . l((format_plural($thread['is_new'], '(1 new)', '(@count new)')), privatemsg_get_dynamic_url_prefix() . '/view/' . $thread['thread_id'], $options);
   }
   $field['class'] = 'privatemsg-list-count';
   return $field;
@@ -306,7 +306,7 @@ function theme_privatemsg_new_block($cou
                         array('@count' => $count));
     }
 
-  return l($text, 'messages', array('attributes' => array('id' => 'privatemsg-new-link')));
+  return l($text, privatemsg_get_dynamic_url_prefix(), array('attributes' => array('id' => 'privatemsg-new-link')));
 }
 
 /**
Index: pm_block_user/pm_block_user.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/privatemsg/pm_block_user/pm_block_user.module,v
retrieving revision 1.12
diff -u -p -r1.12 pm_block_user.module
--- pm_block_user/pm_block_user.module	6 Sep 2010 18:56:07 -0000	1.12
+++ pm_block_user/pm_block_user.module	7 Sep 2010 22:22:03 -0000
@@ -30,6 +30,7 @@ function pm_block_user_help($path, $arg)
  * Implements hook_menu().
  */
 function pm_block_user_menu() {
+  $url_prefix = variable_get('privatemsg_url_prefix', 'messages');
   $items['messages/block/%user'] = array(
     'title'            => 'Block user messages',
     'page callback'    => 'drupal_get_form',
@@ -41,7 +42,7 @@ function pm_block_user_menu() {
     'weight'           => -10,
   );
 
-  $items['messages/blocked'] = array(
+  $items[$url_prefix . '/blocked'] = array(
     'title'            => 'Blocked users',
     'page callback'    => 'drupal_get_form',
     'page arguments'    => array('pm_block_user_list'),
@@ -257,10 +258,10 @@ function pm_block_user_privatemsg_messag
 
   if ($user->uid <> $author->uid) {
     if ($vars['message']['is_blocked']) {
-      $vars['message_actions']['unblock_author'] = array('title' => t('Unblock author'), 'href' => 'messages/block/'. $author->uid, 'query' => 'destination=messages/view/' . $thread_id);
+      $vars['message_actions']['unblock_author'] = array('title' => t('Unblock author'), 'href' => 'messages/block/'. $author->uid, 'query' => array('destination' => privatemsg_get_dynamic_url_prefix() .  '/view/' . $thread_id));
     }
     else {
-      $vars['message_actions']['block_author'] = array('title' => t('Block author'), 'href' => 'messages/block/'. $author->uid, 'query' => 'destination=messages/view/' . $thread_id);
+      $vars['message_actions']['block_author'] = array('title' => t('Block author'), 'href' => 'messages/block/'. $author->uid, 'query' => array('destination' => privatemsg_get_dynamic_url_prefix() .  '/view/' . $thread_id));
     }
   }
 }
Index: pm_block_user/pm_block_user.pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/privatemsg/pm_block_user/pm_block_user.pages.inc,v
retrieving revision 1.4
diff -u -p -r1.4 pm_block_user.pages.inc
--- pm_block_user/pm_block_user.pages.inc	9 Aug 2010 14:00:19 -0000	1.4
+++ pm_block_user/pm_block_user.pages.inc	7 Sep 2010 22:22:03 -0000
@@ -23,7 +23,7 @@ function pm_block_user_form($form_state,
   );
   $form['destination'] = array(
     '#type' => 'value',
-    '#value' => isset($_GET['destination']) ? $_GET['destination'] : 'messages/',
+    '#value' => isset($_GET['destination']) ? $_GET['destination'] : privatemsg_get_dynamic_url_prefix(),
   );
 
   if (pm_block_user_has_blocked($author, $user)) {
@@ -33,7 +33,7 @@ function pm_block_user_form($form_state,
     );
     return confirm_form($form,
       t('You have previously blocked "@author" from sending you any more messages. Are you sure you want to unblock this user?', array('@author' => $author->name)),
-      isset($_GET['destination']) ? $_GET['destination'] : 'messages/',
+      isset($_GET['destination']) ? $_GET['destination'] : privatemsg_get_dynamic_url_prefix(),
       '',
       t('Unblock @author', array('@author' => $author->name)),
       t('Cancel')
@@ -46,7 +46,7 @@ function pm_block_user_form($form_state,
     );
     return confirm_form($form,
       t('Are you sure you want to block "@author" from sending you any more messages?', array('@author' => $author->name)),
-      isset($_GET['destination']) ? $_GET['destination'] : 'messages/',
+      isset($_GET['destination']) ? $_GET['destination'] : privatemsg_get_dynamic_url_prefix(),
       '',
       t('Block @author', array('@author' => $author->name)),
       t('Cancel')
Index: pm_email_notify/pm_email_notify.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/privatemsg/pm_email_notify/pm_email_notify.module,v
retrieving revision 1.12
diff -u -p -r1.12 pm_email_notify.module
--- pm_email_notify/pm_email_notify.module	5 Aug 2010 09:17:54 -0000	1.12
+++ pm_email_notify/pm_email_notify.module	7 Sep 2010 22:22:03 -0000
@@ -92,7 +92,7 @@ function _pm_email_notify_token($recipie
     '!pm_body' => trim(drupal_html_to_text(check_markup($message['body'], $message['format'], FALSE))),
     '!thread' => $message['thread_id'],
     '!user_uid' => $recipient->uid,
-    '!message' => url('messages/view/' . $message['thread_id'], array('absolute' => TRUE, 'language' => $language)),
+    '!message' => url(privatemsg_get_dynamic_url_prefix($recipient->uid) . '/view/' . $message['thread_id'], array('absolute' => TRUE, 'language' => $language)),
     '!settings' => url('user/' . $recipient->uid . '/edit', array('absolute' => TRUE, 'language' => $language)),
   );
 
Index: privatemsg_filter/privatemsg_filter.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/privatemsg/privatemsg_filter/privatemsg_filter.module,v
retrieving revision 1.12
diff -u -p -r1.12 privatemsg_filter.module
--- privatemsg_filter/privatemsg_filter.module	12 Aug 2010 22:21:30 -0000	1.12
+++ privatemsg_filter/privatemsg_filter.module	7 Sep 2010 22:22:03 -0000
@@ -21,6 +21,8 @@ function privatemsg_filter_perm() {
  * Implements hook_menu().
  */
 function privatemsg_filter_menu() {
+  $url_prefix = variable_get('privatemsg_url_prefix', 'messages');
+
   $items['admin/settings/messages/filter'] = array(
     'title'            => 'Filter',
     'description'      => 'Configure filter settings.',
@@ -84,7 +86,7 @@ function privatemsg_filter_menu() {
     'access arguments' => array('administer privatemsg settings'),
     'type'             => MENU_CALLBACK,
   );
-  $items['messages/inbox'] = array(
+  $items[$url_prefix. '/inbox'] = array(
     'title'            => 'Inbox',
     'page callback'    => 'privatemsg_list_page',
     'page arguments'   => array('inbox'),
@@ -94,8 +96,8 @@ function privatemsg_filter_menu() {
     'type'             => variable_get('privatemsg_filter_default_list', 0) ? MENU_LOCAL_TASK : MENU_DEFAULT_LOCAL_TASK,
     'weight'           => -15,
   );
-  $items['messages/sent'] = array(
-    'title'            => 'Sent messages',
+  $items[$url_prefix . '/sent'] = array(
+    'title'            => 'Sent Messages',
     'page callback'    => 'privatemsg_list_page',
     'page arguments'   => array('sent'),
     'file'             => 'privatemsg.pages.inc',
@@ -126,13 +128,15 @@ function privatemsg_filter_menu() {
  * Implements hook_menu_alter().
  */
 function privatemsg_filter_menu_alter(&$items) {
+  $url_prefix = variable_get('privatemsg_url_prefix', 'messages');
+
   // Rename messages to "All messages".
-  $items['messages/list']['title'] = 'All messages';
+  $items[$url_prefix . '/list']['title'] = 'All messages';
 
   if (variable_get('privatemsg_filter_default_list', 0) == 0) {
     // Change default argument of /messages to inbox. and set the task to MENU_LOCAL_TASK.
-    $items['messages']['page arguments'] = array('inbox');
-    $items['messages/list']['type'] = MENU_LOCAL_TASK;
+    $items[$url_prefix]['page arguments'] = array('inbox');
+    $items[$url_prefix . '/list']['type'] = MENU_LOCAL_TASK;
   }
 }
 
