Steps to reproduce:

1. Have pathauto setup for blogs
2. User should have blog/ and blog//feed aliases (i.e., blog/jgoldberg and blog/jgoldberg/feed)
2. User goes to profile, presses save
3. Confirm url aliases have disappeared

In the change from Drupal 6 RC1 to RC2, the permission "edit own blog" changed to "edit own blog entries". See hook blog_perm in HEAD.

When user_access does not authenticate, pathauto deletes the url aliases for the blog module.

CommentFileSizeAuthor
#2 pathauto.module.1.patch801 bytesjgoldberg
pathauto.module.patch803 bytesjgoldberg

Comments

greggles’s picture

Priority: Critical » Normal

What about changing this to "create blog entries' I think that's more analogous to the "edit own blog" permission from Drupal5.

jgoldberg’s picture

StatusFileSize
new801 bytes

Agreed.

greggles’s picture

Status: Needs review » Fixed

Awesome - 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

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

Anonymous’s picture

Version: 6.x-1.x-dev » 6.x-1.1
Priority: Normal » Critical
Status: Closed (fixed) » Needs review

I'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;
}
}

greggles’s picture

Priority: Critical » Normal
Status: Needs review » Active

@joe_tip, I'm not sure, but updating priority and status to better values.

dave reid’s picture

Status: Active » Fixed

This should be fixed with the latest code. Please open if that's not the case with the latest code.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

matthensley’s picture

Version: 6.x-1.1 » 6.x-1.4
Status: Closed (fixed) » Active

Having the same issue in 6.x-1.4

dave reid’s picture

Status: Active » Fixed

@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.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.