Closed (fixed)
Project:
Pathauto
Version:
6.x-1.4
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 Jan 2008 at 04:06 UTC
Updated:
28 Dec 2010 at 19:20 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
gregglesWhat about changing this to "create blog entries' I think that's more analogous to the "edit own blog" permission from Drupal5.
Comment #2
jgoldberg commentedAgreed.
Comment #3
gregglesAwesome - fixed for Drupal6 (no reason to backport, right?).
Thanks jgoldberg. If you are looking for more bugs to work on, here's a good list: http://groups.drupal.org/node/8318
Comment #4
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #5
Anonymous (not verified) commentedI'm on drupal 6.10 with pathauth 6.x-1.1 and was having the problem described at the top. I tried to apply the patch, but the pathauto.module file has changed a lot since the patch (was at least 700 lines, now less than 500).
In my case, the code to create a user-friendly blog url (i.e. /blog/joe instead of /blog/101) was in the update operation. So every time I updated a user, it was clearing out the blog alias. I just moved the blog alias portion of the code to the insert operation and it appears to work fine now. I'd appreciate if anyone can comment on this or give me direction if I'm posting this in the wrong place.
function pathauto_user($op, &$edit, &$user, $category = FALSE) {
_pathauto_include();
switch ($op) {
case 'insert':
// Use the username to automatically create an alias
$pathauto_user = (object) array_merge((array) $user, $edit);
if ($user->name) {
$placeholders = pathauto_get_placeholders('user', $pathauto_user);
if (module_exists('blog')) {
$new_user = $user;
if ($category == 'account') {
$new_user->roles = isset($edit['roles']) ? $edit['roles'] : array();
$new_user->roles[DRUPAL_AUTHENTICATED_RID] = 'authenticated user'; // Add this back
}
if (user_access('create blog entries', $new_user)) {
$src = 'blog/'. $user->uid;
$alias = pathauto_create_alias('blog', $op, $placeholders, $src, $user->uid);
}
else {
path_set_alias('blog/'. $user->uid);
path_set_alias('blog/'. $user->uid .'/feed');
}
}
}
break;
case 'update':
// Use the username to automatically create an alias
$pathauto_user = (object) array_merge((array) $user, $edit);
if ($user->name) {
$placeholders = pathauto_get_placeholders('user', $pathauto_user);
$src = 'user/'. $user->uid;
$alias = pathauto_create_alias('user', $op, $placeholders, $src, $user->uid);
/*
**** I MOVED THIS BLOCK UP TO THE INSERT OPERATION *********
if (module_exists('blog')) {
$new_user = $user;
if ($category == 'account') {
$new_user->roles = isset($edit['roles']) ? $edit['roles'] : array();
$new_user->roles[DRUPAL_AUTHENTICATED_RID] = 'authenticated user'; // Add this back
}
if (user_access('create blog entries', $new_user)) {
$src = 'blog/'. $user->uid;
$alias = pathauto_create_alias('blog', $op, $placeholders, $src, $user->uid);
}
else {
path_set_alias('blog/'. $user->uid);
path_set_alias('blog/'. $user->uid .'/feed');
}
}
*/
if (module_exists('tracker')) {
$src = 'user/'. $user->uid .'/track';
$alias = pathauto_create_alias('tracker', $op, $placeholders, $src, $user->uid);
}
}
break;
case 'delete':
// If the user is deleted, remove the path aliases
$user = (object) $user;
path_set_alias('user/'. $user->uid);
// They may have enabled these modules and/or feeds when the user was created, so let's try to delete all of them
path_set_alias('blog/'. $user->uid);
path_set_alias('blog/'. $user->uid .'/feed');
path_set_alias('user/'. $user->uid .'/track');
path_set_alias('user/'. $user->uid .'/track/feed');
break;
default:
break;
}
}
Comment #6
greggles@joe_tip, I'm not sure, but updating priority and status to better values.
Comment #7
dave reidThis should be fixed with the latest code. Please open if that's not the case with the latest code.
Comment #10
matthensley commentedHaving the same issue in 6.x-1.4
Comment #11
dave reid@matthensley: You have to be sure that your user in question can actually create blog nodes, and you're using the core blog module. Also try updating to the latest stable version. If you can reproduce then, please file a new issue with more detailed information about your setup and configuration. Posting "Having the same issue" on a ticket that's been closed since March isn't very helpful.