• Resolved thamind

    (@thamind)


    Hi Brandon,

    First off, thank you very much for creating this plugin, and for the continued excellent support you have provided for it.

    I seem to have issues when I attempt to change the author slug in the user-edit section. I currently have multiple users with the username in the format “firstname” and I am trying to have it change to “firstname-l” (l being the first letter of their last name). Every time I change it in either one of the selections or under the custom field and hit the update user button at the bottom, it reloads and says User updated, but actually just falls back to the unchanged previous name, as it did not change.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Brandon Allen

    (@thebrandonallen)

    @thamind,

    You’re welcome ??

    What are your Edit Author Slug settings?

    What other plugins do you have installed?

    Edit Author Slug has pretty robust error checking, but that doesn’t mean there aren’t holes. That fact that no changes are made and no error is reported suggests to me that something else is interfering.

    Thread Starter thamind

    (@thamind)

    Thanks for the quick reply.

    Author Base: author
    Role-Based Author Base: Unchecked
    Automatically Update: Unchecked
    Bulk Update: Unchecked

    I have quite a bit of plugins active currently:

    Akismet

    AMP

    Block Bad Queries (BBQ)

    Contact Form 7

    Disable REST API

    Edit Author Slug

    Glue for Yoast SEO & AMP

    Google Author Link

    Google Plus Authorship

    Google XML Sitemaps

    Instagram Slider Widget

    iThemes Security Pro

    ManageWP – Worker

    No Category Base (WPML)

    Opengraph and Microdata Generator

    Peter’s Blog URL Shortcodes

    Redirection

    Regenerate Thumbnails

    Restore Link Title Field

    SEO Rank Reporter

    Simple Local Avatars

    Single Post Template

    Sucuri Security – Auditing, Malware Scanner and Hardening

    Vafpress Post Formats UI

    W3 Total Cache

    WordPress Importer

    WP Force Lowercase URLs

    WP Google Fonts

    WP Gravatar Https

    WP Hide Post

    WP Missed Schedule

    WP Post Template

    Yoast SEO Premium

    Plugin Author Brandon Allen

    (@thebrandonallen)

    So this is an issue with iThemes Security. Looks like you’re using the Force Unique Nickname setting.

    The Force Unique Nickname is actually forcing your author slug (user_nicename) to be different than your use login, by using a user’s Nickname to create the author slug. If a user’s Nickname is not set, it attempts to use the user’s first and last name to create the user’s author slug.

    In this case, you’re setting the user’s author slug to be firstname-l, which is successful. However, the iThemes code is running right after, and setting it back to either the user’s nickname or firstname-lastname.

    I hate to tell you to disable that setting, as it is useful. However, as of now there’s no way to get around it without getting your hands a little dirty with some code. If you’re comfortable with code, I can let you know what to do.

    Thread Starter thamind

    (@thamind)

    Hi Brandon,

    That’s excellent you can identify the issue here! I am well versed in coding, and this is being used on a large scale, high-traffic web site, so any code-based solution I am willing to try out. I will let you know the outcome if I get this working, and I would be so grateful if you could provide me the fix!

    Thanks again!

    Plugin Author Brandon Allen

    (@thebrandonallen)

    Place the below code in your theme’s functions.php or in a functionality plugin. Note that the below code assumes you’re running PHP 5.3 or above.

    add_action( 'init', function () {
    	if ( 10 === has_action( 'user_profile_update_errors', 'ba_eas_update_user_nicename' ) ) {
    		remove_action( 'user_profile_update_errors', 'ba_eas_update_user_nicename', 10 );
    		add_action( 'user_profile_update_errors', 'ba_eas_update_user_nicename', 20, 3 );
    	}
    } );

    The above code is just checking to see if the Edit Author Slug hook exists — this makes it easier for me to add iThemes Support at a later time, without the above code causing issues. If the hook exists, remove it. Then add it back to run after iThemes Security has run it’s code.

    Hi Brandon,

    That seems to be working just fine. We also found it to work if we used the nickname same as the author slug. Following are few questions that we have:

    1. As we are not using Nickname anywhere on the site, so in a longer run would it be better to use the code that you have provided or use the nickname approach that we found to be working?
    2. Considering that you might release an upgrade for the iThemes support, do you think the above code might interfere later when we have installed the plugin update? In case we decide to move forward with the changes to functions file, would we need to remove this code once a plugin update that fixes this issues is out.

    • This reply was modified 7 years, 6 months ago by saurabhmob.
    Plugin Author Brandon Allen

    (@thebrandonallen)

    Both of your questions were answered in earlier replies, but I’ve answered them again, below.

    1. As we are not using Nickname anywhere on the site, so in a longer run would it be better to use the code that you have provided or use the nickname approach that we found to be working?

    That’s up to you. If you go with using the Nickname, there’s no reason to use Edit Author Slug. Setting the author slug to nickname, with a fallback to firstname-lastname, is the default behavior for iThemes Security. This is why it appeared to “work.” Edit Author Slug still wasn’t the one making the changes.

    2. Considering that you might release an upgrade for the iThemes support, do you think the above code might interfere later when we have installed the plugin update? In case we decide to move forward with the changes to functions file, would we need to remove this code once a plugin update that fixes this issues is out.

    No. It was written to not interfere. Now, or in the future. It’s always a good idea to not run code you don’t need, but the above code is light in weight.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Cannot change author slug in user-edit’ is closed to new replies.