Giter Club home page Giter Club logo

edit-author-slug's Introduction

Edit Author Slug Build Status

Contributors: thebrandonallen
Tags: author, author base, author slug, user nicename, nicename, permalink, permalinks, slug, users, user, role, roles
Requires at least: 5.5
Tested up to: 6.4
Requires PHP: 7.0
Stable tag: 1.9.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html

Allows an admin (or capable user) to edit the author slug of a user, and change the author base.

Description

This plugin allows full control of your user permalinks, allowing you to change both the author base (the '/author/' portion of the author URLs), and the author slug (defaults to the username of the author). You can set the author base globally, or you can set it to be user-specific based on a user's role. You now have the power to craft the perfect URL structure for you Author pages.

WordPress default structure http://example.com/author/username/.

Edit Author Slug allows for http://example.com/ninja/master-ninja/.

Using a role-based author base would allow for http://example.com/ida/master-splinter/ (for an Administrator Role), or http://example.com/koga/leonardo/ (for a Subscriber Role).

Development of this plugin takes place on GitHub. Pull requests are always welcome!

Translations should be submitted to Translate WordPress.

Installation

  1. Upload edit-author-slug folder to your WordPress plugins directory (typically 'wp-content/plugins')
  2. Activate the plugin through the 'Plugins' menu in WordPress
  3. Go to Users > Your Profile, or Users > All Users > (username), and edit the author slug.
  4. Click "Update Profile" or "Update User"
  5. Go to Settings > Edit Author Slug to edit settings
  6. Click "Save Changes"

Screenshots

  1. Settings
  2. Individual user author slug

Frequently Asked Questions

What is an author slug?

On standard WordPress installs, it's the final part of an author permalink. e.g. - https://example.com/author/author-slug/

In relation to WordPress internals, the author slug is the same as the user_nicename field found in a WP_User object, or the users table in the database.

Will my changes persist if I deactivate or delete the Edit Author Slug plugin?

It depends.

Changing a user's author slug is permanent, as this changes the user's user_nicename field in the database.

If you've changed the author base, deactivating or deleting the plugin will revert your author base back to author.

Why can't I edit my Author Slug?

Make sure you are an admin, or have been assigned the edit_users capability.

Why isn't my new Author Slug working?

While I've made every attempt to prevent this, I may have missed a spot or two. First things first, go to Settings > Permalinks and click "Save Changes." You don't need to actually need to make any changes for this to work. Hopefully, this should kick your new Author Slug into gear.

If this doesn't work, make sure you don't have any slug conflicts from other posts/pages/plugins/permalink setting/etc. If you're still experiencing the issue, feel free to post a support request in the forums.

Changelog

1.9.0

  • Release date: 2023-10-17
  • Bumps "Tested up to" version to 6.4
  • Bumps minimum required PHP version to 7.0
  • Bumps minimum required WP version to 5.5
  • Update dependency package versions

1.8.4

  • Release date: 2022-02-13
  • Bumps "Tested up to" version to 5.9

1.8.3

  • Release date: 2021-08-07
  • Bumps "Tested up to" version to 5.8
  • Improves string translations and adds some missing strings that couldn't, previously be translated. Props @alexclassroom

1.8.2

  • Release date: 2021-06-01
  • Bumps "Tested up to" version to 5.7

1.8.1

  • Release date: 2020-12-14
  • Corrects settings page notice link to actually link to the current user's profile page.

1.8.0

  • Release date: 2020-12-14
  • Bumps "Tested up to" version to 5.6
  • Adds a notice to the settings page reminding you that you can edit your author slug on your profile page.
  • Drops support for IE 10 on the settings page.

1.7.0

  • Release date: 2020-06-07
  • Bumps the minimum required version to WordPress 4.9.
  • Bumps "Tested up to" version to 5.4.1
  • Fixes an error that may occur with some install of iThemes Security

1.6.1

  • Release date: 2019-09-05
  • Removes pre-WP 4.5 cache busting. The minimum version has been 4.7 for quite some time, and, as of WP 4.5, the cache busting was redundant.
  • Don't show the options page if ba_eas_can_edit_author_slug() returns false.
  • Bumps "Tested up to" version to 5.2.3

1.6.0

  • Release date: 2018-10-11
  • Minimum required WordPress version is now 4.7
  • Settings page JS no longer depends on jQuery (switched to plain js)
  • Add compatibility for iThemes Force Unique Nickname WordPress Tweak
  • Add a hash string as an author slug option
  • Minimum PHP version has been bumped to 5.3. This is a soft bump, meaning, the plugin should still run on PHP 5.2. However, PHP 5.2 is no longer, officially, supported.

1.5.2

  • Release date: 2017-06-21
  • Fixed a regression where those using the default author based couldn't remove front unless they were also using role-based author bases. Props @thatherton.

1.5.1

  • Release date: 2017-06-02
  • Fix PHP notice when manually updating a user profile. Props @mydigitalsauce.

