Opened 14 years ago
Closed 13 years ago
#14787 closed enhancement (fixed)
Introduce get_edit_user_link()
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | General | Keywords: | has-patch |
Focuses: | Cc: |
Description
We should have a function for this, similar to get_edit_post_link(), get_edit_comment_link() etc.
Attachments (4)
Change History (14)
#2
@
14 years ago
- Keywords reporter-feedback removed
I also started to make a patch, even before opening this ticket, but didn't have time to complete it.
Posting it now to avoid duplicate effort. See 14787.diff
#3
@
14 years ago
- Keywords has-patch added; needs-testing removed
- Milestone changed from Awaiting Review to Future Release
#4
@
13 years ago
- Milestone changed from Future Release to 3.5
There's a get_edit_user_link() in #20307 as well.
#6
@
13 years ago
- Owner set to ryan
- Resolution set to fixed
- Status changed from new to closed
In [21364]:
#7
@
13 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
Since [21364], if you try to log in as a subscriber, you'll get a blank screen.
Here's a rundown of what happens:
- In
wp-login.php
,get_edit_user_link()
is called:
http://core.trac.wordpress.org/browser/trunk/wp-login.php?rev=21421#L628 - In
get_edit_user_link()
,get_current_user_id()
andcurrent_user_can()
are called: http://core.trac.wordpress.org/browser/trunk/wp-includes/link-template.php?rev=21421#L1059 - Since cookies are not set yet, both functions fail and an empty string is returned.
- There's nowhere to redirect, so
exit()
in line 632 leaves you with a blank screen. - If you refresh the page, the user's profile appears as expected, since cookies are already set and
wp_get_current_user()
returns the actual user.
14787.2.diff fixes the issue by calling wp_set_current_user()
before trying to get the profile link in wp-login.php
. We could instead pass $user->ID
to get_edit_user_link()
to avoid get_current_user_id()
, but current_user_can()
would fail anyway.
An alternative would be to revert to admin_url( 'profile.php' )
.
#8
@
13 years ago
Or just change the default for the value passed to be an empty string, in which case, get_current_user_id() == $user_id
would evaluate to true, and return profile.php ... no?
EDIT: Ignore me, I didn't look at the trunk version, I was looking at 14787.diff
#9
@
13 years ago
14787.3.diff brings back admin_url()
in wp-login.php
(as per nacin's suggestion).
I've made a patch but haven't tested it.