I have Pathauto enabled and set to automatically alias the user paths to /users/username.

When I enabled it, it worked perfectly for all the currently registered users. However, I've noticed that newly registered users since enabling the module get a random path. Instead of /users/username, its /users/lih9087sj. This happens across the board with new accounts and pathauto enabled. Can anyone confirm this?

I'm also wondering if it could possibly be conflicting with the E-mail Registration module.

CommentFileSizeAuthor
#12 change-system-weight-465498.patch602 bytesmaddentim

Comments

greggles’s picture

Status: Active » Postponed (maintainer needs more info)

Yeah, I would guess that this is a conflict with some other module. I suggest you debug this be

1) disabling other modules on the site to see if the problem goes away
2) Start with a test site that just has core and pathauto and then add in other modules until you find the one that causes the problem

chugaystyr’s picture

Version: 6.x-1.1 » 6.x-1.0

I have the same with user/[userpath]. Maybe it will be usefull:
- before the problem i've made mass users insertion direct to database (from another drupal db).
- it happens only with new user creation. It generates right string if i change login.
- fixed if to change User path automated settings (e.g. to user/[user]) and back to previous again (to user/[userpath]). Now it is working right.

greggles’s picture

Project: Pathauto » Email Registration
Status: Postponed (maintainer needs more info) » Active

This is caused by email registration module setting the username to a random string. There's not much that Token (which gets the name) can do about that.

Christopher Herberte’s picture

Version: 6.x-1.0 » 6.x-1.x-dev

I'm not sure that this can be fixed. Path auto is generating the name from the temp random string before the new name gets set.
Maybe module weight might do it? hmm.

greggles’s picture

Pathauto sets it's weight to 10 as it is. How much later could/would Pathauto have to go? I don't think it can.

Christopher Herberte’s picture

Status: Active » Closed (fixed)

BTW I cannot replicate this bug. I'm thinking this is a dupe of #383428 which is fixed.
Closing.

z3cka’s picture

I was able to fix this issue by changing the weight of the email_registration module in the system table to -1 so that it gets run before pathauto does.

like this:

mysql> select name,weight from system where name = 'pathauto' || name  = 'email_registration' order by name;
+--------------------+--------+
| name               | weight |
+--------------------+--------+
| email_registration |     10 | 
| pathauto           |      1 | 
+--------------------+--------+
2 rows in set (0.00 sec)

mysql> UPDATE system
    -> SET weight = -1
    -> WHERE name = 'email_registration';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select name,weight from system where name = 'pathauto' || name  = 'email_registration' order by name;
+--------------------+--------+
| name               | weight |
+--------------------+--------+
| email_registration |     -1 | 
| pathauto           |      1 | 
+--------------------+--------+
2 rows in set (0.00 sec)

Now the paths and usernames get created as expected.

sebagr’s picture

#7 worked great for me, thanks!

However, it's a pain that we have to do this manually... there should be a place in Drupal to move the order of the modules.

And even in that case, there may be circular requirements in which you'd need to run A before B for one hook, but B before A for other hooks...

I read somewhere sometime ago about having a matrix of hooks and modules to have a fine control about module order for all the hooks.

Any idea if there's a module already doing this?

xbery’s picture

Great!! Thanks. Another Drache gone :-)

pieterdc’s picture

Status: Closed (fixed) » Reviewed & tested by the community

straubse said at http://drupal.org/node/1066336#comment-4121216 that #7 worked for him

Just add

 function email_registration_update_4() {
  $ret = array();
  $ret[] = update_sql("UPDATE {system} SET weight = -1 WHERE name = 'email_registration'");
  return $ret;
} 

to email_registration.install and run the database update script.

greggles’s picture

Status: Reviewed & tested by the community » Needs work

That needs a function comment in a docblock and needs to be a patch before it can be rtbc.

Thanks.

maddentim’s picture

Status: Needs work » Needs review
StatusFileSize
new602 bytes

Here is a patch file off 6.x-1.3 instead of the 6.x.1.x-dev as there look to be some d7 commits that accidentally went on the d6 branch.

greggles’s picture

Status: Needs review » Closed (duplicate)

I think this problem would be fixed by #1410844: Switch from hook_user_insert to submit handler so the code fires earlier so marking this a duplicate of that.