WordPress.org

Support

Support » Miscellaneous » Editing the user_nicename

Editing the user_nicename

  • Does anybody know why user_nicename isn’t editable from the backend? As this is the value used to create author archives it seems like the kind of thing that you’d want to change. Right now, user_nicename is the same as the user’s login name which carries some security risks first off, but people can have usernames that aren’t exactly the kind of thing they want to show off. It is also odd to me that there is a setting for ‘display name publicly as’ but that value isn’t used (cleaned up maybe) for creating author archives.

    Granted, changing the user_nicename could break links to the site but so does changing permalink structure, which is quite common and is built into the core.

    I’m hoping someone can explain the logic of this to me before I start jacking with things 🙂

Viewing 10 replies - 1 through 10 (of 10 total)
  • Moderator Ipstenu (Mika Epstein)

    @ipstenu

    Your username cannot be changed. I don’t know why, but it can’t. I’m sure there’s some technical reason.

    but people can have usernames that aren’t exactly the kind of thing they want to show off.

    When I got my first email address in college, back in the day, I was told ‘Don’t pick something that will embarrass you 10 years from now.’ If your user name isn’t what you want to show off, you should never pick it as your user name. That’s common sense.

    hi Ipstenu,

    But I’m not talking about the username– login_name in the wp_users table–, I’m talking about the user_nicename. Right now, the user_nicename is set to match the login_name, but they are different columns in the wp_users table. I’ve never figured out why the login_name can’t be changed, actually, but I’m not too worried about that because you can set up a ‘display name’ and mostly not worry about what the actual username is– except when you go to set up author pages.

    If your user name isn’t what you want to show off, you should never pick it as your user name. That’s common sense.

    You’re right, but it seems unwise to trust a ‘common’ sense that seems to fail more often than not. If common sense dominated you wouldn’t have people use their kid’s names for passwords, but they do. But, even simple cases can be a problem. Say, I have a writer named ‘Joe Doe’ who signs up as ‘doejoe’. Not embarrassing. Nothing wrong with it. Its a fine username, but I don’t want it displayed as a link to my author’s page. I’d like something like ‘joe-doe’ for example. I can’t figure out why this isn’t possible without editing the database, which as near as I can tell doesn’t break anything internally, by the way.

    Moderator Ipstenu (Mika Epstein)

    @ipstenu

    Oh, no I agree that common sense isn’t common (thank you Descartes) but we can only ope.

    The user_nicename IIRC is the same as the username/login-name. I may be being stupid though.

    Well not the SAME, but it’s the sanitized version there-of

    Well, that starts to explain why user_nicename is the way it is. That’s progress. It doesn’t explain why it needs to be that way.

    Moderator Ipstenu (Mika Epstein)

    @ipstenu

    You can do it in the database.

    I’m trying to think of why you can’t do it in WP, and my only guess is to keep people from screwing themselves over.

    Yeah, I know I can edit it in the database, and I’d only be talking about twenty-five or so edits– not really a big deal but I’d really like it to be more hands-off than that.

    The only two reasons I’ve come up with so far that might explain why you can’t edit this value are that:

    1. People could break their links
    2. There is a possibility for name collisions if user_nicename is editable

    The first seems pretty weak, as permalink changes are easily made from within WP and can break all kinds of linkage. The second seems almost trivially easy to solve– check for a matching name; if it exists require a different name.

    Moderator Ipstenu (Mika Epstein)

    @ipstenu

    Option 3: People constantly changing their user ID pisses off everyone else.

    Lessons learned from a forum where we let people change their login ID. It did. Muchly. Mind you admins should be able to…

    Put it in the bug tracker as a feature req.

    Option 3: People constantly changing their user ID pisses off everyone else.

    True. Didn’t think about that, but then we aren’t talking about the user ID. That remains unchanged and unchangable and a user can already change the name that shows up online (in most places) via the ‘display as’ select box. What we are talking about is the value used for a particular permalink, which also makes me wonder if I ought to be doing this by jacking with the permalink system instead of the user_nicename value.

    Put it in the bug tracker as a feature req.

    I almost certainly will, but I’m trying to get a feel for the issue first. Really, I kinda need this so I’m going to be writing the code anyway, if I can get it into the core so much the better for me. 🙂

    What I’m stuck at right now is what value to use. I’ve thought about setting user_nicename to cleaned up version of display_name, updated automatically, but I think I like the idea of having two different values so I’ll probably go with making the user_nicename directly editable, which is probably the easiest to do and I could also attach appropriate warning to the function.

    Moderator Ipstenu (Mika Epstein)

    @ipstenu

    but then we aren’t talking about the user ID. That remains unchanged and unchangable and a user can already change the name that shows up online (in most places) via the ‘display as’ select box.

    Yeah on the profile you’ll see Ipstenu, no matter how many times I rename myself ‘Mojo Jojo’ or whatever. Course my Gravatar helps, but it’s an identity thing.

    Dunno. It’s really weird now that you made me think about it!

    You wouldn’t really think about it unless you are in a position like I am. A site I handle has had a WP install since maybe 2.3 or 2.5, and the powers that be refused to use most of the features available, including the author feature– writing the author’s name, if identifying the author at all, into a custom meta tag instead ( ?!?!?!?! ). As a consequence the site has a couple of editors and several contributors with perfectly good usernames but not usernames that one would want in a permalink. Thankfully, a large staff turnover has resulted in a team that is a good several orders of magnitude more rational.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Editing the user_nicename’ is closed to new replies.
Skip to toolbar