Opened 19 years ago
Closed 17 years ago
#2467 closed defect (bug) (fixed)
Spaces in nicknames and author pages
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 2.6.1 | Priority: | normal |
Severity: | major | Version: | 2.3.3 |
Component: | Template | Keywords: | author, space, 404 |
Focuses: | Cc: |
Description
It seems that when an user's username contains spaces (e.g., "Bob Smith"), links to their author page of the form /author/bob-smith/ fail (these are the types of links produced from within wordpress) and go to the 404 page. This can be fixed by editing the get_userdatabylogin
function and changing
if ( !$user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_login = '$user_login'") )
to
if ( !$user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_nicename = '$user_login'") )`
But I'm not clear whether this is an appropriate change, or not. Hope this is of some use.
Change History (10)
#2
@
19 years ago
- Resolution invalid deleted
- Status changed from closed to reopened
I was using
<?php wp_list_authors('exclude_admin=0'); ?>
This is what happens for me on the latest 2.01 build:
- Create new user with user name "Bob Smith" (no quotes)
- Write one post with them as author
- Try to access their page with the link of form www.myblog.com/author/bob-smith/, returned by wp_list_authors, using all default permalink structures, etc.
- No joy getting the corresponding author page if the username had spaces in it; no problem for one word.
I'd made a default a custom author page, but I don't imagine that's necessary.
The function get_author_link (in template-functions-author.php) seems to return a link using user_nicename, whereas get_userdatabylogin (in pluggable-functions.php) looks up the database with user_login instead. I'm not really clear where/how user_nicename is set, but it seems that if the link is generated using that field, that's what we should look up in the database.
Of course, it's equally possible I'm missing something completely...!
#3
@
19 years ago
Okay, I'm an idiot - it applies when you change the permalink structure to "Date and name based". Otherwise, links are of the query form, rather than /author/name form.
#4
@
18 years ago
- Resolution set to invalid
- Status changed from reopened to closed
It doesn't make any sense. For starters the username shouldn't contain spaces, and why would you use nicename when you want the *username*?
#5
@
17 years ago
- Component changed from Administration to Template
- Keywords author space 404 added
- Milestone set to 2.5
- Resolution invalid deleted
- Status changed from closed to reopened
- Version changed from 2.0.1 to 2.3.2
I still have this problem with WP 2.3.2, using function the_author_posts_link() inside template files. The link generated is, for example, http://www.angelic.it/author/G.%20Finamore , that returns a 404. Also http://www.angelic.it/author/G.-Finamore (manually inserting it) doesn't work.
There are recent posts on support forum, too:
http://wordpress.org/support/topic/127336
What function are you using to generate the links to your author archives? Exactly what are the links? I can't replicate on latest svn using wp_list_authors(). Closing, reopen if you can provide a scenario where this actually fails.