1.5.0

  • Release date: 2017-05-30
  • Bumped minimum required WordPress version to 4.4.
  • Refactored bulk upgrading again. The original fix made things better, but not as good as it could be. This new refactoring drastically improves performance and memory usage.
  • This release is primarily an under-the-hood release with a number of optimizations and performance improvements.

1.4.1

  • Release date: 2017-04-24
  • Fix failing string replacement in bulk update message.

1.4.0

  • Release date: 2017-04-04
  • Lots of code cleanup to better adhere to WordPress Coding Standards.
  • Improved performance of ba_eas_sanitize_author_base() by preventing unnecessary processing.
  • Fixed an issue where the demo author permalink URL could have a double slash.
  • Improvements to bulk update for sites with a large user base.

1.3.0

  • Release date: 2017-01-25
  • Fix a potential bug where a sanitized author base could end up with double forward slashes.
  • Introduce the %ba_eas_author_role% permalink structure tag. This can be used to customize role-based author bases.
  • Bonus: All alternative facts are now free!

1.2.1

  • Release date: 2016-02-29
  • Fixed stupid error where the default user nicename wasn't being properly retrieved from the database. Sorry about that :(
  • Unfortunately, some unicorns were lost during the development of this release, but they are a resilient creature.

1.2.0

  • Release date: 2016-02-01
  • Added the ability to use forward slashes in the author base.
  • Improved display on the settings page, and storing, of role slugs.
  • Packaged translations are now removed. Anyone interested in translating the plugin should do so at Translate WordPress.
  • EXPERIMENTAL: Added the ability to set the author slug to a user's numeric user id. While I have tested this, I can't be sure that no one's site will implode. If all goes well, the experimental tag will be removed in the next major release (or two).
  • Added ability to remove the front portion of author links.
  • Accessibility improvements to the settings page.

Full Changelog

edit-author-slug's People

Contributors

alexclassroom avatar dependabot[bot] avatar thebrandonallen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

edit-author-slug's Issues

Deprecate `ba_eas_get_wp_roles()`

This function is a backwards compatible wrapper for wp_roles(), which was introduced in WP 4.3. Now that WP 4.3 is the minimum version, our wrapper is no longer needed. Adding this to the 1.5.0 milestone gives a little buffer, to help avoid issues with those that update despite running an incompatible version of WP.

Remove the call to add_options_page completely via role

on your add_options_page call in admin.php you hard code the edit_users capability to render the plugin.
Despite hooking the ba_eas_can_edit_author_slug to prevent the actual update of settings, it would be nice to just hide the page altogether for users that don't have the permission.

function ba_eas_add_settings_menu() {
	add_options_page(
		__( 'Edit Author Slug Settings', 'edit-author-slug' ),
		__( 'Edit Author Slug', 'edit-author-slug' ),
    apply_filters('ba_eas_add_settings_menu', 'edit_users'),
    'edit-author-slug',
		'ba_eas_settings_page_html'
	);
}

Bump minimum WP version to 4.2

WP 4.6 will be release soon, and WP 4.1 usage is now below 5%. This will leave 5 supported versions.

Right now, this looks like it will be a soft bump. Since nothing we're doing actually requires WP 4.2+, we can probably get away without adding version checks, but it should probably be considered.

Remove pre-0.9 options back compat

At the time of this writing, only ~2.2% of installs are running a plugin version less than 1.0.0. The new options were introduced in version 0.9.0 which was released almost 5 years ago. This is some easy dead weight, and complication that we can remove.

Add ability to remove $wp_rewrite->front from author permalinks

If a user sets their permalinks to something like https://example.com/post/%post_id%/, any author links will become https://example.com/post/author-base/author-slug/. A number of users have asked about this. Since, you can now control pretty much everything else related to author permalinks, we should probably add the ability to remove front from author permalinks as well.

A question not an issue on hooking into EAS

Hi

Thank you for writing and maintaining this plugin. I use it on this site:

https://theregistrycreatives.com/

Members register and give their name, and business name. I am able to set their author slug as their name, but I would like to set their author slug as their business name (if given). The business name is a custom field. I use gravity forms to register users. I can hook into a new user being activated by gravity forms (created in WordPress) and try and set the user_nicename as business name there, but it doesn't seem to work. Maybe Edit Author Slug is hooking in after my gravity forms hook? What hook does edit author slug run off, can I add a function that runs after edit author slug when a new user is created or a user is edited?

Thank you for any guidance. Much appreciated.

Regards
Mike

Role based URLs not working with WP 6.0.2

Hi the role based URLs are creating problems in latest WP version.

when we set custom base for roles for example
/author/
/editor/

it creates multiple URLs for a single URL.

for example the user’s role is editor but /author/ also works for it.

Old articles are not showing in author’s search page

Hi

