? 183625_pathauto_contact_form.patch ? 183625_pathauto_contact_form_7.patch ? pathauto_user_contact_5.x-2.2.patch Index: pathauto.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.module,v retrieving revision 1.118 diff -u -p -r1.118 pathauto.module --- pathauto.module 20 Jun 2008 20:01:01 -0000 1.118 +++ pathauto.module 23 Jun 2008 22:57:04 -0000 @@ -416,6 +416,10 @@ function pathauto_user($op, &$edit, &$us $src = 'user/'. $user->uid .'/track'; $alias = pathauto_create_alias('tracker', $op, $placeholders, $src, $user->uid); } + if (module_exists('contact')) { + $src = 'user/'. $user->uid .'/contact'; + $alias = pathauto_create_alias('contact', $op, $placeholders, $src, $user->uid); + } } break; case 'delete': @@ -428,6 +432,7 @@ function pathauto_user($op, &$edit, &$us path_set_alias('blog/'. $user->uid .'/feed'); path_set_alias('user/'. $user->uid .'/track'); path_set_alias('user/'. $user->uid .'/track/feed'); + path_set_alias('user/'. $user->uid .'/contact'); break; default: break; Index: pathauto_user.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto_user.inc,v retrieving revision 1.28 diff -u -p -r1.28 pathauto_user.inc --- pathauto_user.inc 28 May 2008 16:04:35 -0000 1.28 +++ pathauto_user.inc 23 Jun 2008 22:57:04 -0000 @@ -88,6 +88,30 @@ function tracker_pathauto($op) { } /** + * Implementation of hook_pathauto() for contact form aliases. + */ +function contact_pathauto($op) { + switch ($op) { + case 'settings': + $settings = array(); + $settings['module'] = 'contact'; + $settings['token_type'] = 'user'; + $settings['groupheader'] = t('User contact form path settings'); + $settings['patterndescr'] = t('Pattern for the user contact form paths'); + $settings['patterndefault'] = t('users/[user-raw]/contact'); + $patterns = module_invoke_all('token_list', 'user'); + foreach ($patterns['user'] as $pattern => $description) { + $settings['placeholders']['['. $pattern .']'] = $description; + } + $settings['bulkname'] = t('Bulk generate aliases for user contact form paths that are not aliased'); + $settings['bulkdescr'] = t('Generate aliases for all existing user contact form pages which do not already have aliases.'); + return (object) $settings; + default: + break; + } +} + +/** * Bulk generate aliases for all users without aliases. */ function user_pathauto_bulkupdate() { @@ -154,3 +178,25 @@ function tracker_pathauto_bulkupdate() { 'Bulk generation of user tracker pages completed, one alias generated.', 'Bulk generation of user tracker pages completed, @count aliases generated.')); } + +/** + * Bulk generate aliases for all users without aliases + */ +function contact_pathauto_bulkupdate() { + $query = "SELECT uid, name, src, dst FROM {users} LEFT JOIN {url_alias} ON CONCAT(CONCAT('user/', CAST(uid AS CHAR)), '/contact') = src WHERE uid > 0 AND src IS NULL"; + $result = db_query_range($query, 0, variable_get('pathauto_max_bulk_update', 50)); + + $count = 0; + $placeholders = array(); + while ($user = db_fetch_object($result)) { + $placeholders = pathauto_get_placeholders('user', $user); + $src = 'user/'. $user->uid .'/contact'; + if ($alias = pathauto_create_alias('contact', 'bulkupdate', $placeholders, $src, $user->uid)) { + $count++; + } + } + + drupal_set_message(format_plural($count, + 'Bulk generation of contact pages completed, one alias generated.', + 'Bulk generation of contact pages completed, @count aliases generated.')); +}