Closed (fixed)
Project:
Automatic User Names
Version:
8.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
24 Aug 2017 at 18:56 UTC
Updated:
21 Nov 2021 at 08:59 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
3cwebdev commentedComment #3
johan.gant commentedNot totally sure about conventions here, but I struggled to have quantumized's patch apply alongside another, useful one: https://www.drupal.org/node/2918391 due to differences in patch formats.
If I reapply the patch above against 8.x-1.x with `git format-patch` then they both apply cleanly. I've uploaded the output to here, but it probably shouldn't be credited to me if it's committed into the next release.
Comment #4
superbole commentedThank you very much!
This patch solved my problem!
Comment #5
wturrell commentedWith either patch, the username is correctly set, but I get the following error:
autoUsernameCleanTokenValues() seems to be expecting an array but according to the stack trace is being passed the raw value of
auto_username.setting.aun_pattern- "[user:mail]" - as a string… am I missing something obvious?(core 8.5.5, php 7.1.18)
Comment #6
wturrell commented[incorrect stuff removed]
Comment #7
wturrell commentedEDIT Completely misunderstood this, sorry. I misread #3 as suggesting the patches had been combined.
#2918391: Incorrect callback given to token replacement in autoUsernamePatternprocessor fixes the warning in autoUsernameCleanTokenValues() I mentioned in #5 (that error didn't show up immediately for me, hence my confusion.)
TL;DR: if you're using composer, you could do this:
Comment #8
wturrell commented(Hide useless patch, add callback as related issue, fix typo in issue title)
Comment #9
andrezstar commented#8 works fine
Comment #10
aaronbaumanEdit: This change is unncessary and unrelated, given the fix in #2918391
Comment #11
aaronbaumanPatch #3 is good to go.
Comment #12
aaronbaumanComment #13
zoltán balogh commentedPatch in #3 works well, but there is a warning when applying the patch:
git apply 2904513-fix-to-load-pattern-config-with-author-info.patch
2904513-fix-to-load-pattern-config-with-author-info.patch:22: trailing whitespace.
warning: 1 line adds whitespace errors.
Comment #14
aaronbaumanComment #15
zoltán balogh commentedThank you, #14 works well.
Comment #16
lazyD commentedfor me tokens were not getting loaded... did below and it worked for me... Hope this helps someone....
FileName -> AutoUsernameSettingsForm.php
Function -> autoUsernamePatternprocessor
- $pattern = \Drupal::state()->get('aun_pattern', ''); -> Remove this line
+ $pattern = \Drupal::config('auto_username.settings')->get('aun_pattern'); ->Add this line
Cheers.
Comment #17
dkosbob commentedYeah, config wasn't getting loaded for anything. This patch expands on the patch from #14 to include the rest of the config calls.
Comment #18
dkosbob commentedComment #19
gaëlgThe last patch in #2895214: Misuse the State API fixed the problem for me. Several problems, same cause?
Comment #20
thomasmurphy commented#17 worked well for me.
Comment #21
thomasmurphy commentedMinor bug still after applying this patch: usernames are being updated on user accounts edits when this functionality is disabled in the module config.
Comment #22
thomasmurphy commentedComment #23
jayelless commentedCommitted, with an additional fix for point made by @thomasmurphy.