Similar to "saving profile removes blog url aliases" found for 6.x-1.x-dev, if you edit a customized profile field, the blog aliases are deleted due to the fact that $edit['roles'] is not set. Thus $new_user->roles is overwritten with an empty array first, then the authenticated user role is added back in.

To reproduce:

  1. Have pathauto blog & blog feed set up
  2. Set up customized profile field under admin/user/profile/add/[fieldtype]
  3. Edit user's customized profile field & hit save
  4. Confirm blog & blog feed aliases have been deleted

So far the following quick fix seems to work for me, both in editing current users & creating new ones with/out blogging permission, but the authors may wish to do this in a different/better manner:

Replace lines 730-732 in pathauto.module

          $new_user = $user;
          $new_user->roles = isset($edit['roles']) ? $edit['roles'] : array();
          $new_user->roles[DRUPAL_AUTHENTICATED_RID] = 'authenticated user'; // Add this back

with

          $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
          }

Apologies in advance if I somehow missed a similar report for 5.x.2-2 when searching the issues queue.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

greggles’s picture

This makes sense to me - can you submit it as a patch?

principessaDS’s picture

Status: Active » Needs review
FileSize
855 bytes

Patch made with Cygwin - let me know if there are any problems.

greggles’s picture

Version: 5.x-2.2 » 6.x-1.x-dev
Status: Needs review » Reviewed & tested by the community
FileSize
1.27 KB

Thanks for submitting this as a patch.

There are two more steps to repeat this consistently:

1) The bug doesn't show up for uid1 ever
2) The bug doesn't show up if the authenticated user role has the ability to create roles

Your patch fixed it for me. I updated it for 6.x and also changed it to fit with the coding standards: http://drupal.org/coding-standards

If Freso has an opinion on this then we can wait for that, but otherwise I think it's RTBC.

Freso’s picture

@greggles: If you've tested it and it works, go ahead and commit it. I don't see anything wrong with it. :) Is it tested under 5.x though? If not, it should probably be tested there as well and backported if the bug should live on there.

greggles’s picture

Status: Reviewed & tested by the community » Patch (to be ported)

Committed to 6.x - thanks principessaDS!

Now to port...

greggles’s picture

Status: Patch (to be ported) » Fixed

And committed to 5.x as well.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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