If you have manually set or edited a user profile alias, updating the user account (user/NNN/edit) overwrites the alias. It also throws an error if path_redirect is installed (below).
This patch implements a fix analogous to what was committed for nodes: #369840: If a user changes the automatic path, try to remember that in the future
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'people/dylan-tack-und' for key 'source_language': INSERT INTO {path_redirect} (source, redirect, query, fragment, language, type, last_used) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6); Array ( [:db_insert_placeholder_0] => people/dylan-tack [:db_insert_placeholder_1] => user/10 [:db_insert_placeholder_2] => [:db_insert_placeholder_3] => [:db_insert_placeholder_4] => und [:db_insert_placeholder_5] => 301 [:db_insert_placeholder_6] => 1286252449 ) in drupal_write_record() (line 6014 of /Users/dylan/Sites/mtm_d7/drupal/includes/common.inc).
Comment | File | Size | Author |
---|---|---|---|
#16 | 931740-pathauto-skip-update-terms-accounts.patch | 3.29 KB | Dave Reid |
#10 | 931740-pathauto-skip-update-terms-accounts.patch | 2.38 KB | Dave Reid |
#9 | 931740-pathauto-skip-update-terms-accounts.patch | 3.1 KB | Dave Reid |
pathauto.patch | 1.51 KB | grendzy | |
Comments
Comment #2
grendzy CreditAttribution: grendzy commentedI don't think the the testbot is working, there is one test failure when I run simpletest, but it's not caused by this patch.
Comment #3
Fabianx CreditAttribution: Fabianx commentedHi,
I believe the proper fix is like with nodes to extend the http://drupal.org/project/pathauto_persist module to not only work with node entities, but also with user entities.
The reason is that users could also be done in bulk-processing, where the above change would affect the performance of the bulk processing. (Same reason as for nodes)
Best Wishes,
Fabian (LionsAd)
Comment #4
Fabianx CreditAttribution: Fabianx commentedHm, updating pathauto_persist is more complicated than I thought.
I think the only way to handle manual path alias updates is to hook into the path_admin_form_submit handler for D6 and get the entity type from the first part of 'src'.
In D7 the hook_path_insert and hook_path_update could be used. However they might have the possibility of recursion, so hooking _submit and perhaps addind field to form might still be the preferred way.
@DaveReid: Do you think this would be sane to do? What do you suggest?
Best Wishes,
Fabian (LionsAd)
Comment #5
Fabianx CreditAttribution: Fabianx commentedI now made a proposal for solving this issue for 6.x-2.x-dev.
See: http://drupal.org/node/968644 and http://drupal.org/node/968622
The same approach should work in D7 with minimal porting needed.
Best Wishes,
Fabian (LionsAd)
Comment #6
klonos...subscribing - in order to confirm if(ever) this is fixed.
I need to keep track of all related issues that seem to have a hope of getting solved by either using pathauto_persist as a separate module or by eventually using a future version of pathauto that has the code merged.
Comment #7
Dave ReidComment #8
Dave ReidMarked #968622: Prepare insert / update user function in pathauto to work with pathauto_persist by checking pathauto_perform_alias as a duplicate of this issue.
Comment #9
Dave ReidComment #10
Dave ReidComment #11
Dave ReidCommitted #10 to CVS for both 7.x-1.x and 6.x-2.x.
http://drupal.org/cvs?commit=467254
http://drupal.org/cvs?commit=467256
Comment #13
grendzy CreditAttribution: grendzy commentedI'm still seeing the PDOException in Beta1. This is reproducible on a fresh install:
The patch in #0 still applies and resolves the issue for me.
Comment #14
Dave Reidpath_redirect for d7 is no longer supported. Use the Redirect module instead.
Comment #15
Dave ReidComment #16
Dave ReidPatch re-rolled for 6.x-1.x.
Comment #17
klonos...I thought the bot only run tests against d7(?). This one passed the tests though. Was it pure luck?
Comment #18
Dave ReidConfirmed all the tests passed locally, so committing to Git.
http://drupalcode.org/project/pathauto.git/commit/49a70b6
Comment #19
klonosThanx Dave! One less patch to babysit ;)
Comment #21
maximpodorov CreditAttribution: maximpodorov commentedIs there user interface for editing pathauto_perform_alias property for users and terms?
Comment #22
klonosAFAIK you can only set user and term paths through their respective path patterns (../admin/config/search/path/patterns) not in directly in the user/term edit form the way one does it with nodes. Still, not a reason to re-open this issue.
Comment #23
maximpodorov CreditAttribution: maximpodorov commentedI meant $term->pathauto_perform_alias is checked in the current code (commit link in #18), but there's no way to set it for particular term (except from additional module), and the same is for user, right? So is the fix for the initial request complete?
Comment #24
klonos...ok, I wouldn't know about that.
Comment #25
Fabianx CreditAttribution: Fabianx commentedYes, it needs addtional changes in other modules:
Here is one proposed change for D6 pathauto_persist for user entities:
http://drupal.org/node/968644
It should not be too difficult to port this to D7.
Best Wishes,
Fabian