WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Apostrophe in user name (4 posts)

  1. tedinoz
    Member
    Posted 7 years ago #

    I've got several users with an apostrophe in their name (e.g., O'Brien)-but in every case their login name is 100% numeric.

    The apostrophe is inserting an error message in posts of apostrophised users - "right syntax to use near 'Connell, John'' at line 1]
    SELECT * FROM wp_users WHERE user_login = 'O'Connell, John'". Here is an example url : http://writing.navyhistory.org.au/?p=39154

    I can see it is have trouble parsing the nickname, but that is NOT the user_login and the error appears when the content is printed.

    Any suggestions/solutions about fixing this cheering received.

    Ted

  2. Doodlebee
    Member
    Posted 7 years ago #

    You *might* see of they can use a couple of methods to fix it. One would be:

    O\'Brien - PHP will add slashes to something unless "stripslashes" is used, so it could be that the login is looking for the additional slash.

    Alternatively, WP may change weird characters to the HTML character, so it could be looking for "O& #39;Brien" (had to put a space in there because the forum was parsing it - but remove the space between the "&" and "#")

    That's just a couple of possibilities off the top of my head - hope something works for you.

  3. tedinoz
    Member
    Posted 6 years ago #

    Well, same old story - I've "solved" my own problem.

    The apostrophe seems only to be a problem in the user name field.

    Recently I have built a site with over 1400 authors, so I made the user name equal a sequential number and put the author's name in the first name field (last name comma first name). Then made display as = first name.

    Result - no problem printing apostrophes. Changed my template to always pick display name for reporting purposes. Easy as..

    Ted

  4. croila
    Member
    Posted 6 years ago #

    Tedinoz, I've just encountered precisely the same problem with a user called "O'Brien", so it's good to see the answers here.

    Can anyone tell me, please, how you change the template "to always pick the display name for reporting purposes?"

    Many thanks
    Croila

Topic Closed

This topic has been closed to new replies.

About this Topic