Problem/Motivation
Currently users have routes such as /user which automatically redirects to the currently logged in users page.
In some cases this makes it very cumbersome to add a link to a users editing page without adding custom code. It would be very convenient to simply add in a link to 'user/edit' in, say, a simple HTML block.
Proposed resolution
Add another convenience route /user/edit which automatically redirects to the currently logged in users page.
The user controller already has this functionality to direct to the active users edit page. This only requires the addition of the route.
Remaining tasks
Add the route 'user/edit'.Add some relevant tests to the user controller.- Get feed back from the community.
- Commit that bad boy.
API changes
No backwards compatibility issues. This simply adds a new route so it should be placed into a minor release.
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | interdiff_8-17.txt | 1.06 KB | ravi.shankar |
| #17 | 3168624-17.patch | 3.13 KB | ravi.shankar |
| #14 | after--patch.gif | 872.39 KB | ranjith_kumar_k_u |
| #8 | 3168624-8.patch | 3.13 KB | derekcresswell |
Comments
Comment #2
derekcresswell commentedChanges in this patch :
user.editroute.UserController::userEditPage()function to generalise it because of it's new use.UserControllerTestclass which contains a test for this method. Note, this class is not complete and could later be expanded to include other functions from the class.Comment #3
derekcresswell commentedI will also note, I am aware of the module user_current_paths. This does accomplish what I am after but I believe that this functionality should be moved into core. It is simple to implement and an easy to find use case.
Worth while to put into core.
Comment #4
ayushmishra206 commentedPatch applies cleanly on the latest branch and redirects the user successfully to the users page.
Comment #5
derekcresswell commentedComment #6
derekcresswell commentedChanged the assertion in the test to use an exact match to an absolute URL.
Comment #7
jonathanshawThis needs a title
Otherwise good I think.
Comment #8
derekcresswell commentedAdded the title 'Edit account'.
Comment #9
catchThis directly conflicts with #2360971: The user.page route only redirects, so remove it which is trying to remove the /user route. Generally I think we should make it easier to add a direct link here.
Comment #10
derekcresswell commentedThat issue has not been active for 5 years.
If you ask me, the method here looks much more straight forward and simple than what is linked. But I could see the benefit in the method listed there.
I will take a look a deeper look at that and see if it can be fixed up and or closed. Either way, I feel we need to have both
/userand/user/editlinks available (no matter how they are implemented). These are essential to quickly and easily create a site.Comment #11
abhijith s commentedApplied patch #8 and it works fine.The
/user/editwill be redirected to current logged-in user's account page after applying this patch.RTBC
Comment #12
tanubansal commentedTested #8 on 9.1, RTBC + 1
Comment #14
ranjith_kumar_k_u commentedI have reviewed the #8 patch on drupal 9.2 dev version,the patch works fine.
.
After patch
RTBC
Comment #15
derekcresswell commentedChanging status based on new comments. #9 needs to be addressed still, but I feel the method outlined here is the way to go.
Comment #17
ravi.shankar commentedFixed some CS issues of patch #8.
Comment #19
b_sharpe commentedApplies, has tests and works as intended. RTBC
Comment #21
bramdriesenRTBC +1
Comment #22
jonathanshawI think this feature request is valid, and easier to fix than #2360971: The user.page route only redirects, so remove it.
It will be easy to later adjust the solution developed here as part of #2360971: The user.page route only redirects, so remove it. so I'm not sure that this needs to be blocked on that.
Comment #24
alexpottDiscussed with @catch. We agreed that this does not make #2360971: The user.page route only redirects, so remove it harder and the intention to make it easier to link to user edit pages is useful. In order to land this change we need a change record to tell people about it. See the "add change notice" link above.
Comment #25
bramdriesenI will make an attempt at drafting a CR.
Comment #26
bramdriesenHere is the change record. Not sure if it needs more info (looking at more recent CR's content seems to be limited).
https://www.drupal.org/node/3313603
It's unpublished so the core committer can set the tagged version and publish it after it's done.
Comment #27
bramdriesenComment #28
jonathanshawI tweaked the CR a bit.
Comment #29
alexpottBackported to 9.5.x as a low risk feature request - don't see why we need to wait till 10.1.x for this.
Committed and pushed b61cd96e9d to 10.1.x and fa7196afd4 to 10.0.x and e123dd96cf to 9.5.x. Thanks!