after I activated this plugin and changed author’s slug to firstname-lastname, when I click on author, I see only posts what he wrote after the slug was changed, one from 2017, one from 2013 and few from 2012. Not showed articles have no author set when I edit them. When I change author’s slug to “username” I see only old articles. New articles have no author set when I edit them.

There is important to note, that even in the admin section -> Posts, when I search by author there are also only the 3 articles what are showed on the front end. The older articles just don't have assigned any author.

I checked the wp_posts table, when I search by his id 2 & post_type=post, DB will return all his articles.

thx

wrong canonical url

I am using this plugin + Yoast SEO and i get wrong urls for my canonical and next link attributes

<link rel="canonical" href="https://www.mysite.de/author/realusername/" />
<link rel="next" href="https://www.mysite.de/author/realusername/page/2/" />

any hint on how to fix these?

I've already tried to resave my permalinks settings and nuked all caches.. without success

Breaks image uploading

This plugin breaks the uploading images on my site. After disabling your plugin it seems to fix this issue. It just started yesterday so I'm not sure what the issue would be. If there are any questions I can answer, please let me know.

Thanks.

https://appleterm.com/

Plugin causes issues on WPML translated pages

Hi Brandon,

We are using your plugin to turn /authors into /clen (Czech for "member"). Czech is the base language of the website, English is the secondary language.

Now when someone views a member's profile in CZ, it is all fine. But since one of the recent updates, the EN profiles give us a 404. It worked all fine up until a couple of months ago (I was in a hospital blah blah - didn't really have time to reach out).

I had escalated the issue with WPML, thinking it was them. But unfortunately, it is a plugin conflict. Can you help me out here?

Here are some links for you.

All members in CZ: https://www.jtpunion.org/prekladatele/ - click a member to see the URL.
All members in EN: https://www.jtpunion.org/en/translators/ - click a member to see 404

For the time being, I have switched off the language button on the single Czech profiles, since they don't work.

Any heads up much appreciated.

Tanya

redirect 301 old slug

how to redirect 301 old slug

example.com/old-author-base/old-slug-user

into

example.com/new-author-base/new-slug-user

Add support for iThemes Security

iThemes Security has a setting named Force Unique Nickname. This is essentially a pseudonym for forcing the user_nicename field to be different than the user_login field.

Both Edit Author Slug and iThemes Security hook into user_profile_update_errors with a priority of 10, but because iThemes Security adds it's hook after Edit Author Slug, it's functionality always wins, and means that the user_nicename will always be nickname or firstname-lastname.

It would be nice to integrate with iThemes Security, given that the WordPress plugin directory reports installation numbers of 800,000+. Below is a list of how I see this being implemented.

  1. Check for the existence of iThemes Security and Force Unique Nickname being set to true.
  2. Remove the iThemes Security force_unique_nicename action.
  3. On update, never allow the user_nicename to be equal to user_login.
  4. Don't show user_login as an available option on profile pages or in settings.

`Automatically Update` setting, but only for new users

Hello dear plugin author.

ba_eas_auto_update_user_nicename is hooked to profile_update and user_register.

It would be nice if we could define (even if via filters) that the user_register automatically applies the saved structure, but the profile_update does not.

E.g. when user is registered, that default structure is used, but from that point, updates to their profile would not be synced.

Even better if this plugin could listen for AIOSEO installed, and if so, auto-add an SEO redirect when the auto-sync thing causes a url to change. 🪄

Remove slug entirely?

Is there any way to remove it entirely? I don't want it to be /author/username, I want it to just go to /username but when I delete "author" from the input and save, it's added back in.

Hashed slug?

There are use cases (example: emails as username), where it's appropriate to

  • avoid leaking email info via author slug
  • avoid slug collision in multiple john-smith scenario (nobody wants to be john-smith66)
  • avoid leaking user count info via user id

This leaves some sort of a custom hash-based slug option on the table, as far as I can see.

Your thoughts?

This thought process came up w/ a BuddyPress integration project, so #3 may also be relevant here.

How to translate author base with WPML

Hello,

First thank for your plugin.

I wonder if there is a way to translate the Autor base with WPML.

I leave it to its default value "author" and I'd like it to be translated in "autor" in Portuguese.

WPML can find _ba_eas_author_base with value "author".
But translating this doesn't seem to work.

Thank you

Remove the slug for one group

Hi, not sure if this is the right place for feature suggestions? I wander if its possible to add a functionality that the author-slug for a specific group is just left empty so that the author name comes directly after the url ?

I want to know the reason for this error

Hi

Warning:require(jncludes/classes/class-ba-edit-author-slug.php):failed to open stream:No such file or directory in XXXXXXXXXXXX /edit-author-slug.php on line 38

Fatal error:require():Failed opening required 'jncludes/classes/class-ba-edit-author-slug.php'(include_path',:xxxxxxxxxx') in XXXXXXXXXXXXXXXXXXX/edit-author-slug.php on line 38

I have not edited the plugin.
In addition, I would like to know why

defined( 'ABSPATH' ) || exit;

Sincerely yours

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.