Version Description
- 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.
Download this release
Release Info
Developer | thebrandonallen |
Plugin | Edit Author Slug |
Version | 1.5.2 |
Comparing to | |
See all releases |
Code changes from version 1.4.1 to 1.5.2
- CHANGELOG.md +221 -0
- LICENSE +339 -0
- README.md +115 -0
- edit-author-slug.php +40 -518
- includes/admin.php +51 -53
- includes/classes/class-edit-author-slug.php +409 -0
- includes/deprecated.php +144 -0
- includes/functions.php +139 -202
- js/edit-author-slug.js +13 -11
- js/edit-author-slug.min.js +2 -2
- languages/edit-author-slug.pot +48 -48
- readme.md +0 -307
- readme.txt +29 -221
- uninstall.php +1 -1
CHANGELOG.md
ADDED
@@ -0,0 +1,221 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Change Log #
|
2 |
+
All notable changes to this project will be documented in this file.
|
3 |
+
|
4 |
+
The format is based on [Keep a Changelog](http://keepachangelog.com/).
|
5 |
+
|
6 |
+
## [1.5.2](https://github.com/thebrandonallen/edit-author-slug/tree/1.5.1) - 2017-06-21 ##
|
7 |
+
### Fixed
|
8 |
+
* Fixed a regression where those using the default author based couldn't remove front unless they were also using role-based author bases. [GH-12]
|
9 |
+
|
10 |
+
## [1.5.1](https://github.com/thebrandonallen/edit-author-slug/tree/1.5.1) - 2017-06-02 ##
|
11 |
+
### Fixed
|
12 |
+
* Fixed a PHP notice when manually updating a user profile.
|
13 |
+
|
14 |
+
## [1.5.0](https://github.com/thebrandonallen/edit-author-slug/tree/1.5.0) - 2017-05-30 ##
|
15 |
+
### Added
|
16 |
+
* Added `CHANGELOG.md` file.
|
17 |
+
* Introduce `ba_eas_nicename_exists()` to check if a nicename exists.
|
18 |
+
* Added `LICENSE` file.
|
19 |
+
* Added `BA_Edit_Author_Slug::VERSION` & `BA_Edit_Author_Slug::DB_VERSION` class constants.
|
20 |
+
|
21 |
+
### Changed
|
22 |
+
* The plugin bootstrap was refactored, and BA_Edit_Author_Slug was moved into `includes/classes/class-ba-edit-author-slug.php`.
|
23 |
+
* Deprecated functions were moved into `includes/deprecated.php`.
|
24 |
+
* `ba_eas_can_edit_author_slug()` no longer checks `is_super_admin()`.
|
25 |
+
* `ba_eas_remove_front()` now checks `ba_eas_has_front()` on top of the `BA_Edit_Author_Slug::remove_front`.
|
26 |
+
* The `BA_Edit_Author_Slug` class is no longer declared `final`.
|
27 |
+
* Translations are only loaded from the WP languages folder (ie - wp-content/languages/plugins).
|
28 |
+
* Bumped minimum required WordPress version to 4.4.
|
29 |
+
|
30 |
+
### Deprecated
|
31 |
+
* Deprecated the `BA_Edit_Author_Slug::version` & `BA_Edit_Author_Slug::db_version` properties.
|
32 |
+
* Deprecated `ba_eas_get_wp_roles()`. Use `wp_roles()` instead. [GH-9]
|
33 |
+
* Deprecated `ba_eas_update_nicename_cache()`. Use `wp_cache_delete( $old_nicename, 'userslugs' )` instead. [GH-10]
|
34 |
+
|
35 |
+
### Fixed
|
36 |
+
* 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.
|
37 |
+
* Lots of minor optimizations that should improve performance.
|
38 |
+
|
39 |
+
### Removed
|
40 |
+
* Options upgrading/back-compat for pre-0.9 installs was removed. [GH-8]
|
41 |
+
|
42 |
+
## [1.4.1](https://github.com/thebrandonallen/edit-author-slug/tree/1.4.1) - 2017-04-24 ##
|
43 |
+
* Fix failing string replacement in bulk update message.
|
44 |
+
|
45 |
+
## [1.4.0](https://github.com/thebrandonallen/edit-author-slug/tree/1.4.0) - 2017-04-04 ##
|
46 |
+
* Lots of code cleanup to better adhere to WordPress Coding Standards.
|
47 |
+
* Improved performance of `ba_eas_sanitize_author_base()` by preventing unnecessary processing.
|
48 |
+
* Fixed an issue where the demo author permalink URL could have a double slash.
|
49 |
+
* Improvements to bulk update for sites with a large user base.
|
50 |
+
|
51 |
+
## [1.3.0](https://github.com/thebrandonallen/edit-author-slug/tree/1.3.0) - 2017-01-25 ##
|
52 |
+
* Fix a potential bug where a sanitized author base could end up with double forward slashes.
|
53 |
+
* Introduce the `%ba_eas_author_role%` permalink structure tag. This can be used to customize role-based author bases.
|
54 |
+
* Bonus: All alternative facts are now free!
|
55 |
+
|
56 |
+
## [1.2.1](https://github.com/thebrandonallen/edit-author-slug/tree/1.2.1) - 2016-02-29 ##
|
57 |
+
* Fixed stupid error where the default user nicename wasn't being properly retrieved from the database. Sorry about that :(
|
58 |
+
* Unfortunately, some unicorns were lost during the development of this release, but they are a resilient creature.
|
59 |
+
|
60 |
+
## [1.2.0](https://github.com/thebrandonallen/edit-author-slug/tree/1.2.0) - 2016-02-01 ##
|
61 |
+
* Added the ability to use forward slashes in the author base.
|
62 |
+
* Improved display on the settings page, and storing, of role slugs.
|
63 |
+
* Packaged translations are now removed. Anyone interested in translating the plugin should do so at [Translate WordPress](https://translate.wordpress.org/projects/wp-plugins/edit-author-slug).
|
64 |
+
* 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).
|
65 |
+
* Added ability to remove the front portion of author links.
|
66 |
+
* Accessibility improvements to the settings page.
|
67 |
+
|
68 |
+
## [1.1.2](https://github.com/thebrandonallen/edit-author-slug/tree/1.1.2) - 2015-10-11 ##
|
69 |
+
* Fix loading of minified JS in the admin.
|
70 |
+
|
71 |
+
## [1.1.1](https://github.com/thebrandonallen/edit-author-slug/tree/1.1.1) - 2015-09-29 ##
|
72 |
+
* Fix a few minor output escaping issues missed in the 1.1.0 release.
|
73 |
+
|
74 |
+
## [1.1.0](https://github.com/thebrandonallen/edit-author-slug/tree/1.1.0) - 2015-09-29 ##
|
75 |
+
* Added the ability to update all author slugs at once with the "Bulk Update" tool.
|
76 |
+
* Greatly improved the checks and error messages when manually updating an author slug for a user.
|
77 |
+
* Further accessibility improvements to match WP 4.3.
|
78 |
+
* Improved validation of author slugs to better match that of WP.
|
79 |
+
|
80 |
+
## [1.0.6](https://github.com/thebrandonallen/edit-author-slug/tree/1.0.6) - 2015-09-14 ##
|
81 |
+
* Fix potential, although unlikely, persistent XSS vulnerability.
|
82 |
+
* Prevent debug notice in admin.
|
83 |
+
* Update heading tags to h1 to match WP 4.3.
|
84 |
+
|
85 |
+
### [1.0.5.1](https://github.com/thebrandonallen/edit-author-slug/tree/1.0.5.1) - 2015-08-04 ###
|
86 |
+
* Identical to 1.0.5, which failed to commit properly.
|
87 |
+
|
88 |
+
## [1.0.5](https://github.com/thebrandonallen/edit-author-slug/tree/1.0.5) - 2015-08-04 ##
|
89 |
+
* Add WP_User object as a parameter passed to the `ba_eas_show_user_nicename_options_list` filter
|
90 |
+
* Add Japanese translation files.
|
91 |
+
* Fixed possible (although unlikely) cache invalidation issue
|
92 |
+
* Minor code improvements and optimizations.
|
93 |
+
|
94 |
+
## [1.0.4](https://github.com/thebrandonallen/edit-author-slug/tree/1.0.4) - 2015-04-21 ##
|
95 |
+
* Improve upgrade routine for older installs
|
96 |
+
* Improve output escaping
|
97 |
+
* Various minor fixes and improvements
|
98 |
+
|
99 |
+
## [1.0.3](https://github.com/thebrandonallen/edit-author-slug/tree/1.0.3) - 2014-10-08 ##
|
100 |
+
I swear I tested this! :(
|
101 |
+
|
102 |
+
* Fix custom roles slugs not saving
|
103 |
+
|
104 |
+
## [1.0.2](https://github.com/thebrandonallen/edit-author-slug/tree/1.0.2) - 2014-09-04 ##
|
105 |
+
* A number of localization fixes and improvements
|
106 |
+
* Role slug improvements
|
107 |
+
* Temporary, semi work-around for Co-Authors Plus [https://github.com/Automattic/Co-Authors-Plus/pull/204]
|
108 |
+
|
109 |
+
## [1.0.1](https://github.com/thebrandonallen/edit-author-slug/tree/1.0.1) - 2014-04-17 ##
|
110 |
+
* Fix possible syntax error when updating a profile (https://wordpress.org/support/topic/undefined-property-error-1)
|
111 |
+
|
112 |
+
## [1.0](https://github.com/thebrandonallen/edit-author-slug/tree/1.0) - 2014-02-26 ##
|
113 |
+
* Added ability to do role-based author bases
|
114 |
+
* Added ability to use role-based author templates
|
115 |
+
* Moderate code refactoring
|
116 |
+
* Various code fixes and improvements
|
117 |
+
* Add "nickname" as option for auto-update
|
118 |
+
* First pass at unit test (only checks if the plugin is installed, for now)
|
119 |
+
|
120 |
+
## [0.9.6](https://github.com/thebrandonallen/edit-author-slug/tree/0.9.6) - 2013-12-18 ##
|
121 |
+
* Fixed loading of translation files. Looks in wp-content/plugins/edit-author-slug/languages. If you're running 3.7+ (and you are... aren't you?), it will fall back to wp-content/languages/plugins if a proper localization can't be found in the edit-author-slug folder.
|
122 |
+
|
123 |
+
## [0.9.5](https://github.com/thebrandonallen/edit-author-slug/tree/0.9.5) - 2013-04-29 ##
|
124 |
+
* Fixed instances where the Author Base wouldn't change, or would result in a 404
|
125 |
+
|
126 |
+
## [0.9.4](https://github.com/thebrandonallen/edit-author-slug/tree/0.9.4) - 2013-01-31 ##
|
127 |
+
* Update readme references to plugin settings
|
128 |
+
* Fix some copy pasta in settings
|
129 |
+
* Update screenshots
|
130 |
+
|
131 |
+
## [0.9.3](https://github.com/thebrandonallen/edit-author-slug/tree/0.9.3) - 2013-01-31 ##
|
132 |
+
* Quickly caught a few things I missed, so this release was skipped. See 0.9.4 for changes
|
133 |
+
|
134 |
+
## [0.9.2](https://github.com/thebrandonallen/edit-author-slug/tree/0.9.2) - 2012-06-25 ##
|
135 |
+
* Fix issue where any profile information other than the Author Slug could not be updated
|
136 |
+
* Minor code improvement
|
137 |
+
|
138 |
+
## [0.9.1](https://github.com/thebrandonallen/edit-author-slug/tree/0.9.1) - 2012-06-14 ##
|
139 |
+
* Add 'Settings' link to plugins list table
|
140 |
+
|
141 |
+
## [0.9](https://github.com/thebrandonallen/edit-author-slug/tree/0.9) - 2012-06-13 ##
|
142 |
+
* Allow Author Slug to be automatically created/updated based on a defined structure
|
143 |
+
* Switched to using the Settings API, which also means that all options moved to the Settings > Edit Author Slug page
|
144 |
+
* Various code improvements/optimizations
|
145 |
+
|
146 |
+
## [0.8.1](https://github.com/thebrandonallen/edit-author-slug/tree/0.8.1) - 2012-02-14 ##
|
147 |
+
* Fix a bug that prevented non-admin users from updating their profile
|
148 |
+
|
149 |
+
## [0.8](https://github.com/thebrandonallen/edit-author-slug/tree/0.8) - 2011-12-15 ##
|
150 |
+
* Drastically improved error handling and feedback for author slug editing.
|
151 |
+
* Restore duplicate author slug check as old method could alter the slug without any sort of warning.
|
152 |
+
* Further improve the logic for flushing rewrite rules.
|
153 |
+
* Introduce ba_eas_can_edit_author_slug() and matching filter to make it even easier to give users the ability to update their own author slug.
|
154 |
+
* Add message in plugins list warning users of WP less than 3.2 that 0.8 is the last update they'll receive.
|
155 |
+
|
156 |
+
## [0.7.2](https://github.com/thebrandonallen/edit-author-slug/tree/0.7.2) - 2011-02-13 ##
|
157 |
+
* Remove overzealous cap check.
|
158 |
+
|
159 |
+
## [0.7.1](https://github.com/thebrandonallen/edit-author-slug/tree/0.7.1) - 2011-02-13 ##
|
160 |
+
* Fix some unfortunate errors I missed before tagging 0.7.
|
161 |
+
|
162 |
+
## [0.7](https://github.com/thebrandonallen/edit-author-slug/tree/0.7) - 2011-02-13 ##
|
163 |
+
* Significant code refactoring.
|
164 |
+
* Added custom capability to give site admins the ability to add author slug access to other roles.
|
165 |
+
* Improvements/optimizations to code logic.
|
166 |
+
* Fixed an incorrect textdomain string.
|
167 |
+
* Removed filter added in 0.6 as it was messy. It's much easier to achieve the same result without the plugin.
|
168 |
+
* Got rid of wp_die() statement on duplicate author slugs in favor of WP's built-in duplicate author slug method.
|
169 |
+
|
170 |
+
## [0.6.1](https://github.com/thebrandonallen/edit-author-slug/tree/0.6.1) - 2010-12-14 ##
|
171 |
+
* Added Dutch translation.
|
172 |
+
* Don't hard code the languages folder path.
|
173 |
+
* Improve class check/initialization.
|
174 |
+
|
175 |
+
## [0.6](https://github.com/thebrandonallen/edit-author-slug/tree/0.6) - 2010-11-03 ##
|
176 |
+
* Some code cleanup.
|
177 |
+
* More security hardening.
|
178 |
+
* Added filter to allow for the complete removal of the Author Base (http://brandonallen.org/2010/11/03/how-to-remove-the-author-base-with-edit-author-slug/).
|
179 |
+
* Flush rewrite rules only when necessary instead of every page load.
|
180 |
+
|
181 |
+
## [0.5](https://github.com/thebrandonallen/edit-author-slug/tree/0.5) - 2010-06-22 ##
|
182 |
+
* Added 'Author Slug' column to Users > Authors & Users (Users > Users in 3.0) page.
|
183 |
+
* Ended support for the WP 2.8 branch. Most likely still works, but I will not support it.
|
184 |
+
* Various bug fixes.
|
185 |
+
|
186 |
+
## [0.4](https://github.com/thebrandonallen/edit-author-slug/tree/0.4) - 2010-05-18 ##
|
187 |
+
* Added ability to change the Author Base.
|
188 |
+
* Updated documentation.
|
189 |
+
* Added some extra security via WP esc_* functions.
|
190 |
+
* Added Belorussian translation.
|
191 |
+
|
192 |
+
## [0.3.1](https://github.com/thebrandonallen/edit-author-slug/tree/0.3.1) - 2010-03-21 ##
|
193 |
+
* Added Hebrew Translation.
|
194 |
+
|
195 |
+
## [0.3](https://github.com/thebrandonallen/edit-author-slug/tree/0.3) - 2010-03-21 ##
|
196 |
+
* Now localization friendly.
|
197 |
+
|
198 |
+
## [0.2.1](https://github.com/thebrandonallen/edit-author-slug/tree/0.2.1) - 2010-02-15 ##
|
199 |
+
* Fixed a bug that prevented updating a user if the author slug did not change.
|
200 |
+
|
201 |
+
## [0.2](https://github.com/thebrandonallen/edit-author-slug/tree/0.2) - 2010-01-27 ##
|
202 |
+
* Added a check to avoid duplicate slugs.
|
203 |
+
* Properly sanitize slug before comparison and database insertion.
|
204 |
+
* Updated plugin URI.
|
205 |
+
|
206 |
+
## [0.1.4](https://github.com/thebrandonallen/edit-author-slug/tree/0.1.4) - 2010-01-18 ##
|
207 |
+
* Update tags to reflect WordPress 2.9.1 compatibility.
|
208 |
+
* Update link to plugin homepage.
|
209 |
+
|
210 |
+
## [0.1.3](https://github.com/thebrandonallen/edit-author-slug/tree/0.1.3) - 2009-12-21 ##
|
211 |
+
* Update tags to reflect WordPress 2.9 compatibility.
|
212 |
+
|
213 |
+
## [0.1.2](https://github.com/thebrandonallen/edit-author-slug/tree/0.1.2) - 2009-11-28 ##
|
214 |
+
* Fix version number issues.
|
215 |
+
|
216 |
+
## [0.1.1](https://github.com/thebrandonallen/edit-author-slug/tree/0.1.1) - 2009-11-27 ##
|
217 |
+
* Remove extra debug functions left behind.
|
218 |
+
* Add screenshot.
|
219 |
+
|
220 |
+
## [0.1](https://github.com/thebrandonallen/edit-author-slug/tree/0.1) - 2009-11-27 ##
|
221 |
+
* Initial release.
|
LICENSE
ADDED
@@ -0,0 +1,339 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 2, June 1991
|
3 |
+
|
4 |
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
5 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
6 |
+
Everyone is permitted to copy and distribute verbatim copies
|
7 |
+
of this license document, but changing it is not allowed.
|
8 |
+
|
9 |
+
Preamble
|
10 |
+
|
11 |
+
The licenses for most software are designed to take away your
|
12 |
+
freedom to share and change it. By contrast, the GNU General Public
|
13 |
+
License is intended to guarantee your freedom to share and change free
|
14 |
+
software--to make sure the software is free for all its users. This
|
15 |
+
General Public License applies to most of the Free Software
|
16 |
+
Foundation's software and to any other program whose authors commit to
|
17 |
+
using it. (Some other Free Software Foundation software is covered by
|
18 |
+
the GNU Lesser General Public License instead.) You can apply it to
|
19 |
+
your programs, too.
|
20 |
+
|
21 |
+
When we speak of free software, we are referring to freedom, not
|
22 |
+
price. Our General Public Licenses are designed to make sure that you
|
23 |
+
have the freedom to distribute copies of free software (and charge for
|
24 |
+
this service if you wish), that you receive source code or can get it
|
25 |
+
if you want it, that you can change the software or use pieces of it
|
26 |
+
in new free programs; and that you know you can do these things.
|
27 |
+
|
28 |
+
To protect your rights, we need to make restrictions that forbid
|
29 |
+
anyone to deny you these rights or to ask you to surrender the rights.
|
30 |
+
These restrictions translate to certain responsibilities for you if you
|
31 |
+
distribute copies of the software, or if you modify it.
|
32 |
+
|
33 |
+
For example, if you distribute copies of such a program, whether
|
34 |
+
gratis or for a fee, you must give the recipients all the rights that
|
35 |
+
you have. You must make sure that they, too, receive or can get the
|
36 |
+
source code. And you must show them these terms so they know their
|
37 |
+
rights.
|
38 |
+
|
39 |
+
We protect your rights with two steps: (1) copyright the software, and
|
40 |
+
(2) offer you this license which gives you legal permission to copy,
|
41 |
+
distribute and/or modify the software.
|
42 |
+
|
43 |
+
Also, for each author's protection and ours, we want to make certain
|
44 |
+
that everyone understands that there is no warranty for this free
|
45 |
+
software. If the software is modified by someone else and passed on, we
|
46 |
+
want its recipients to know that what they have is not the original, so
|
47 |
+
that any problems introduced by others will not reflect on the original
|
48 |
+
authors' reputations.
|
49 |
+
|
50 |
+
Finally, any free program is threatened constantly by software
|
51 |
+
patents. We wish to avoid the danger that redistributors of a free
|
52 |
+
program will individually obtain patent licenses, in effect making the
|
53 |
+
program proprietary. To prevent this, we have made it clear that any
|
54 |
+
patent must be licensed for everyone's free use or not licensed at all.
|
55 |
+
|
56 |
+
The precise terms and conditions for copying, distribution and
|
57 |
+
modification follow.
|
58 |
+
|
59 |
+
GNU GENERAL PUBLIC LICENSE
|
60 |
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
61 |
+
|
62 |
+
0. This License applies to any program or other work which contains
|
63 |
+
a notice placed by the copyright holder saying it may be distributed
|
64 |
+
under the terms of this General Public License. The "Program", below,
|
65 |
+
refers to any such program or work, and a "work based on the Program"
|
66 |
+
means either the Program or any derivative work under copyright law:
|
67 |
+
that is to say, a work containing the Program or a portion of it,
|
68 |
+
either verbatim or with modifications and/or translated into another
|
69 |
+
language. (Hereinafter, translation is included without limitation in
|
70 |
+
the term "modification".) Each licensee is addressed as "you".
|
71 |
+
|
72 |
+
Activities other than copying, distribution and modification are not
|
73 |
+
covered by this License; they are outside its scope. The act of
|
74 |
+
running the Program is not restricted, and the output from the Program
|
75 |
+
is covered only if its contents constitute a work based on the
|
76 |
+
Program (independent of having been made by running the Program).
|
77 |
+
Whether that is true depends on what the Program does.
|
78 |
+
|
79 |
+
1. You may copy and distribute verbatim copies of the Program's
|
80 |
+
source code as you receive it, in any medium, provided that you
|
81 |
+
conspicuously and appropriately publish on each copy an appropriate
|
82 |
+
copyright notice and disclaimer of warranty; keep intact all the
|
83 |
+
notices that refer to this License and to the absence of any warranty;
|
84 |
+
and give any other recipients of the Program a copy of this License
|
85 |
+
along with the Program.
|
86 |
+
|
87 |
+
You may charge a fee for the physical act of transferring a copy, and
|
88 |
+
you may at your option offer warranty protection in exchange for a fee.
|
89 |
+
|
90 |
+
2. You may modify your copy or copies of the Program or any portion
|
91 |
+
of it, thus forming a work based on the Program, and copy and
|
92 |
+
distribute such modifications or work under the terms of Section 1
|
93 |
+
above, provided that you also meet all of these conditions:
|
94 |
+
|
95 |
+
a) You must cause the modified files to carry prominent notices
|
96 |
+
stating that you changed the files and the date of any change.
|
97 |
+
|
98 |
+
b) You must cause any work that you distribute or publish, that in
|
99 |
+
whole or in part contains or is derived from the Program or any
|
100 |
+
part thereof, to be licensed as a whole at no charge to all third
|
101 |
+
parties under the terms of this License.
|
102 |
+
|
103 |
+
c) If the modified program normally reads commands interactively
|
104 |
+
when run, you must cause it, when started running for such
|
105 |
+
interactive use in the most ordinary way, to print or display an
|
106 |
+
announcement including an appropriate copyright notice and a
|
107 |
+
notice that there is no warranty (or else, saying that you provide
|
108 |
+
a warranty) and that users may redistribute the program under
|
109 |
+
these conditions, and telling the user how to view a copy of this
|
110 |
+
License. (Exception: if the Program itself is interactive but
|
111 |
+
does not normally print such an announcement, your work based on
|
112 |
+
the Program is not required to print an announcement.)
|
113 |
+
|
114 |
+
These requirements apply to the modified work as a whole. If
|
115 |
+
identifiable sections of that work are not derived from the Program,
|
116 |
+
and can be reasonably considered independent and separate works in
|
117 |
+
themselves, then this License, and its terms, do not apply to those
|
118 |
+
sections when you distribute them as separate works. But when you
|
119 |
+
distribute the same sections as part of a whole which is a work based
|
120 |
+
on the Program, the distribution of the whole must be on the terms of
|
121 |
+
this License, whose permissions for other licensees extend to the
|
122 |
+
entire whole, and thus to each and every part regardless of who wrote it.
|
123 |
+
|
124 |
+
Thus, it is not the intent of this section to claim rights or contest
|
125 |
+
your rights to work written entirely by you; rather, the intent is to
|
126 |
+
exercise the right to control the distribution of derivative or
|
127 |
+
collective works based on the Program.
|
128 |
+
|
129 |
+
In addition, mere aggregation of another work not based on the Program
|
130 |
+
with the Program (or with a work based on the Program) on a volume of
|
131 |
+
a storage or distribution medium does not bring the other work under
|
132 |
+
the scope of this License.
|
133 |
+
|
134 |
+
3. You may copy and distribute the Program (or a work based on it,
|
135 |
+
under Section 2) in object code or executable form under the terms of
|
136 |
+
Sections 1 and 2 above provided that you also do one of the following:
|
137 |
+
|
138 |
+
a) Accompany it with the complete corresponding machine-readable
|
139 |
+
source code, which must be distributed under the terms of Sections
|
140 |
+
1 and 2 above on a medium customarily used for software interchange; or,
|
141 |
+
|
142 |
+
b) Accompany it with a written offer, valid for at least three
|
143 |
+
years, to give any third party, for a charge no more than your
|
144 |
+
cost of physically performing source distribution, a complete
|
145 |
+
machine-readable copy of the corresponding source code, to be
|
146 |
+
distributed under the terms of Sections 1 and 2 above on a medium
|
147 |
+
customarily used for software interchange; or,
|
148 |
+
|
149 |
+
c) Accompany it with the information you received as to the offer
|
150 |
+
to distribute corresponding source code. (This alternative is
|
151 |
+
allowed only for noncommercial distribution and only if you
|
152 |
+
received the program in object code or executable form with such
|
153 |
+
an offer, in accord with Subsection b above.)
|
154 |
+
|
155 |
+
The source code for a work means the preferred form of the work for
|
156 |
+
making modifications to it. For an executable work, complete source
|
157 |
+
code means all the source code for all modules it contains, plus any
|
158 |
+
associated interface definition files, plus the scripts used to
|
159 |
+
control compilation and installation of the executable. However, as a
|
160 |
+
special exception, the source code distributed need not include
|
161 |
+
anything that is normally distributed (in either source or binary
|
162 |
+
form) with the major components (compiler, kernel, and so on) of the
|
163 |
+
operating system on which the executable runs, unless that component
|
164 |
+
itself accompanies the executable.
|
165 |
+
|
166 |
+
If distribution of executable or object code is made by offering
|
167 |
+
access to copy from a designated place, then offering equivalent
|
168 |
+
access to copy the source code from the same place counts as
|
169 |
+
distribution of the source code, even though third parties are not
|
170 |
+
compelled to copy the source along with the object code.
|
171 |
+
|
172 |
+
4. You may not copy, modify, sublicense, or distribute the Program
|
173 |
+
except as expressly provided under this License. Any attempt
|
174 |
+
otherwise to copy, modify, sublicense or distribute the Program is
|
175 |
+
void, and will automatically terminate your rights under this License.
|
176 |
+
However, parties who have received copies, or rights, from you under
|
177 |
+
this License will not have their licenses terminated so long as such
|
178 |
+
parties remain in full compliance.
|
179 |
+
|
180 |
+
5. You are not required to accept this License, since you have not
|
181 |
+
signed it. However, nothing else grants you permission to modify or
|
182 |
+
distribute the Program or its derivative works. These actions are
|
183 |
+
prohibited by law if you do not accept this License. Therefore, by
|
184 |
+
modifying or distributing the Program (or any work based on the
|
185 |
+
Program), you indicate your acceptance of this License to do so, and
|
186 |
+
all its terms and conditions for copying, distributing or modifying
|
187 |
+
the Program or works based on it.
|
188 |
+
|
189 |
+
6. Each time you redistribute the Program (or any work based on the
|
190 |
+
Program), the recipient automatically receives a license from the
|
191 |
+
original licensor to copy, distribute or modify the Program subject to
|
192 |
+
these terms and conditions. You may not impose any further
|
193 |
+
restrictions on the recipients' exercise of the rights granted herein.
|
194 |
+
You are not responsible for enforcing compliance by third parties to
|
195 |
+
this License.
|
196 |
+
|
197 |
+
7. If, as a consequence of a court judgment or allegation of patent
|
198 |
+
infringement or for any other reason (not limited to patent issues),
|
199 |
+
conditions are imposed on you (whether by court order, agreement or
|
200 |
+
otherwise) that contradict the conditions of this License, they do not
|
201 |
+
excuse you from the conditions of this License. If you cannot
|
202 |
+
distribute so as to satisfy simultaneously your obligations under this
|
203 |
+
License and any other pertinent obligations, then as a consequence you
|
204 |
+
may not distribute the Program at all. For example, if a patent
|
205 |
+
license would not permit royalty-free redistribution of the Program by
|
206 |
+
all those who receive copies directly or indirectly through you, then
|
207 |
+
the only way you could satisfy both it and this License would be to
|
208 |
+
refrain entirely from distribution of the Program.
|
209 |
+
|
210 |
+
If any portion of this section is held invalid or unenforceable under
|
211 |
+
any particular circumstance, the balance of the section is intended to
|
212 |
+
apply and the section as a whole is intended to apply in other
|
213 |
+
circumstances.
|
214 |
+
|
215 |
+
It is not the purpose of this section to induce you to infringe any
|
216 |
+
patents or other property right claims or to contest validity of any
|
217 |
+
such claims; this section has the sole purpose of protecting the
|
218 |
+
integrity of the free software distribution system, which is
|
219 |
+
implemented by public license practices. Many people have made
|
220 |
+
generous contributions to the wide range of software distributed
|
221 |
+
through that system in reliance on consistent application of that
|
222 |
+
system; it is up to the author/donor to decide if he or she is willing
|
223 |
+
to distribute software through any other system and a licensee cannot
|
224 |
+
impose that choice.
|
225 |
+
|
226 |
+
This section is intended to make thoroughly clear what is believed to
|
227 |
+
be a consequence of the rest of this License.
|
228 |
+
|
229 |
+
8. If the distribution and/or use of the Program is restricted in
|
230 |
+
certain countries either by patents or by copyrighted interfaces, the
|
231 |
+
original copyright holder who places the Program under this License
|
232 |
+
may add an explicit geographical distribution limitation excluding
|
233 |
+
those countries, so that distribution is permitted only in or among
|
234 |
+
countries not thus excluded. In such case, this License incorporates
|
235 |
+
the limitation as if written in the body of this License.
|
236 |
+
|
237 |
+
9. The Free Software Foundation may publish revised and/or new versions
|
238 |
+
of the General Public License from time to time. Such new versions will
|
239 |
+
be similar in spirit to the present version, but may differ in detail to
|
240 |
+
address new problems or concerns.
|
241 |
+
|
242 |
+
Each version is given a distinguishing version number. If the Program
|
243 |
+
specifies a version number of this License which applies to it and "any
|
244 |
+
later version", you have the option of following the terms and conditions
|
245 |
+
either of that version or of any later version published by the Free
|
246 |
+
Software Foundation. If the Program does not specify a version number of
|
247 |
+
this License, you may choose any version ever published by the Free Software
|
248 |
+
Foundation.
|
249 |
+
|
250 |
+
10. If you wish to incorporate parts of the Program into other free
|
251 |
+
programs whose distribution conditions are different, write to the author
|
252 |
+
to ask for permission. For software which is copyrighted by the Free
|
253 |
+
Software Foundation, write to the Free Software Foundation; we sometimes
|
254 |
+
make exceptions for this. Our decision will be guided by the two goals
|
255 |
+
of preserving the free status of all derivatives of our free software and
|
256 |
+
of promoting the sharing and reuse of software generally.
|
257 |
+
|
258 |
+
NO WARRANTY
|
259 |
+
|
260 |
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
261 |
+
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
262 |
+
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
263 |
+
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
264 |
+
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
265 |
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
266 |
+
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
267 |
+
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
268 |
+
REPAIR OR CORRECTION.
|
269 |
+
|
270 |
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
271 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
272 |
+
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
273 |
+
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
274 |
+
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
275 |
+
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
276 |
+
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
277 |
+
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
278 |
+
POSSIBILITY OF SUCH DAMAGES.
|
279 |
+
|
280 |
+
END OF TERMS AND CONDITIONS
|
281 |
+
|
282 |
+
How to Apply These Terms to Your New Programs
|
283 |
+
|
284 |
+
If you develop a new program, and you want it to be of the greatest
|
285 |
+
possible use to the public, the best way to achieve this is to make it
|
286 |
+
free software which everyone can redistribute and change under these terms.
|
287 |
+
|
288 |
+
To do so, attach the following notices to the program. It is safest
|
289 |
+
to attach them to the start of each source file to most effectively
|
290 |
+
convey the exclusion of warranty; and each file should have at least
|
291 |
+
the "copyright" line and a pointer to where the full notice is found.
|
292 |
+
|
293 |
+
<one line to give the program's name and a brief idea of what it does.>
|
294 |
+
Copyright (C) <year> <name of author>
|
295 |
+
|
296 |
+
This program is free software; you can redistribute it and/or modify
|
297 |
+
it under the terms of the GNU General Public License as published by
|
298 |
+
the Free Software Foundation; either version 2 of the License, or
|
299 |
+
(at your option) any later version.
|
300 |
+
|
301 |
+
This program is distributed in the hope that it will be useful,
|
302 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
303 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
304 |
+
GNU General Public License for more details.
|
305 |
+
|
306 |
+
You should have received a copy of the GNU General Public License along
|
307 |
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
308 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
309 |
+
|
310 |
+
Also add information on how to contact you by electronic and paper mail.
|
311 |
+
|
312 |
+
If the program is interactive, make it output a short notice like this
|
313 |
+
when it starts in an interactive mode:
|
314 |
+
|
315 |
+
Gnomovision version 69, Copyright (C) year name of author
|
316 |
+
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
317 |
+
This is free software, and you are welcome to redistribute it
|
318 |
+
under certain conditions; type `show c' for details.
|
319 |
+
|
320 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
321 |
+
parts of the General Public License. Of course, the commands you use may
|
322 |
+
be called something other than `show w' and `show c'; they could even be
|
323 |
+
mouse-clicks or menu items--whatever suits your program.
|
324 |
+
|
325 |
+
You should also get your employer (if you work as a programmer) or your
|
326 |
+
school, if any, to sign a "copyright disclaimer" for the program, if
|
327 |
+
necessary. Here is a sample; alter the names:
|
328 |
+
|
329 |
+
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
330 |
+
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
331 |
+
|
332 |
+
<signature of Ty Coon>, 1 April 1989
|
333 |
+
Ty Coon, President of Vice
|
334 |
+
|
335 |
+
This General Public License does not permit incorporating your program into
|
336 |
+
proprietary programs. If your program is a subroutine library, you may
|
337 |
+
consider it more useful to permit linking proprietary applications with the
|
338 |
+
library. If this is what you want to do, use the GNU Lesser General
|
339 |
+
Public License instead of this License.
|
README.md
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Edit Author Slug [![Build Status](https://travis-ci.org/thebrandonallen/edit-author-slug.svg?branch=master)](https://travis-ci.org/thebrandonallen/edit-author-slug) #
|
2 |
+
**Contributors:** [thebrandonallen](https://profiles.wordpress.org/thebrandonallen)
|
3 |
+
**Tags:** author, author base, author slug, user nicename, nicename, permalink, permalinks, slug, users, user, role, roles
|
4 |
+
**Requires at least:** 4.4
|
5 |
+
**Tested up to:** 4.8
|
6 |
+
**Stable tag:** 1.5.2
|
7 |
+
**License:** GPLv2 or later
|
8 |
+
**License URI:** https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
9 |
+
|
10 |
+
Allows an admin (or capable user) to edit the author slug of a user, and change the author base.
|
11 |
+
|
12 |
+
## Description ##
|
13 |
+
|
14 |
+
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.
|
15 |
+
|
16 |
+
WordPress default structure *http://example.com/author/username/*.
|
17 |
+
|
18 |
+
Edit Author Slug allows for *http://example.com/ninja/master-ninja/*.
|
19 |
+
|
20 |
+
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).
|
21 |
+
|
22 |
+
Development of this plugin takes place on [GitHub](https://github.com/thebrandonallen/edit-author-slug/ "Edit Author Slug on Github"). Pull requests are always welcome!
|
23 |
+
|
24 |
+
Translations should be submitted to [Translate WordPress](https://translate.wordpress.org/projects/wp-plugins/edit-author-slug).
|
25 |
+
|
26 |
+
## Installation ##
|
27 |
+
|
28 |
+
1. Upload `edit-author-slug` folder to your WordPress plugins directory (typically 'wp-content/plugins')
|
29 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress
|
30 |
+
3. Go to Users > Your Profile, or Users > All Users > (username), and edit the author slug.
|
31 |
+
4. Click "Update Profile" or "Update User"
|
32 |
+
5. Go to Settings > Edit Author Slug to edit settings
|
33 |
+
6. Click "Save Changes"
|
34 |
+
|
35 |
+
## Screenshots ##
|
36 |
+
|
37 |
+
1. Settings
|
38 |
+
2. Individual user author slug
|
39 |
+
|
40 |
+
## Frequently Asked Questions ##
|
41 |
+
|
42 |
+
### What is an author slug? ###
|
43 |
+
|
44 |
+
On standard WordPress installs, it's the final part of an author permalink.
|
45 |
+
e.g. - https://example.com/author/author-slug/
|
46 |
+
|
47 |
+
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.
|
48 |
+
|
49 |
+
### Will my changes persist if I deactivate or delete the Edit Author Slug plugin? ###
|
50 |
+
|
51 |
+
It depends.
|
52 |
+
|
53 |
+
Changing a user's author slug is permanent, as this changes the user's `user_nicename` field in the database.
|
54 |
+
|
55 |
+
If you've changed the author base, deactivating or deleting the plugin will revert your author base back to `author`.
|
56 |
+
|
57 |
+
### Why can't I edit my Author Slug? ###
|
58 |
+
|
59 |
+
Make sure you are an admin, or have been assigned the `edit_users` capability.
|
60 |
+
|
61 |
+
### Why isn't my new Author Slug working? ###
|
62 |
+
|
63 |
+
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.
|
64 |
+
|
65 |
+
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.
|
66 |
+
|
67 |
+
## Changelog ##
|
68 |
+
|
69 |
+
### 1.5.2 ###
|
70 |
+
* Release date: 2017-06-21
|
71 |
+
* 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.
|
72 |
+
|
73 |
+
### 1.5.1 ###
|
74 |
+
* Release date: 2017-06-02
|
75 |
+
* Fix PHP notice when manually updating a user profile. Props @mydigitalsauce.
|
76 |
+
|
77 |
+
### 1.5.0 ###
|
78 |
+
* Release date: 2017-05-30
|
79 |
+
* Bumped minimum required WordPress version to 4.4.
|
80 |
+
* 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.
|
81 |
+
* This release is primarily an under-the-hood release with a number of optimizations and performance improvements.
|
82 |
+
|
83 |
+
### 1.4.1 ###
|
84 |
+
* Release date: 2017-04-24
|
85 |
+
* Fix failing string replacement in bulk update message.
|
86 |
+
|
87 |
+
### 1.4.0 ###
|
88 |
+
* Release date: 2017-04-04
|
89 |
+
* Lots of code cleanup to better adhere to WordPress Coding Standards.
|
90 |
+
* Improved performance of `ba_eas_sanitize_author_base()` by preventing unnecessary processing.
|
91 |
+
* Fixed an issue where the demo author permalink URL could have a double slash.
|
92 |
+
* Improvements to bulk update for sites with a large user base.
|
93 |
+
|
94 |
+
### 1.3.0 ###
|
95 |
+
* Release date: 2017-01-25
|
96 |
+
* Fix a potential bug where a sanitized author base could end up with double forward slashes.
|
97 |
+
* Introduce the `%ba_eas_author_role%` permalink structure tag. This can be used to customize role-based author bases.
|
98 |
+
* Bonus: All alternative facts are now free!
|
99 |
+
|
100 |
+
### 1.2.1 ###
|
101 |
+
* Release date: 2016-02-29
|
102 |
+
* Fixed stupid error where the default user nicename wasn't being properly retrieved from the database. Sorry about that :(
|
103 |
+
* Unfortunately, some unicorns were lost during the development of this release, but they are a resilient creature.
|
104 |
+
|
105 |
+
### 1.2.0 ###
|
106 |
+
* Release date: 2016-02-01
|
107 |
+
* Added the ability to use forward slashes in the author base.
|
108 |
+
* Improved display on the settings page, and storing, of role slugs.
|
109 |
+
* Packaged translations are now removed. Anyone interested in translating the plugin should do so at [Translate WordPress](https://translate.wordpress.org/projects/wp-plugins/edit-author-slug).
|
110 |
+
* 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).
|
111 |
+
* Added ability to remove the front portion of author links.
|
112 |
+
* Accessibility improvements to the settings page.
|
113 |
+
|
114 |
+
### Full Changelog ###
|
115 |
+
* https://github.com/thebrandonallen/edit-author-slug/blob/master/CHANGELOG.md
|
edit-author-slug.php
CHANGED
@@ -7,533 +7,35 @@
|
|
7 |
* Author URI: https://github.com/thebrandonallen/
|
8 |
* Text Domain: edit-author-slug
|
9 |
* Domain Path: /languages
|
10 |
-
* Version: 1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
*
|
12 |
* @package Edit_Author_Slug
|
13 |
* @subpackage Main
|
14 |
* @author Brandon Allen
|
15 |
-
* @version 1.
|
16 |
*/
|
17 |
|
18 |
-
/*
|
19 |
-
Copyright (C) 2009-2017 Brandon Allen (email : plugins ([at]) brandonallen ([dot]) me)
|
20 |
-
|
21 |
-
This program is free software; you can redistribute it and/or modify
|
22 |
-
it under the terms of the GNU General Public License as published by
|
23 |
-
the Free Software Foundation; either version 2 of the License, or
|
24 |
-
(at your option) any later version.
|
25 |
-
|
26 |
-
This program is distributed in the hope that it will be useful,
|
27 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
28 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
29 |
-
GNU General Public License for more details.
|
30 |
-
|
31 |
-
You should have received a copy of the GNU General Public License
|
32 |
-
along with this program; if not, write to the Free Software
|
33 |
-
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
34 |
-
|
35 |
-
https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
36 |
-
*/
|
37 |
-
|
38 |
// Exit if accessed directly.
|
39 |
defined( 'ABSPATH' ) || exit;
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
*/
|
44 |
-
if ( ! class_exists( 'BA_Edit_Author_Slug' ) ) :
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Final BA_Edit_Author_Slug class.
|
48 |
-
*
|
49 |
-
* @since 0.1.0
|
50 |
-
*
|
51 |
-
* @final
|
52 |
-
*/
|
53 |
-
final class BA_Edit_Author_Slug {
|
54 |
-
|
55 |
-
/**
|
56 |
-
* The plugin version.
|
57 |
-
*
|
58 |
-
* @since 1.4.0
|
59 |
-
* @var string
|
60 |
-
*/
|
61 |
-
const VERSION = '1.4.1';
|
62 |
-
|
63 |
-
/**
|
64 |
-
* The plugin version.
|
65 |
-
*
|
66 |
-
* @since 1.4.0
|
67 |
-
* @var int
|
68 |
-
*/
|
69 |
-
const DB_VERSION = 411;
|
70 |
-
|
71 |
-
/**
|
72 |
-
* The current installed database version.
|
73 |
-
*
|
74 |
-
* @since 0.8.0
|
75 |
-
* @access public
|
76 |
-
* @var int
|
77 |
-
*/
|
78 |
-
public $current_db_version = 0;
|
79 |
-
|
80 |
-
/**
|
81 |
-
* The path to this file.
|
82 |
-
*
|
83 |
-
* @since 0.7.0
|
84 |
-
* @access public
|
85 |
-
* @var string
|
86 |
-
*/
|
87 |
-
public $file = __FILE__;
|
88 |
-
|
89 |
-
/**
|
90 |
-
* The path to the Edit AUthor Slug directory.
|
91 |
-
*
|
92 |
-
* @since 0.7.0
|
93 |
-
* @access public
|
94 |
-
* @var string
|
95 |
-
*/
|
96 |
-
public $plugin_dir = '';
|
97 |
-
|
98 |
-
/**
|
99 |
-
* The URL for the Edit Author Slug directory.
|
100 |
-
*
|
101 |
-
* @since 0.7.0
|
102 |
-
* @access public
|
103 |
-
* @var string
|
104 |
-
*/
|
105 |
-
public $plugin_url = '';
|
106 |
-
|
107 |
-
/**
|
108 |
-
* The basename for the Edit Author Slug directory.
|
109 |
-
*
|
110 |
-
* @since 0.8.0
|
111 |
-
* @access public
|
112 |
-
* @var string
|
113 |
-
*/
|
114 |
-
public $plugin_basename = '';
|
115 |
-
|
116 |
-
/**
|
117 |
-
* The author base.
|
118 |
-
*
|
119 |
-
* @since 0.7.0
|
120 |
-
* @access public
|
121 |
-
* @var string
|
122 |
-
*/
|
123 |
-
public $author_base = 'author';
|
124 |
-
|
125 |
-
/**
|
126 |
-
* The remove front option.
|
127 |
-
*
|
128 |
-
* @since 1.2.0
|
129 |
-
* @access public
|
130 |
-
* @var bool
|
131 |
-
*/
|
132 |
-
public $remove_front = false;
|
133 |
-
|
134 |
-
/**
|
135 |
-
* The auto update option.
|
136 |
-
*
|
137 |
-
* @since 1.0.0
|
138 |
-
* @access public
|
139 |
-
* @var bool
|
140 |
-
*/
|
141 |
-
public $do_auto_update = false;
|
142 |
-
|
143 |
-
/**
|
144 |
-
* The default user nicename option.
|
145 |
-
*
|
146 |
-
* @since 1.0.0
|
147 |
-
* @access public
|
148 |
-
* @var string
|
149 |
-
*/
|
150 |
-
public $default_user_nicename = 'username';
|
151 |
-
|
152 |
-
/**
|
153 |
-
* The role-based option.
|
154 |
-
*
|
155 |
-
* @since 1.0.0
|
156 |
-
* @access public
|
157 |
-
* @var bool
|
158 |
-
*/
|
159 |
-
public $do_role_based = false;
|
160 |
-
|
161 |
-
/**
|
162 |
-
* The role slugs array.
|
163 |
-
*
|
164 |
-
* @since 1.0.0
|
165 |
-
* @access public
|
166 |
-
* @var array
|
167 |
-
*/
|
168 |
-
public $role_slugs = array();
|
169 |
-
|
170 |
-
/** Singleton *********************************************************/
|
171 |
-
|
172 |
-
/**
|
173 |
-
* Main BA_Edit_Author_Slug Instance
|
174 |
-
*
|
175 |
-
* Insures that only one instance of BA_Edit_Author_Slug exists in memory
|
176 |
-
* at any one time. Also prevents needing to define globals all over the
|
177 |
-
* place.
|
178 |
-
*
|
179 |
-
* @since 1.0.0
|
180 |
-
*
|
181 |
-
* @staticvar object $instance
|
182 |
-
*
|
183 |
-
* @see ba_eas()
|
184 |
-
*
|
185 |
-
* @return BA_Edit_Author_Slug|null The one true BA_Edit_Author_Slug.
|
186 |
-
*/
|
187 |
-
public static function instance() {
|
188 |
-
|
189 |
-
// Store the instance locally to avoid private static replication.
|
190 |
-
static $instance = null;
|
191 |
-
|
192 |
-
// Only run these methods if they haven't been ran previously.
|
193 |
-
if ( null === $instance ) {
|
194 |
-
$instance = new self;
|
195 |
-
}
|
196 |
-
|
197 |
-
// Always return the instance.
|
198 |
-
return $instance;
|
199 |
-
}
|
200 |
-
|
201 |
-
/**
|
202 |
-
* The constructor.
|
203 |
-
*
|
204 |
-
* @since 1.4.0
|
205 |
-
*/
|
206 |
-
public function __construct() {
|
207 |
-
$this->setup_globals();
|
208 |
-
$this->includes();
|
209 |
-
$this->setup_options();
|
210 |
-
$this->setup_actions();
|
211 |
-
}
|
212 |
-
|
213 |
-
/**
|
214 |
-
* Magic method for accessing custom/deprecated/nonexistent properties.
|
215 |
-
*
|
216 |
-
* @since 1.4.0
|
217 |
-
*
|
218 |
-
* @param string $name The property name.
|
219 |
-
*
|
220 |
-
* @return mixed
|
221 |
-
*/
|
222 |
-
public function __get( $name ) {
|
223 |
-
|
224 |
-
// Default to null.
|
225 |
-
$retval = null;
|
226 |
-
|
227 |
-
if ( 'version' === $name ) {
|
228 |
-
// BA_Edit_Author_Slug->version was removed in 1.4.0.
|
229 |
-
$retval = self::VERSION;
|
230 |
-
} elseif ( 'db_version' === $name ) {
|
231 |
-
// BA_Edit_Author_Slug->db_version was removed in 1.4.0.
|
232 |
-
$retval = self::DB_VERSION;
|
233 |
-
}
|
234 |
-
|
235 |
-
return $retval;
|
236 |
-
}
|
237 |
-
|
238 |
-
/**
|
239 |
-
* Magic method to prevent notices and errors from invalid method calls.
|
240 |
-
*
|
241 |
-
* @since 1.0.0
|
242 |
-
*
|
243 |
-
* @param string $name The method name being called.
|
244 |
-
* @param array $args The method arguments.
|
245 |
-
*
|
246 |
-
* @return null
|
247 |
-
*/
|
248 |
-
public function __call( $name = '', $args = array() ) {
|
249 |
-
|
250 |
-
if ( 'author_base_rewrite' === $name ) {
|
251 |
-
_deprecated_function( 'BA_Edit_Author_Slug::author_base_rewrite', '1.2.0', 'ba_eas_wp_rewrite_overrides' );
|
252 |
-
ba_eas_wp_rewrite_overrides();
|
253 |
-
} else {
|
254 |
-
_doing_it_wrong(
|
255 |
-
esc_html( "BA_Edit_Author_Slug::{$name}" ),
|
256 |
-
esc_html__( 'Method does not exist.', 'edit-author-slug' ),
|
257 |
-
'1.0.0'
|
258 |
-
);
|
259 |
-
}
|
260 |
-
|
261 |
-
unset( $name, $args );
|
262 |
-
return null;
|
263 |
-
}
|
264 |
-
|
265 |
-
/** Magic Methods *****************************************************/
|
266 |
-
|
267 |
-
/**
|
268 |
-
* A dummy magic method to prevent BA_Edit_Author_Slug from being cloned.
|
269 |
-
*
|
270 |
-
* @since 1.0.0
|
271 |
-
*
|
272 |
-
* @codeCoverageIgnore
|
273 |
-
*
|
274 |
-
* @return void
|
275 |
-
*/
|
276 |
-
private function __clone() {
|
277 |
-
_doing_it_wrong(
|
278 |
-
__FUNCTION__,
|
279 |
-
esc_html__( 'Cheatin’ huh?', 'edit-author-slug' ),
|
280 |
-
'1.0'
|
281 |
-
);
|
282 |
-
}
|
283 |
-
|
284 |
-
/**
|
285 |
-
* A dummy magic method to prevent BA_Edit_Author_Slug from being unserialized.
|
286 |
-
*
|
287 |
-
* @since 1.0.0
|
288 |
-
*
|
289 |
-
* @codeCoverageIgnore
|
290 |
-
*
|
291 |
-
* @return void
|
292 |
-
*/
|
293 |
-
private function __wakeup() {
|
294 |
-
_doing_it_wrong(
|
295 |
-
__FUNCTION__,
|
296 |
-
esc_html__( 'Cheatin’ huh?', 'edit-author-slug' ),
|
297 |
-
'1.0'
|
298 |
-
);
|
299 |
-
}
|
300 |
-
|
301 |
-
/* Private Methods ****************************************************/
|
302 |
-
|
303 |
-
/**
|
304 |
-
* Edit Author Slug global variables.
|
305 |
-
*
|
306 |
-
* @since 0.7.0
|
307 |
-
*
|
308 |
-
* @return void
|
309 |
-
*/
|
310 |
-
private function setup_globals() {
|
311 |
-
|
312 |
-
/* Paths **********************************************************/
|
313 |
-
|
314 |
-
$this->plugin_dir = plugin_dir_path( $this->file );
|
315 |
-
$this->plugin_url = plugin_dir_url( $this->file );
|
316 |
-
$this->plugin_basename = plugin_basename( $this->file );
|
317 |
-
|
318 |
-
/* Options ********************************************************/
|
319 |
-
|
320 |
-
// Load the remove front option.
|
321 |
-
$remove_front = (int) get_option( '_ba_eas_remove_front', 0 );
|
322 |
-
$this->remove_front = (bool) $remove_front;
|
323 |
-
|
324 |
-
// Load auto-update option.
|
325 |
-
$do_auto_update = (int) get_option( '_ba_eas_do_auto_update', 0 );
|
326 |
-
$this->do_auto_update = (bool) $do_auto_update;
|
327 |
-
|
328 |
-
// Load the default nicename structure for auto-update.
|
329 |
-
$default_user_nicename = get_option( '_ba_eas_default_user_nicename' );
|
330 |
-
$default_user_nicename = sanitize_key( $default_user_nicename );
|
331 |
-
if ( ! empty( $default_user_nicename ) ) {
|
332 |
-
$this->default_user_nicename = $default_user_nicename;
|
333 |
-
}
|
334 |
-
|
335 |
-
// Load role-based author slug option.
|
336 |
-
$do_role_based = (int) get_option( '_ba_eas_do_role_based', 0 );
|
337 |
-
$this->do_role_based = (bool) $do_role_based;
|
338 |
-
}
|
339 |
-
|
340 |
-
/**
|
341 |
-
* Include necessary files.
|
342 |
-
*
|
343 |
-
* @since 0.7.0
|
344 |
-
*
|
345 |
-
* @return void
|
346 |
-
*/
|
347 |
-
private function includes() {
|
348 |
-
|
349 |
-
// Load the core functions.
|
350 |
-
require_once( $this->plugin_dir . 'includes/functions.php' );
|
351 |
-
require_once( $this->plugin_dir . 'includes/hooks.php' );
|
352 |
-
|
353 |
-
// Maybe load the admin functions.
|
354 |
-
if ( is_admin() ) {
|
355 |
-
require_once( $this->plugin_dir . 'includes/admin.php' );
|
356 |
-
}
|
357 |
-
}
|
358 |
-
|
359 |
-
/**
|
360 |
-
* Get our options from the DB and set their corresponding properties.
|
361 |
-
*
|
362 |
-
* @since 1.4.0
|
363 |
-
*
|
364 |
-
* @return void
|
365 |
-
*/
|
366 |
-
private function setup_options() {
|
367 |
-
|
368 |
-
// Get the author base option.
|
369 |
-
$base = get_option( '_ba_eas_author_base' );
|
370 |
-
|
371 |
-
// Options.
|
372 |
-
if ( $base ) {
|
373 |
-
|
374 |
-
// Sanitize the db value.
|
375 |
-
$this->author_base = ba_eas_sanitize_author_base( $base );
|
376 |
-
|
377 |
-
// Current DB version.
|
378 |
-
$this->current_db_version = (int) get_option( '_ba_eas_db_version', 0 );
|
379 |
-
|
380 |
-
return;
|
381 |
-
}
|
382 |
-
|
383 |
-
// If we're still here, check for pre-0.9 options.
|
384 |
-
$this->options_back_compat();
|
385 |
-
}
|
386 |
-
|
387 |
-
/**
|
388 |
-
* Display Author slug edit field on User/Profile edit page.
|
389 |
-
*
|
390 |
-
* @since 0.7.0
|
391 |
-
*
|
392 |
-
* @return void
|
393 |
-
*/
|
394 |
-
private function setup_actions() {
|
395 |
-
// Register Edit Author Slug activation/deactivation sequences.
|
396 |
-
register_activation_hook( $this->file, 'ba_eas_activation' );
|
397 |
-
register_deactivation_hook( $this->file, 'ba_eas_deactivation' );
|
398 |
-
|
399 |
-
// Author Base Actions.
|
400 |
-
add_action( 'after_setup_theme', array( $this, 'set_role_slugs' ) );
|
401 |
-
add_action( 'init', 'ba_eas_wp_rewrite_overrides', 4 );
|
402 |
-
add_action( 'init', array( $this, 'add_rewrite_tags' ), 20 );
|
403 |
-
|
404 |
-
// Localize.
|
405 |
-
add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
|
406 |
-
}
|
407 |
-
|
408 |
-
/**
|
409 |
-
* Sets the author base and db version with support for previous
|
410 |
-
* versions of the plugin.
|
411 |
-
*
|
412 |
-
* @since 1.2.0
|
413 |
-
*
|
414 |
-
* @return void
|
415 |
-
*/
|
416 |
-
private function options_back_compat() {
|
417 |
-
|
418 |
-
// Get the pre-0.9 options.
|
419 |
-
$options = get_option( 'ba_edit_author_slug' );
|
420 |
-
|
421 |
-
// Sanitize the db value.
|
422 |
-
if ( ! empty( $options['author_base'] ) ) {
|
423 |
-
$this->author_base = ba_eas_sanitize_author_base( $options['author_base'] );
|
424 |
-
}
|
425 |
-
|
426 |
-
// Current DB version.
|
427 |
-
if ( ! empty( $options['db_version'] ) ) {
|
428 |
-
$this->current_db_version = (int) $options['db_version'];
|
429 |
-
}
|
430 |
-
}
|
431 |
-
|
432 |
-
/** Public Methods ****************************************************/
|
433 |
-
|
434 |
-
/**
|
435 |
-
* Load the translation file for current language. Checks the Edit Author
|
436 |
-
* Slug languages folder first, then inside the default WP language
|
437 |
-
* plugins folder.
|
438 |
-
*
|
439 |
-
* Note that custom translation files inside the Edit Author Slug plugin
|
440 |
-
* folder will be removed on edit-author-slug updates. If you're creating
|
441 |
-
* custom translation files, please use the global language folder
|
442 |
-
* (ie - wp-content/languages/plugins).
|
443 |
-
*
|
444 |
-
* @since 0.9.6
|
445 |
-
*
|
446 |
-
* @return void
|
447 |
-
*/
|
448 |
-
public function load_textdomain() {
|
449 |
-
|
450 |
-
// Look in wp-content/plugins/edit-author-slug/languages first.
|
451 |
-
// Fallback to wp-content/languages/plugins.
|
452 |
-
load_plugin_textdomain( 'edit-author-slug', false, dirname( $this->plugin_basename ) . '/languages/' );
|
453 |
-
}
|
454 |
-
|
455 |
-
/**
|
456 |
-
* Set the role_slugs global
|
457 |
-
*
|
458 |
-
* @since 1.0.0
|
459 |
-
*
|
460 |
-
* @return void
|
461 |
-
*/
|
462 |
-
public function set_role_slugs() {
|
463 |
-
|
464 |
-
// Get the default role slugs.
|
465 |
-
$defaults = ba_eas_get_default_role_slugs();
|
466 |
-
|
467 |
-
// Merge system roles with any customizations we may have.
|
468 |
-
$role_slugs = array_replace_recursive(
|
469 |
-
$defaults,
|
470 |
-
get_option( '_ba_eas_role_slugs', array() )
|
471 |
-
);
|
472 |
-
|
473 |
-
foreach ( $role_slugs as $role => $details ) {
|
474 |
-
|
475 |
-
if ( empty( $defaults[ $role ] ) ) {
|
476 |
-
unset( $role_slugs[ $role ] );
|
477 |
-
}
|
478 |
-
}
|
479 |
-
|
480 |
-
$this->role_slugs = $role_slugs;
|
481 |
-
}
|
482 |
-
|
483 |
-
/** Custom Rewrite Rules **********************************************/
|
484 |
-
|
485 |
-
/**
|
486 |
-
* Add the Edit Author Slug rewrite tags
|
487 |
-
*
|
488 |
-
* @since 1.0.0
|
489 |
-
*
|
490 |
-
* @return void
|
491 |
-
*/
|
492 |
-
public function add_rewrite_tags() {
|
493 |
-
|
494 |
-
// Should we be here?
|
495 |
-
if ( ! ba_eas_do_role_based_author_base() ) {
|
496 |
-
return;
|
497 |
-
}
|
498 |
-
|
499 |
-
// Get the role slugs to add the rewrite tag.
|
500 |
-
$role_slugs = wp_list_pluck( $this->role_slugs, 'slug' );
|
501 |
-
$role_slugs = array_filter( array_values( $role_slugs ) );
|
502 |
-
|
503 |
-
// Grab the author base.
|
504 |
-
$author_base = ba_eas()->author_base;
|
505 |
-
|
506 |
-
// Add a fallback.
|
507 |
-
if ( false === strpos( $author_base, '%ba_eas_author_role%' ) && false === strpos( $author_base, '/' ) ) {
|
508 |
-
$role_slugs[] = $author_base;
|
509 |
-
} else {
|
510 |
-
$role_slugs[] = 'author';
|
511 |
-
}
|
512 |
-
|
513 |
-
// Add the role-based rewrite tag, and the expected role slugs.
|
514 |
-
add_rewrite_tag( '%ba_eas_author_role%', '(' . implode( '|', array_unique( $role_slugs ) ) . ')' );
|
515 |
-
}
|
516 |
-
}
|
517 |
-
|
518 |
-
/**
|
519 |
-
* The main function responsible for returning the one true BA_Edit_Author_Slug
|
520 |
-
* Instance to functions everywhere.
|
521 |
-
*
|
522 |
-
* Use this function like you would a global variable, except without needing
|
523 |
-
* to declare the global.
|
524 |
-
*
|
525 |
-
* Example: <?php $ba_eas = ba_eas(); ?>
|
526 |
-
*
|
527 |
-
* @return BA_Edit_Author_Slug|null The one true BA_Edit_Author_Slug Instance.
|
528 |
-
*/
|
529 |
-
function ba_eas() {
|
530 |
-
return BA_Edit_Author_Slug::instance();
|
531 |
-
}
|
532 |
-
|
533 |
-
// Places everyone! The show is starting!
|
534 |
-
ba_eas();
|
535 |
-
|
536 |
-
endif; // End class BA_Edit_Author_Slug.
|
537 |
|
538 |
/**
|
539 |
* Runs on Edit Author Slug activation.
|
@@ -551,6 +53,7 @@ function ba_eas_activation() {
|
|
551 |
*/
|
552 |
do_action( 'ba_eas_activation' );
|
553 |
}
|
|
|
554 |
|
555 |
/**
|
556 |
* Runs on Edit Author Slug deactivation.
|
@@ -568,3 +71,22 @@ function ba_eas_deactivation() {
|
|
568 |
*/
|
569 |
do_action( 'ba_eas_deactivation' );
|
570 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
* Author URI: https://github.com/thebrandonallen/
|
8 |
* Text Domain: edit-author-slug
|
9 |
* Domain Path: /languages
|
10 |
+
* Version: 1.5.2
|
11 |
+
*
|
12 |
+
* Copyright (C) 2009-2017 Brandon Allen (https://github.com/thebrandonallen)
|
13 |
+
*
|
14 |
+
* This program is free software; you can redistribute it and/or modify
|
15 |
+
* it under the terms of the GNU General Public License as published by
|
16 |
+
* the Free Software Foundation; either version 2 of the License, or
|
17 |
+
* (at your option) any later version.
|
18 |
+
*
|
19 |
+
* This program is distributed in the hope that it will be useful,
|
20 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
+
* GNU General Public License for more details.
|
23 |
+
*
|
24 |
+
* You should have received a copy of the GNU General Public License along
|
25 |
+
* with this program; if not, write to the Free Software Foundation, Inc.,
|
26 |
+
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
27 |
*
|
28 |
* @package Edit_Author_Slug
|
29 |
* @subpackage Main
|
30 |
* @author Brandon Allen
|
31 |
+
* @version 1.5.2
|
32 |
*/
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
// Exit if accessed directly.
|
35 |
defined( 'ABSPATH' ) || exit;
|
36 |
|
37 |
+
// Load the plugin class file.
|
38 |
+
require 'includes/classes/class-edit-author-slug.php';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
/**
|
41 |
* Runs on Edit Author Slug activation.
|
53 |
*/
|
54 |
do_action( 'ba_eas_activation' );
|
55 |
}
|
56 |
+
register_activation_hook( __FILE__, 'ba_eas_activation' );
|
57 |
|
58 |
/**
|
59 |
* Runs on Edit Author Slug deactivation.
|
71 |
*/
|
72 |
do_action( 'ba_eas_deactivation' );
|
73 |
}
|
74 |
+
register_deactivation_hook( __FILE__, 'ba_eas_deactivation' );
|
75 |
+
|
76 |
+
/**
|
77 |
+
* The main function responsible for returning the one true BA_Edit_Author_Slug
|
78 |
+
* Instance to functions everywhere.
|
79 |
+
*
|
80 |
+
* Use this function like you would a global variable, except without needing
|
81 |
+
* to declare the global.
|
82 |
+
*
|
83 |
+
* Example: <?php $ba_eas = ba_eas(); ?>
|
84 |
+
*
|
85 |
+
* @return BA_Edit_Author_Slug The one true BA_Edit_Author_Slug Instance.
|
86 |
+
*/
|
87 |
+
function ba_eas() {
|
88 |
+
return BA_Edit_Author_Slug::instance();
|
89 |
+
}
|
90 |
+
|
91 |
+
ba_eas();
|
92 |
+
ba_eas()->setup_actions();
|
includes/admin.php
CHANGED
@@ -69,7 +69,7 @@ function ba_eas_show_user_nicename( $user ) {
|
|
69 |
<th scope="row"><?php esc_html_e( 'Author Slug', 'edit-author-slug' ); ?></th>
|
70 |
<td>
|
71 |
<fieldset><legend class="screen-reader-text"><span><?php esc_html_e( 'Author Slug', 'edit-author-slug' ); ?></span></legend>
|
72 |
-
<?php foreach ( (array) $options as $item )
|
73 |
|
74 |
// Checked?
|
75 |
$checked_text = checked( $item, $nicename, false );
|
@@ -83,7 +83,7 @@ function ba_eas_show_user_nicename( $user ) {
|
|
83 |
<input type="radio" id="ba_eas_author_slug" name="ba_eas_author_slug" value="<?php echo ba_eas_esc_nicename( $item ); ?>" autocapitalize="none" autocorrect="off" maxlength="50"<?php echo $checked_text; ?>>
|
84 |
<span><?php echo ba_eas_esc_nicename( $item ); ?></span>
|
85 |
</label><br />
|
86 |
-
<?php
|
87 |
<label for="ba_eas_author_slug_custom_radio">
|
88 |
<input type="radio" id="ba_eas_author_slug_custom_radio" name="ba_eas_author_slug" value="\c\u\s\t\o\m" autocapitalize="none" autocorrect="off" maxlength="50"<?php checked( $checked ); ?>>
|
89 |
<?php esc_html_e( 'Custom:', 'edit-author-slug' ); ?>
|
@@ -109,18 +109,10 @@ function ba_eas_show_user_nicename( $user ) {
|
|
109 |
*
|
110 |
* @param WP_Errors $errors The WP_Errors object.
|
111 |
* @param bool $update True if user is being updated.
|
112 |
-
* @param
|
113 |
*/
|
114 |
function ba_eas_update_user_nicename( $errors, $update, $user ) {
|
115 |
|
116 |
-
// Bail early if user can't edit the slug.
|
117 |
-
if ( ! ba_eas_can_edit_author_slug() ) {
|
118 |
-
return;
|
119 |
-
}
|
120 |
-
|
121 |
-
// Don't run the auto-update if the current user can update their own nicename.
|
122 |
-
remove_action( 'profile_update', 'ba_eas_auto_update_user_nicename' );
|
123 |
-
|
124 |
// We shouldn't be here if we're not updating.
|
125 |
if ( ! $update ) {
|
126 |
return;
|
@@ -131,12 +123,19 @@ function ba_eas_update_user_nicename( $errors, $update, $user ) {
|
|
131 |
return;
|
132 |
}
|
133 |
|
|
|
|
|
|
|
|
|
|
|
134 |
// Check the nonce.
|
135 |
check_admin_referer( 'update-user_' . $user->ID );
|
136 |
|
137 |
-
//
|
138 |
-
|
139 |
|
|
|
|
|
140 |
$user_nicename = '';
|
141 |
$user_nicename_custom = '';
|
142 |
|
@@ -191,11 +190,8 @@ function ba_eas_update_user_nicename( $errors, $update, $user ) {
|
|
191 |
$ascii
|
192 |
) );
|
193 |
|
194 |
-
// Was the nicename filtered?
|
195 |
-
$changed = ( $raw_nicename_sanitized !== $user_nicename );
|
196 |
-
|
197 |
// Reset `$ascii` if the nicename was filtered.
|
198 |
-
if ( $
|
199 |
$ascii = ba_eas_nicename_is_ascii( $user_nicename );
|
200 |
}
|
201 |
|
@@ -226,38 +222,40 @@ function ba_eas_update_user_nicename( $errors, $update, $user ) {
|
|
226 |
return;
|
227 |
}
|
228 |
|
229 |
-
//
|
230 |
-
if ( $user_nicename
|
|
|
|
|
231 |
|
232 |
-
|
233 |
-
|
234 |
-
if ( $exists && (int) $exists->ID !== $user->ID ) {
|
235 |
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
|
252 |
-
|
253 |
-
|
254 |
|
255 |
-
|
256 |
-
|
257 |
|
258 |
-
|
259 |
-
|
260 |
-
|
|
|
261 |
}
|
262 |
|
263 |
/**
|
@@ -273,7 +271,7 @@ function ba_eas_can_edit_author_slug() {
|
|
273 |
$retval = false;
|
274 |
|
275 |
// True if user is allowed to edit the author slug.
|
276 |
-
if (
|
277 |
$retval = true;
|
278 |
}
|
279 |
|
@@ -367,7 +365,7 @@ function ba_eas_show_user_nicename_scripts( $hook_suffix = '' ) {
|
|
367 |
'edit-author-slug',
|
368 |
ba_eas()->plugin_url . "js/edit-author-slug{$min}.js",
|
369 |
array( 'jquery' ),
|
370 |
-
|
371 |
);
|
372 |
wp_enqueue_script( 'edit-author-slug' );
|
373 |
}
|
@@ -581,7 +579,7 @@ function ba_eas_admin_setting_callback_auto_update_section() {
|
|
581 |
*/
|
582 |
function ba_eas_admin_setting_callback_author_base() {
|
583 |
|
584 |
-
$author_base =
|
585 |
$front = trim( $GLOBALS['wp_rewrite']->front, '/' );
|
586 |
|
587 |
// Add the trailing slash back if `$front` isn't empty.
|
@@ -775,9 +773,9 @@ function ba_eas_admin_setting_callback_default_user_nicename() {
|
|
775 |
|
776 |
<span class="screen-reader-text"><?php esc_html_e( 'Default author slug options', 'edit-author-slug' ); ?></span>
|
777 |
<select id="_ba_eas_default_user_nicename" name="_ba_eas_default_user_nicename">
|
778 |
-
<?php foreach ( (array) $options as $id => $item )
|
779 |
<option id="<?php echo esc_attr( $id ); ?>" value="<?php echo esc_attr( $id ); ?>"<?php selected( $structure, $id ); ?>><?php echo esc_html( $item ); ?></option>
|
780 |
-
<?php
|
781 |
</select>
|
782 |
|
783 |
<?php
|
@@ -835,9 +833,9 @@ function ba_eas_admin_setting_callback_bulk_update_structure() {
|
|
835 |
|
836 |
<span class="screen-reader-text"><?php esc_html_e( 'Default bulk update author slug options', 'edit-author-slug' ); ?></span>
|
837 |
<select id="_ba_eas_bulk_update_structure" name="_ba_eas_bulk_update_structure">
|
838 |
-
<?php foreach ( (array) $options as $id => $item )
|
839 |
<option id="<?php echo esc_attr( $id ); ?>" value="<?php echo esc_attr( $id ); ?>"<?php selected( $structure, $id ); ?>><?php echo esc_html( $item ); ?></option>
|
840 |
-
<?php
|
841 |
</select>
|
842 |
|
843 |
<?php
|
@@ -958,7 +956,7 @@ function ba_eas_install() {
|
|
958 |
|
959 |
// Add the options.
|
960 |
add_option( '_ba_eas_author_base', $ba_eas->author_base );
|
961 |
-
add_option( '_ba_eas_db_version',
|
962 |
add_option( '_ba_eas_do_auto_update', (int) $ba_eas->do_auto_update );
|
963 |
add_option( '_ba_eas_default_user_nicename', $ba_eas->default_user_nicename );
|
964 |
add_option( '_ba_eas_do_role_based', (int) $ba_eas->do_role_based );
|
@@ -979,7 +977,7 @@ function ba_eas_upgrade() {
|
|
979 |
$ba_eas = ba_eas();
|
980 |
|
981 |
// We're up-to-date, so let's move on.
|
982 |
-
if ( $ba_eas->current_db_version ===
|
983 |
return;
|
984 |
}
|
985 |
|
@@ -1007,7 +1005,7 @@ function ba_eas_upgrade() {
|
|
1007 |
}
|
1008 |
|
1009 |
// Version bump.
|
1010 |
-
update_option( '_ba_eas_db_version',
|
1011 |
|
1012 |
// Courtesy flush.
|
1013 |
ba_eas_flush_rewrite_rules();
|
69 |
<th scope="row"><?php esc_html_e( 'Author Slug', 'edit-author-slug' ); ?></th>
|
70 |
<td>
|
71 |
<fieldset><legend class="screen-reader-text"><span><?php esc_html_e( 'Author Slug', 'edit-author-slug' ); ?></span></legend>
|
72 |
+
<?php foreach ( (array) $options as $item ) :
|
73 |
|
74 |
// Checked?
|
75 |
$checked_text = checked( $item, $nicename, false );
|
83 |
<input type="radio" id="ba_eas_author_slug" name="ba_eas_author_slug" value="<?php echo ba_eas_esc_nicename( $item ); ?>" autocapitalize="none" autocorrect="off" maxlength="50"<?php echo $checked_text; ?>>
|
84 |
<span><?php echo ba_eas_esc_nicename( $item ); ?></span>
|
85 |
</label><br />
|
86 |
+
<?php endforeach; ?>
|
87 |
<label for="ba_eas_author_slug_custom_radio">
|
88 |
<input type="radio" id="ba_eas_author_slug_custom_radio" name="ba_eas_author_slug" value="\c\u\s\t\o\m" autocapitalize="none" autocorrect="off" maxlength="50"<?php checked( $checked ); ?>>
|
89 |
<?php esc_html_e( 'Custom:', 'edit-author-slug' ); ?>
|
109 |
*
|
110 |
* @param WP_Errors $errors The WP_Errors object.
|
111 |
* @param bool $update True if user is being updated.
|
112 |
+
* @param object $user An stdClass with user properties.
|
113 |
*/
|
114 |
function ba_eas_update_user_nicename( $errors, $update, $user ) {
|
115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
// We shouldn't be here if we're not updating.
|
117 |
if ( ! $update ) {
|
118 |
return;
|
123 |
return;
|
124 |
}
|
125 |
|
126 |
+
// Bail if user can't edit the slug.
|
127 |
+
if ( ! ba_eas_can_edit_author_slug() ) {
|
128 |
+
return;
|
129 |
+
}
|
130 |
+
|
131 |
// Check the nonce.
|
132 |
check_admin_referer( 'update-user_' . $user->ID );
|
133 |
|
134 |
+
// Don't run the auto-update if the current user can update their own nicename.
|
135 |
+
remove_action( 'profile_update', 'ba_eas_auto_update_user_nicename' );
|
136 |
|
137 |
+
// Set some default variables.
|
138 |
+
$old_user_nicename = get_user_by( 'id', $user->ID )->user_nicename;
|
139 |
$user_nicename = '';
|
140 |
$user_nicename_custom = '';
|
141 |
|
190 |
$ascii
|
191 |
) );
|
192 |
|
|
|
|
|
|
|
193 |
// Reset `$ascii` if the nicename was filtered.
|
194 |
+
if ( $raw_nicename_sanitized !== $user_nicename ) {
|
195 |
$ascii = ba_eas_nicename_is_ascii( $user_nicename );
|
196 |
}
|
197 |
|
222 |
return;
|
223 |
}
|
224 |
|
225 |
+
// Bail if the nicename hasn't changed.
|
226 |
+
if ( $user_nicename === $old_user_nicename ) {
|
227 |
+
return;
|
228 |
+
}
|
229 |
|
230 |
+
// Bail and throw an error if the nicename already exists.
|
231 |
+
if ( ba_eas_nicename_exists( $user_nicename, $user ) ) {
|
|
|
232 |
|
233 |
+
// Setup the error message.
|
234 |
+
/* translators: 1: author slug */
|
235 |
+
$message = __(
|
236 |
+
'<strong>ERROR</strong>: The author slug, %1$s, already exists. Please try something different.',
|
237 |
+
'edit-author-slug'
|
238 |
+
);
|
239 |
|
240 |
+
// Add the error message.
|
241 |
+
$errors->add(
|
242 |
+
'user_nicename_exists',
|
243 |
+
sprintf(
|
244 |
+
$message,
|
245 |
+
'<strong><em>' . ba_eas_esc_nicename( $user_nicename ) . '</em></strong>'
|
246 |
+
)
|
247 |
+
);
|
248 |
|
249 |
+
return;
|
250 |
+
}
|
251 |
|
252 |
+
// Looks like we made it, so let's update.
|
253 |
+
$user->user_nicename = $user_nicename;
|
254 |
|
255 |
+
// Delete the old nicename from the cache.
|
256 |
+
// TODO: Remove when WP 4.5 is the minimum version.
|
257 |
+
// See https://core.trac.wordpress.org/ticket/35750.
|
258 |
+
wp_cache_delete( $old_user_nicename, 'userslugs' );
|
259 |
}
|
260 |
|
261 |
/**
|
271 |
$retval = false;
|
272 |
|
273 |
// True if user is allowed to edit the author slug.
|
274 |
+
if ( current_user_can( 'edit_users' ) || current_user_can( 'edit_author_slug' ) ) {
|
275 |
$retval = true;
|
276 |
}
|
277 |
|
365 |
'edit-author-slug',
|
366 |
ba_eas()->plugin_url . "js/edit-author-slug{$min}.js",
|
367 |
array( 'jquery' ),
|
368 |
+
BA_Edit_Author_Slug::VERSION
|
369 |
);
|
370 |
wp_enqueue_script( 'edit-author-slug' );
|
371 |
}
|
579 |
*/
|
580 |
function ba_eas_admin_setting_callback_author_base() {
|
581 |
|
582 |
+
$author_base = ba_eas()->author_base;
|
583 |
$front = trim( $GLOBALS['wp_rewrite']->front, '/' );
|
584 |
|
585 |
// Add the trailing slash back if `$front` isn't empty.
|
773 |
|
774 |
<span class="screen-reader-text"><?php esc_html_e( 'Default author slug options', 'edit-author-slug' ); ?></span>
|
775 |
<select id="_ba_eas_default_user_nicename" name="_ba_eas_default_user_nicename">
|
776 |
+
<?php foreach ( (array) $options as $id => $item ) : ?>
|
777 |
<option id="<?php echo esc_attr( $id ); ?>" value="<?php echo esc_attr( $id ); ?>"<?php selected( $structure, $id ); ?>><?php echo esc_html( $item ); ?></option>
|
778 |
+
<?php endforeach; ?>
|
779 |
</select>
|
780 |
|
781 |
<?php
|
833 |
|
834 |
<span class="screen-reader-text"><?php esc_html_e( 'Default bulk update author slug options', 'edit-author-slug' ); ?></span>
|
835 |
<select id="_ba_eas_bulk_update_structure" name="_ba_eas_bulk_update_structure">
|
836 |
+
<?php foreach ( (array) $options as $id => $item ) : ?>
|
837 |
<option id="<?php echo esc_attr( $id ); ?>" value="<?php echo esc_attr( $id ); ?>"<?php selected( $structure, $id ); ?>><?php echo esc_html( $item ); ?></option>
|
838 |
+
<?php endforeach; ?>
|
839 |
</select>
|
840 |
|
841 |
<?php
|
956 |
|
957 |
// Add the options.
|
958 |
add_option( '_ba_eas_author_base', $ba_eas->author_base );
|
959 |
+
add_option( '_ba_eas_db_version', BA_Edit_Author_Slug::DB_VERSION );
|
960 |
add_option( '_ba_eas_do_auto_update', (int) $ba_eas->do_auto_update );
|
961 |
add_option( '_ba_eas_default_user_nicename', $ba_eas->default_user_nicename );
|
962 |
add_option( '_ba_eas_do_role_based', (int) $ba_eas->do_role_based );
|
977 |
$ba_eas = ba_eas();
|
978 |
|
979 |
// We're up-to-date, so let's move on.
|
980 |
+
if ( $ba_eas->current_db_version === BA_Edit_Author_Slug::DB_VERSION ) {
|
981 |
return;
|
982 |
}
|
983 |
|
1005 |
}
|
1006 |
|
1007 |
// Version bump.
|
1008 |
+
update_option( '_ba_eas_db_version', BA_Edit_Author_Slug::DB_VERSION );
|
1009 |
|
1010 |
// Courtesy flush.
|
1011 |
ba_eas_flush_rewrite_rules();
|
includes/classes/class-edit-author-slug.php
ADDED
@@ -0,0 +1,409 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The main Edit Author Slug class.
|
4 |
+
*
|
5 |
+
* @package Edit_Author_Slug
|
6 |
+
* @subpackage Classes
|
7 |
+
*/
|
8 |
+
|
9 |
+
// Exit if accessed directly.
|
10 |
+
defined( 'ABSPATH' ) || exit;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Main Edit Author Slug class.
|
14 |
+
*/
|
15 |
+
if ( ! class_exists( 'BA_Edit_Author_Slug' ) ) :
|
16 |
+
|
17 |
+
/**
|
18 |
+
* BA_Edit_Author_Slug class.
|
19 |
+
*
|
20 |
+
* @since 0.1.0
|
21 |
+
*/
|
22 |
+
class BA_Edit_Author_Slug {
|
23 |
+
|
24 |
+
/**
|
25 |
+
* The plugin version.
|
26 |
+
*
|
27 |
+
* @since 1.4.0
|
28 |
+
* @var string
|
29 |
+
*/
|
30 |
+
const VERSION = '1.5.2';
|
31 |
+
|
32 |
+
/**
|
33 |
+
* The plugin version.
|
34 |
+
*
|
35 |
+
* @since 1.4.0
|
36 |
+
* @var int
|
37 |
+
*/
|
38 |
+
const DB_VERSION = 411;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* The current installed database version.
|
42 |
+
*
|
43 |
+
* @since 0.8.0
|
44 |
+
* @access public
|
45 |
+
* @var int
|
46 |
+
*/
|
47 |
+
public $current_db_version = 0;
|
48 |
+
|
49 |
+
/**
|
50 |
+
* The path to this file.
|
51 |
+
*
|
52 |
+
* @since 0.7.0
|
53 |
+
* @access public
|
54 |
+
* @var string
|
55 |
+
*/
|
56 |
+
public $file = '';
|
57 |
+
|
58 |
+
/**
|
59 |
+
* The path to the Edit AUthor Slug directory.
|
60 |
+
*
|
61 |
+
* @since 0.7.0
|
62 |
+
* @access public
|
63 |
+
* @var string
|
64 |
+
*/
|
65 |
+
public $plugin_dir = '';
|
66 |
+
|
67 |
+
/**
|
68 |
+
* The URL for the Edit Author Slug directory.
|
69 |
+
*
|
70 |
+
* @since 0.7.0
|
71 |
+
* @access public
|
72 |
+
* @var string
|
73 |
+
*/
|
74 |
+
public $plugin_url = '';
|
75 |
+
|
76 |
+
/**
|
77 |
+
* The basename for the Edit Author Slug directory.
|
78 |
+
*
|
79 |
+
* @since 0.8.0
|
80 |
+
* @access public
|
81 |
+
* @var string
|
82 |
+
*/
|
83 |
+
public $plugin_basename = '';
|
84 |
+
|
85 |
+
/**
|
86 |
+
* The author base.
|
87 |
+
*
|
88 |
+
* @since 0.7.0
|
89 |
+
* @access public
|
90 |
+
* @var string
|
91 |
+
*/
|
92 |
+
public $author_base = 'author';
|
93 |
+
|
94 |
+
/**
|
95 |
+
* The remove front option.
|
96 |
+
*
|
97 |
+
* @since 1.2.0
|
98 |
+
* @access public
|
99 |
+
* @var bool
|
100 |
+
*/
|
101 |
+
public $remove_front = false;
|
102 |
+
|
103 |
+
/**
|
104 |
+
* The auto update option.
|
105 |
+
*
|
106 |
+
* @since 1.0.0
|
107 |
+
* @access public
|
108 |
+
* @var bool
|
109 |
+
*/
|
110 |
+
public $do_auto_update = false;
|
111 |
+
|
112 |
+
/**
|
113 |
+
* The default user nicename option.
|
114 |
+
*
|
115 |
+
* @since 1.0.0
|
116 |
+
* @access public
|
117 |
+
* @var string
|
118 |
+
*/
|
119 |
+
public $default_user_nicename = 'username';
|
120 |
+
|
121 |
+
/**
|
122 |
+
* The role-based option.
|
123 |
+
*
|
124 |
+
* @since 1.0.0
|
125 |
+
* @access public
|
126 |
+
* @var bool
|
127 |
+
*/
|
128 |
+
public $do_role_based = false;
|
129 |
+
|
130 |
+
/**
|
131 |
+
* The role slugs array.
|
132 |
+
*
|
133 |
+
* @since 1.0.0
|
134 |
+
* @access public
|
135 |
+
* @var array
|
136 |
+
*/
|
137 |
+
public $role_slugs = array();
|
138 |
+
|
139 |
+
/** Singleton *********************************************************/
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Main BA_Edit_Author_Slug Instance
|
143 |
+
*
|
144 |
+
* Insures that only one instance of BA_Edit_Author_Slug exists in memory
|
145 |
+
* at any one time. Also prevents needing to define globals all over the
|
146 |
+
* place.
|
147 |
+
*
|
148 |
+
* @since 1.0.0
|
149 |
+
*
|
150 |
+
* @staticvar object $instance
|
151 |
+
*
|
152 |
+
* @see ba_eas()
|
153 |
+
*
|
154 |
+
* @return BA_Edit_Author_Slug|null The one true BA_Edit_Author_Slug.
|
155 |
+
*/
|
156 |
+
public static function instance() {
|
157 |
+
|
158 |
+
// Store the instance locally to avoid private static replication.
|
159 |
+
static $instance = null;
|
160 |
+
|
161 |
+
// Only run these methods if they haven't been ran previously.
|
162 |
+
if ( null === $instance ) {
|
163 |
+
$instance = new self;
|
164 |
+
}
|
165 |
+
|
166 |
+
// Always return the instance.
|
167 |
+
return $instance;
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* The constructor.
|
172 |
+
*
|
173 |
+
* @since 1.4.0
|
174 |
+
*/
|
175 |
+
public function __construct() {
|
176 |
+
$this->setup_globals();
|
177 |
+
$this->includes();
|
178 |
+
$this->setup_options();
|
179 |
+
}
|
180 |
+
|
181 |
+
/** Magic Methods *****************************************************/
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Magic method for accessing custom/deprecated/nonexistent properties.
|
185 |
+
*
|
186 |
+
* @since 1.4.0
|
187 |
+
*
|
188 |
+
* @param string $name The property name.
|
189 |
+
*
|
190 |
+
* @return mixed
|
191 |
+
*/
|
192 |
+
public function __get( $name ) {
|
193 |
+
|
194 |
+
// Default to null.
|
195 |
+
$retval = null;
|
196 |
+
|
197 |
+
if ( 'version' === $name ) {
|
198 |
+
$retval = self::VERSION;
|
199 |
+
_doing_it_wrong(
|
200 |
+
'BA_Edit_Author_Slug::version',
|
201 |
+
esc_html__( 'Use class constant, BA_Edit_Author_Slug::VERSION, instead.', 'edit-author-slug' ),
|
202 |
+
'1.4.0'
|
203 |
+
);
|
204 |
+
} elseif ( 'db_version' === $name ) {
|
205 |
+
$retval = self::DB_VERSION;
|
206 |
+
_doing_it_wrong(
|
207 |
+
'BA_Edit_Author_Slug::db_version',
|
208 |
+
esc_html__( 'Use class constant, BA_Edit_Author_Slug::DB_VERSION, instead.', 'edit-author-slug' ),
|
209 |
+
'1.4.0'
|
210 |
+
);
|
211 |
+
}
|
212 |
+
|
213 |
+
return $retval;
|
214 |
+
}
|
215 |
+
|
216 |
+
/* Private Methods ****************************************************/
|
217 |
+
|
218 |
+
/**
|
219 |
+
* Edit Author Slug global variables.
|
220 |
+
*
|
221 |
+
* @since 0.7.0
|
222 |
+
*
|
223 |
+
* @return void
|
224 |
+
*/
|
225 |
+
private function setup_globals() {
|
226 |
+
|
227 |
+
/* Paths **********************************************************/
|
228 |
+
|
229 |
+
$this->file = dirname( dirname( dirname( __FILE__ ) ) ) . '/edit-author-slug.php';
|
230 |
+
$this->plugin_dir = plugin_dir_path( $this->file );
|
231 |
+
$this->plugin_url = plugin_dir_url( $this->file );
|
232 |
+
$this->plugin_basename = plugin_basename( $this->file );
|
233 |
+
|
234 |
+
/* Options ********************************************************/
|
235 |
+
|
236 |
+
// Load the remove front option.
|
237 |
+
$remove_front = (int) get_option( '_ba_eas_remove_front', 0 );
|
238 |
+
$this->remove_front = (bool) $remove_front;
|
239 |
+
|
240 |
+
// Load auto-update option.
|
241 |
+
$do_auto_update = (int) get_option( '_ba_eas_do_auto_update', 0 );
|
242 |
+
$this->do_auto_update = (bool) $do_auto_update;
|
243 |
+
|
244 |
+
// Load the default nicename structure for auto-update.
|
245 |
+
$default_user_nicename = get_option( '_ba_eas_default_user_nicename' );
|
246 |
+
$default_user_nicename = sanitize_key( $default_user_nicename );
|
247 |
+
if ( ! empty( $default_user_nicename ) ) {
|
248 |
+
$this->default_user_nicename = $default_user_nicename;
|
249 |
+
}
|
250 |
+
|
251 |
+
// Load role-based author slug option.
|
252 |
+
$do_role_based = (int) get_option( '_ba_eas_do_role_based', 0 );
|
253 |
+
$this->do_role_based = (bool) $do_role_based;
|
254 |
+
}
|
255 |
+
|
256 |
+
/**
|
257 |
+
* Include necessary files.
|
258 |
+
*
|
259 |
+
* @since 0.7.0
|
260 |
+
*
|
261 |
+
* @return void
|
262 |
+
*/
|
263 |
+
private function includes() {
|
264 |
+
|
265 |
+
// Load the core functions.
|
266 |
+
require_once( $this->plugin_dir . 'includes/deprecated.php' );
|
267 |
+
require_once( $this->plugin_dir . 'includes/functions.php' );
|
268 |
+
require_once( $this->plugin_dir . 'includes/hooks.php' );
|
269 |
+
|
270 |
+
// Maybe load the admin functions.
|
271 |
+
if ( is_admin() ) {
|
272 |
+
require_once( $this->plugin_dir . 'includes/admin.php' );
|
273 |
+
}
|
274 |
+
}
|
275 |
+
|
276 |
+
/**
|
277 |
+
* Get our options from the DB and set their corresponding properties.
|
278 |
+
*
|
279 |
+
* @since 1.4.0
|
280 |
+
*
|
281 |
+
* @return void
|
282 |
+
*/
|
283 |
+
private function setup_options() {
|
284 |
+
|
285 |
+
// Get the author base option.
|
286 |
+
$base = get_option( '_ba_eas_author_base' );
|
287 |
+
|
288 |
+
// Options.
|
289 |
+
if ( $base ) {
|
290 |
+
|
291 |
+
// Sanitize the db value.
|
292 |
+
$this->author_base = ba_eas_sanitize_author_base( $base );
|
293 |
+
|
294 |
+
// Current DB version.
|
295 |
+
$this->current_db_version = (int) get_option( '_ba_eas_db_version', 0 );
|
296 |
+
}
|
297 |
+
}
|
298 |
+
|
299 |
+
/**
|
300 |
+
* Display Author slug edit field on User/Profile edit page.
|
301 |
+
*
|
302 |
+
* @since 0.7.0
|
303 |
+
*
|
304 |
+
* @return void
|
305 |
+
*/
|
306 |
+
public function setup_actions() {
|
307 |
+
|
308 |
+
// Author Base Actions.
|
309 |
+
add_action( 'after_setup_theme', array( $this, 'set_role_slugs' ) );
|
310 |
+
add_action( 'init', 'ba_eas_wp_rewrite_overrides', 4 );
|
311 |
+
add_action( 'init', array( $this, 'add_rewrite_tags' ), 20 );
|
312 |
+
|
313 |
+
// Localize.
|
314 |
+
add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
|
315 |
+
}
|
316 |
+
|
317 |
+
/** Public Methods ****************************************************/
|
318 |
+
|
319 |
+
/**
|
320 |
+
* Load the translation file for the current language.
|
321 |
+
*
|
322 |
+
* We only check the default WP language plugins folder.
|
323 |
+
* (ie - wp-content/languages/plugins).
|
324 |
+
*
|
325 |
+
* @since 0.9.6
|
326 |
+
* @since 1.5.0 Only check the default WP languages folder.
|
327 |
+
*
|
328 |
+
* @return bool
|
329 |
+
*/
|
330 |
+
public function load_textdomain() {
|
331 |
+
return load_plugin_textdomain( 'edit-author-slug' );
|
332 |
+
}
|
333 |
+
|
334 |
+
/**
|
335 |
+
* Rewrite Author Base according to user's setting.
|
336 |
+
*
|
337 |
+
* Rewrites Author Base to user's setting from the Author Base field
|
338 |
+
* on Options > Permalinks.
|
339 |
+
*
|
340 |
+
* @since 0.4.0
|
341 |
+
* @deprecated 1.2.0
|
342 |
+
*
|
343 |
+
* @return void
|
344 |
+
*/
|
345 |
+
public function author_base_rewrite() {
|
346 |
+
_deprecated_function( __METHOD__, '1.2.0', 'ba_eas_wp_rewrite_overrides' );
|
347 |
+
ba_eas_wp_rewrite_overrides();
|
348 |
+
}
|
349 |
+
|
350 |
+
/**
|
351 |
+
* Set the role_slugs global
|
352 |
+
*
|
353 |
+
* @since 1.0.0
|
354 |
+
*
|
355 |
+
* @return void
|
356 |
+
*/
|
357 |
+
public function set_role_slugs() {
|
358 |
+
|
359 |
+
// Get the default role slugs.
|
360 |
+
$defaults = ba_eas_get_default_role_slugs();
|
361 |
+
|
362 |
+
// Merge system roles with any customizations we may have.
|
363 |
+
$role_slugs = array_replace_recursive(
|
364 |
+
$defaults,
|
365 |
+
get_option( '_ba_eas_role_slugs', array() )
|
366 |
+
);
|
367 |
+
|
368 |
+
foreach ( $role_slugs as $role => $details ) {
|
369 |
+
|
370 |
+
if ( empty( $defaults[ $role ] ) ) {
|
371 |
+
unset( $role_slugs[ $role ] );
|
372 |
+
}
|
373 |
+
}
|
374 |
+
|
375 |
+
$this->role_slugs = $role_slugs;
|
376 |
+
}
|
377 |
+
|
378 |
+
/** Custom Rewrite Rules **********************************************/
|
379 |
+
|
380 |
+
/**
|
381 |
+
* Add the Edit Author Slug rewrite tags
|
382 |
+
*
|
383 |
+
* @since 1.0.0
|
384 |
+
*
|
385 |
+
* @return void
|
386 |
+
*/
|
387 |
+
public function add_rewrite_tags() {
|
388 |
+
|
389 |
+
// Should we be here?
|
390 |
+
if ( ! ba_eas_do_role_based_author_base() ) {
|
391 |
+
return;
|
392 |
+
}
|
393 |
+
|
394 |
+
// Get the role slugs to add the rewrite tag.
|
395 |
+
$role_slugs = wp_list_pluck( $this->role_slugs, 'slug' );
|
396 |
+
$role_slugs = array_filter( array_values( $role_slugs ) );
|
397 |
+
|
398 |
+
// Add a fallback.
|
399 |
+
if ( false === strpos( $this->author_base, '%ba_eas_author_role%' ) && false === strpos( $this->author_base, '/' ) ) {
|
400 |
+
$role_slugs[] = $this->author_base;
|
401 |
+
} else {
|
402 |
+
$role_slugs[] = 'author';
|
403 |
+
}
|
404 |
+
|
405 |
+
// Add the role-based rewrite tag, and the expected role slugs.
|
406 |
+
add_rewrite_tag( '%ba_eas_author_role%', '(' . implode( '|', array_unique( $role_slugs ) ) . ')' );
|
407 |
+
}
|
408 |
+
}
|
409 |
+
endif; // End class BA_Edit_Author_Slug.
|
includes/deprecated.php
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Edit Author Slug Deprecated Functions.
|
4 |
+
*
|
5 |
+
* @package Edit_Author_Slug
|
6 |
+
* @subpackage Deprecated
|
7 |
+
*
|
8 |
+
* @author Brandon Allen
|
9 |
+
*/
|
10 |
+
|
11 |
+
// Exit if accessed directly.
|
12 |
+
defined( 'ABSPATH' ) || exit;
|
13 |
+
|
14 |
+
/** Nicename ******************************************************************/
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Auto-update the user_nicename for a given user.
|
18 |
+
*
|
19 |
+
* Runs on profile updates and registrations
|
20 |
+
*
|
21 |
+
* @since 0.9.0
|
22 |
+
*
|
23 |
+
* @deprecated 1.1.0 Use `ba_eas_auto_update_user_nicename()` instead.
|
24 |
+
*
|
25 |
+
* @param int $user_id The user id.
|
26 |
+
*
|
27 |
+
* @return bool|int $user_id. False on failure.
|
28 |
+
*/
|
29 |
+
function ba_eas_auto_update_user_nicename_single( $user_id = 0 ) {
|
30 |
+
_deprecated_function( __FUNCTION__, '1.1.0', 'ba_eas_auto_update_user_nicename' );
|
31 |
+
return ba_eas_auto_update_user_nicename( $user_id );
|
32 |
+
}
|
33 |
+
|
34 |
+
/** Miscellaneous *************************************************************/
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Returns the WP_Roles object.
|
38 |
+
*
|
39 |
+
* WP 4.3 added the `wp_roles()` function to facilitate the instantiation of the
|
40 |
+
* WP_Roles object. This is a wrapper function for `wp_roles()` with a fallback
|
41 |
+
* for those on WP < 4.3.
|
42 |
+
*
|
43 |
+
* @since 1.2.0
|
44 |
+
* @deprecated 1.5.0
|
45 |
+
*
|
46 |
+
* @global WP_Roles $wp_roles
|
47 |
+
*
|
48 |
+
* @return WP_Roles
|
49 |
+
*/
|
50 |
+
function ba_eas_get_wp_roles() {
|
51 |
+
_deprecated_function( __FUNCTION__, '1.5.0', 'wp_roles' );
|
52 |
+
return wp_roles();
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Fetch a filtered list of user roles that the current user is
|
57 |
+
* allowed to edit.
|
58 |
+
*
|
59 |
+
* Simple function who's main purpose is to allow filtering of the
|
60 |
+
* list of roles in the $wp_roles object so that plugins can remove
|
61 |
+
* inappropriate ones depending on the situation or user making edits.
|
62 |
+
* Specifically because without filtering anyone with the edit_users
|
63 |
+
* capability can edit others to be administrators, even if they are
|
64 |
+
* only editors or authors. This filter allows admins to delegate
|
65 |
+
* user management.
|
66 |
+
*
|
67 |
+
* @since 1.0.0
|
68 |
+
* @deprecated 1.2.0
|
69 |
+
*
|
70 |
+
* @global WP_Roles $wp_roles The WP_Roles object.
|
71 |
+
*
|
72 |
+
* @return array $editable_roles List of editable roles.
|
73 |
+
*/
|
74 |
+
function ba_eas_get_editable_roles() {
|
75 |
+
|
76 |
+
_deprecated_function( __FUNCTION__, '1.2.0' );
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Filter the list of editable roles.
|
80 |
+
*
|
81 |
+
* @since 1.0.0
|
82 |
+
*
|
83 |
+
* @param array $roles The `WP_Roles::roles` array.
|
84 |
+
*/
|
85 |
+
$editable_roles = apply_filters( 'editable_roles', wp_roles()->roles );
|
86 |
+
|
87 |
+
// Remove user caps.
|
88 |
+
foreach ( (array) $editable_roles as $role => $details ) {
|
89 |
+
unset( $editable_roles[ $role ]['capabilities'] );
|
90 |
+
}
|
91 |
+
|
92 |
+
return $editable_roles;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Clean and update the nicename cache.
|
97 |
+
*
|
98 |
+
* @todo This will no longer be necessary when WP 4.5 is the minimum version.
|
99 |
+
* @see https://core.trac.wordpress.org/ticket/35750
|
100 |
+
*
|
101 |
+
* @since 1.0.0
|
102 |
+
* @deprecated 1.5.0
|
103 |
+
*
|
104 |
+
* @param int $user_id The user id.
|
105 |
+
* @param object $old_user_data The WP_User object.
|
106 |
+
* @param string $new_nicename The new user nicename.
|
107 |
+
*/
|
108 |
+
function ba_eas_update_nicename_cache( $user_id = 0, $old_user_data = '', $new_nicename = '' ) {
|
109 |
+
|
110 |
+
_deprecated_function( __FUNCTION__, '1.5.0', 'wp_cache_delete( $old_nicename, \'userslugs\' );' );
|
111 |
+
|
112 |
+
// Bail if there's no user.
|
113 |
+
if ( empty( $user_id ) && empty( $old_user_data->ID ) ) {
|
114 |
+
return;
|
115 |
+
}
|
116 |
+
|
117 |
+
// Get a user_id. This will probably never happen.
|
118 |
+
if ( empty( $user_id ) ) {
|
119 |
+
$user_id = $old_user_data->ID;
|
120 |
+
}
|
121 |
+
|
122 |
+
// We got here via `profile_update`.
|
123 |
+
if ( empty( $new_nicename ) ) {
|
124 |
+
|
125 |
+
// Get the new nicename.
|
126 |
+
$user = get_userdata( $user_id );
|
127 |
+
$new_nicename = $user->user_nicename;
|
128 |
+
}
|
129 |
+
|
130 |
+
// Set the old nicename.
|
131 |
+
// Note: This check is only for back-compat. You should pass a WP_User object.
|
132 |
+
if ( isset( $old_user_data->user_nicename ) ) {
|
133 |
+
$old_nicename = $old_user_data->user_nicename;
|
134 |
+
} else {
|
135 |
+
_doing_it_wrong( __FUNCTION__, ' The function ba_eas_update_nicename_cache() expects $old_user_data to be a WP_User object.', 'Edit Author Slug 1.0.4' );
|
136 |
+
$old_nicename = $old_user_data;
|
137 |
+
}
|
138 |
+
|
139 |
+
// Delete the old nicename from the cache.
|
140 |
+
wp_cache_delete( $old_nicename, 'userslugs' );
|
141 |
+
|
142 |
+
// Add the new nicename to the cache.
|
143 |
+
wp_cache_add( $new_nicename, $user_id, 'userslugs' );
|
144 |
+
}
|
includes/functions.php
CHANGED
@@ -37,7 +37,7 @@ function ba_eas_do_auto_update() {
|
|
37 |
*
|
38 |
* @since 1.4.0
|
39 |
*
|
40 |
-
* @param
|
41 |
*
|
42 |
* @return bool True if bulk update should occur.
|
43 |
*/
|
@@ -69,7 +69,7 @@ function ba_eas_do_bulk_update( $do_bulk = false ) {
|
|
69 |
*
|
70 |
* @return bool|int User id on success. False on failure.
|
71 |
*/
|
72 |
-
function ba_eas_auto_update_user_nicename( $user_id, $bulk = false, $structure = '' ) {
|
73 |
|
74 |
// Bail if there's no id or object.
|
75 |
if ( empty( $user_id ) ) {
|
@@ -140,37 +140,18 @@ function ba_eas_auto_update_user_nicename( $user_id, $bulk = false, $structure =
|
|
140 |
// Add it back in case other plugins do some updating.
|
141 |
add_action( 'profile_update', 'ba_eas_auto_update_user_nicename' );
|
142 |
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
*/
|
147 |
if ( ! empty( $user_id ) && ! is_wp_error( $user_id ) ) {
|
148 |
|
149 |
-
//
|
150 |
-
|
151 |
}
|
152 |
|
153 |
return $user_id;
|
154 |
}
|
155 |
|
156 |
-
/**
|
157 |
-
* Auto-update the user_nicename for a given user.
|
158 |
-
*
|
159 |
-
* Runs on profile updates and registrations
|
160 |
-
*
|
161 |
-
* @since 0.9.0
|
162 |
-
*
|
163 |
-
* @deprecated 1.1.0 Use `ba_eas_auto_update_user_nicename()` instead.
|
164 |
-
*
|
165 |
-
* @param int $user_id The user id.
|
166 |
-
*
|
167 |
-
* @return bool|int $user_id. False on failure.
|
168 |
-
*/
|
169 |
-
function ba_eas_auto_update_user_nicename_single( $user_id = 0 ) {
|
170 |
-
_deprecated_function( __FUNCTION__, '1.1.0', 'ba_eas_auto_update_user_nicename' );
|
171 |
-
return ba_eas_auto_update_user_nicename( $user_id );
|
172 |
-
}
|
173 |
-
|
174 |
/**
|
175 |
* Auto-update the user_nicename for a given user.
|
176 |
*
|
@@ -184,14 +165,16 @@ function ba_eas_auto_update_user_nicename_single( $user_id = 0 ) {
|
|
184 |
*/
|
185 |
function ba_eas_auto_update_user_nicename_bulk( $do_bulk = false ) {
|
186 |
|
187 |
-
// Nonce check.
|
188 |
-
check_admin_referer( 'edit-author-slug-options' );
|
189 |
-
|
190 |
// Bail if the user didn't ask to run the bulk update.
|
191 |
if ( ! ba_eas_do_bulk_update( $do_bulk ) ) {
|
192 |
return false;
|
193 |
}
|
194 |
|
|
|
|
|
|
|
|
|
|
|
195 |
// Default to the auto-update nicename structure.
|
196 |
$structure = ba_eas()->default_user_nicename;
|
197 |
|
@@ -216,25 +199,62 @@ function ba_eas_auto_update_user_nicename_bulk( $do_bulk = false ) {
|
|
216 |
|
217 |
// Set the default updated count.
|
218 |
$updated = 0;
|
|
|
|
|
219 |
|
220 |
// Loop through all the users and maybe update their nicenames.
|
221 |
foreach ( $users as $key => $user_id ) {
|
222 |
|
|
|
|
|
|
|
|
|
|
|
223 |
// Reset the max execution time.
|
224 |
set_time_limit( 30 );
|
225 |
|
226 |
-
|
227 |
-
$
|
|
|
228 |
|
229 |
-
|
230 |
-
|
231 |
-
$
|
232 |
}
|
233 |
|
234 |
-
// Remove the processed user from the users array.
|
235 |
unset( $users[ $key ] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
}
|
237 |
|
|
|
|
|
|
|
238 |
// Add a message to the settings page denoting user how many users were updated.
|
239 |
add_settings_error(
|
240 |
'_ba_eas_bulk_auto_update',
|
@@ -373,7 +393,9 @@ function ba_eas_trim_nicename( $nicename = '' ) {
|
|
373 |
* characters that can be converted to ASCII.
|
374 |
*/
|
375 |
function ba_eas_nicename_is_ascii( $nicename = '' ) {
|
376 |
-
|
|
|
|
|
377 |
}
|
378 |
|
379 |
/**
|
@@ -404,42 +426,27 @@ function ba_eas_get_nicename_by_structure( $user_id = 0, $structure = '' ) {
|
|
404 |
|
405 |
case 'username':
|
406 |
|
407 |
-
|
408 |
-
$nicename = $user->user_login;
|
409 |
-
}
|
410 |
-
|
411 |
break;
|
412 |
|
413 |
case 'nickname':
|
414 |
|
415 |
-
|
416 |
-
$nicename = $user->nickname;
|
417 |
-
}
|
418 |
-
|
419 |
break;
|
420 |
|
421 |
case 'displayname':
|
422 |
|
423 |
-
|
424 |
-
$nicename = $user->display_name;
|
425 |
-
}
|
426 |
-
|
427 |
break;
|
428 |
|
429 |
case 'firstname':
|
430 |
|
431 |
-
|
432 |
-
$nicename = $user->first_name;
|
433 |
-
}
|
434 |
-
|
435 |
break;
|
436 |
|
437 |
case 'lastname':
|
438 |
|
439 |
-
|
440 |
-
$nicename = $user->last_name;
|
441 |
-
}
|
442 |
-
|
443 |
break;
|
444 |
|
445 |
case 'firstlast':
|
@@ -461,16 +468,65 @@ function ba_eas_get_nicename_by_structure( $user_id = 0, $structure = '' ) {
|
|
461 |
case 'userid':
|
462 |
|
463 |
$nicename = $user->ID;
|
464 |
-
|
465 |
break;
|
466 |
} // End switch().
|
467 |
|
468 |
// Sanitize and trim the new user nicename.
|
469 |
$nicename = ba_eas_trim_nicename( ba_eas_sanitize_nicename( $nicename ) );
|
470 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
471 |
return apply_filters( 'ba_eas_get_nicename_by_structure', $nicename, $user_id, $structure );
|
472 |
}
|
473 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
474 |
/** Author Base ***************************************************************/
|
475 |
|
476 |
/**
|
@@ -484,26 +540,29 @@ function ba_eas_get_nicename_by_structure( $user_id = 0, $structure = '' ) {
|
|
484 |
*/
|
485 |
function ba_eas_wp_rewrite_overrides() {
|
486 |
|
487 |
-
// Set default author base.
|
488 |
-
$author_base = 'author';
|
489 |
-
|
490 |
// Set to our author base if it exists.
|
491 |
-
|
492 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
493 |
}
|
494 |
|
495 |
// If doing role-based, set accordingly.
|
496 |
-
if (
|
497 |
$author_base = '%ba_eas_author_role%';
|
498 |
}
|
499 |
|
500 |
// Override WP_Rewrite::author_base with our new value.
|
501 |
$GLOBALS['wp_rewrite']->author_base = $author_base;
|
502 |
-
|
503 |
-
// Override `WP_Rewrite::author_structure` with our new value.
|
504 |
-
if ( ba_eas_remove_front() && ba_eas_has_front() ) {
|
505 |
-
$GLOBALS['wp_rewrite']->author_structure = '/' . $author_base . '/%author%';
|
506 |
-
}
|
507 |
}
|
508 |
|
509 |
/**
|
@@ -515,6 +574,8 @@ function ba_eas_wp_rewrite_overrides() {
|
|
515 |
*/
|
516 |
function ba_eas_remove_front() {
|
517 |
|
|
|
|
|
518 |
/**
|
519 |
* Filters the return of the `remove_front` option.
|
520 |
*
|
@@ -522,7 +583,7 @@ function ba_eas_remove_front() {
|
|
522 |
*
|
523 |
* @param bool $remove_front The `remove_front` option.
|
524 |
*/
|
525 |
-
return (bool) apply_filters( 'ba_eas_remove_front',
|
526 |
}
|
527 |
|
528 |
/**
|
@@ -534,6 +595,8 @@ function ba_eas_remove_front() {
|
|
534 |
*/
|
535 |
function ba_eas_has_front() {
|
536 |
|
|
|
|
|
537 |
/**
|
538 |
* Filters the return of the `ba_eas_has_front` option.
|
539 |
*
|
@@ -541,7 +604,7 @@ function ba_eas_has_front() {
|
|
541 |
*
|
542 |
* @param bool $has_front The `remove_front` option.
|
543 |
*/
|
544 |
-
return (bool) apply_filters( 'ba_eas_has_front',
|
545 |
}
|
546 |
|
547 |
/**
|
@@ -595,7 +658,7 @@ function ba_eas_author_link( $link = '', $user_id = 0 ) {
|
|
595 |
}
|
596 |
|
597 |
// Remove front if applicable.
|
598 |
-
if (
|
599 |
$link = str_replace( $GLOBALS['wp_rewrite']->front, '/', $link );
|
600 |
}
|
601 |
|
@@ -627,7 +690,7 @@ function ba_eas_template_include( $template ) {
|
|
627 |
$author = get_queried_object();
|
628 |
|
629 |
// Make sure we have a WP_User object.
|
630 |
-
if ( !
|
631 |
return $template;
|
632 |
}
|
633 |
|
@@ -749,35 +812,6 @@ function ba_eas_get_user_role( $roles = array(), $user_id = 0 ) {
|
|
749 |
return apply_filters( 'ba_eas_get_user_role', $role, $user_id );
|
750 |
}
|
751 |
|
752 |
-
/**
|
753 |
-
* Returns the WP_Roles object.
|
754 |
-
*
|
755 |
-
* WP 4.3 added the `wp_roles()` function to facilitate the instantiation of the
|
756 |
-
* WP_Roles object. This is a wrapper function for `wp_roles()` with a fallback
|
757 |
-
* for those on WP < 4.3.
|
758 |
-
*
|
759 |
-
* @since 1.2.0
|
760 |
-
*
|
761 |
-
* @global WP_Roles $wp_roles
|
762 |
-
*
|
763 |
-
* @return WP_Roles
|
764 |
-
*/
|
765 |
-
function ba_eas_get_wp_roles() {
|
766 |
-
|
767 |
-
if ( function_exists( 'wp_roles' ) ) {
|
768 |
-
$wp_roles = wp_roles();
|
769 |
-
|
770 |
-
} else {
|
771 |
-
|
772 |
-
// Make sure the `$wp_roles` global has been set.
|
773 |
-
if ( ! isset( $GLOBALS['wp_roles'] ) ) {
|
774 |
-
$wp_roles = new WP_Roles();
|
775 |
-
}
|
776 |
-
}
|
777 |
-
|
778 |
-
return $wp_roles;
|
779 |
-
}
|
780 |
-
|
781 |
/**
|
782 |
* Return an array of WP roles.
|
783 |
*
|
@@ -791,67 +825,18 @@ function ba_eas_get_wp_roles() {
|
|
791 |
*/
|
792 |
function ba_eas_get_roles() {
|
793 |
|
794 |
-
// Get the `WP_Roles` object.
|
795 |
-
$wp_roles = ba_eas_get_wp_roles();
|
796 |
-
|
797 |
// Pull out just the roles array.
|
798 |
-
$_wp_roles =
|
799 |
|
800 |
// Remove user caps.
|
801 |
-
foreach (
|
|
|
802 |
unset( $_wp_roles[ $role ]['capabilities'] );
|
803 |
}
|
804 |
|
805 |
return $_wp_roles;
|
806 |
}
|
807 |
|
808 |
-
/**
|
809 |
-
* Fetch a filtered list of user roles that the current user is
|
810 |
-
* allowed to edit.
|
811 |
-
*
|
812 |
-
* Simple function who's main purpose is to allow filtering of the
|
813 |
-
* list of roles in the $wp_roles object so that plugins can remove
|
814 |
-
* inappropriate ones depending on the situation or user making edits.
|
815 |
-
* Specifically because without filtering anyone with the edit_users
|
816 |
-
* capability can edit others to be administrators, even if they are
|
817 |
-
* only editors or authors. This filter allows admins to delegate
|
818 |
-
* user management.
|
819 |
-
*
|
820 |
-
* @since 1.0.0
|
821 |
-
*
|
822 |
-
* @global WP_Roles $wp_roles The WP_Roles object.
|
823 |
-
*
|
824 |
-
* @return array $editable_roles List of editable roles.
|
825 |
-
*/
|
826 |
-
function ba_eas_get_editable_roles() {
|
827 |
-
|
828 |
-
// Get the `WP_Roles` object.
|
829 |
-
$wp_roles = ba_eas_get_wp_roles();
|
830 |
-
|
831 |
-
$roles = array();
|
832 |
-
if ( ! empty( $wp_roles->roles ) ) {
|
833 |
-
$roles = $wp_roles->roles;
|
834 |
-
}
|
835 |
-
|
836 |
-
/**
|
837 |
-
* Filter the list of editable roles.
|
838 |
-
*
|
839 |
-
* @since 1.0.0
|
840 |
-
*
|
841 |
-
* @param array $roles The return of WP_Roles::roles.
|
842 |
-
*/
|
843 |
-
$editable_roles = apply_filters( 'editable_roles', $roles );
|
844 |
-
|
845 |
-
// Remove user caps.
|
846 |
-
if ( ! empty( $editable_roles ) ) {
|
847 |
-
foreach ( $editable_roles as $role => $details ) {
|
848 |
-
unset( $editable_roles[ $role ]['capabilities'] );
|
849 |
-
}
|
850 |
-
}
|
851 |
-
|
852 |
-
return $editable_roles;
|
853 |
-
}
|
854 |
-
|
855 |
/**
|
856 |
* Get an list of default role slugs
|
857 |
*
|
@@ -865,7 +850,7 @@ function ba_eas_get_default_role_slugs() {
|
|
865 |
$roles = ba_eas_get_roles();
|
866 |
|
867 |
// Convert role names into role slugs.
|
868 |
-
foreach ( $roles as $role => $details ) {
|
869 |
$roles[ $role ]['slug'] = sanitize_title( translate_user_role( $details['name'] ) );
|
870 |
}
|
871 |
|
@@ -914,51 +899,3 @@ if ( ! function_exists( 'array_replace_recursive' ) ) {
|
|
914 |
return $base;
|
915 |
}
|
916 |
} // End if().
|
917 |
-
|
918 |
-
/**
|
919 |
-
* Clean and update the nicename cache.
|
920 |
-
*
|
921 |
-
* @todo This will no longer be necessary when WP 4.5 is the minimum version.
|
922 |
-
* @see https://core.trac.wordpress.org/ticket/35750
|
923 |
-
*
|
924 |
-
* @since 1.0.0
|
925 |
-
*
|
926 |
-
* @param int $user_id The user id.
|
927 |
-
* @param object $old_user_data The WP_User object.
|
928 |
-
* @param string $new_nicename The new user nicename.
|
929 |
-
*/
|
930 |
-
function ba_eas_update_nicename_cache( $user_id = 0, $old_user_data = '', $new_nicename = '' ) {
|
931 |
-
|
932 |
-
// Bail if there's no user.
|
933 |
-
if ( empty( $user_id ) && empty( $old_user_data->ID ) ) {
|
934 |
-
return;
|
935 |
-
}
|
936 |
-
|
937 |
-
// Get a user_id. This will probably never happen.
|
938 |
-
if ( empty( $user_id ) ) {
|
939 |
-
$user_id = $old_user_data->ID;
|
940 |
-
}
|
941 |
-
|
942 |
-
// We got here via `profile_update`.
|
943 |
-
if ( empty( $new_nicename ) ) {
|
944 |
-
|
945 |
-
// Get the new nicename.
|
946 |
-
$user = get_userdata( $user_id );
|
947 |
-
$new_nicename = $user->user_nicename;
|
948 |
-
}
|
949 |
-
|
950 |
-
// Set the old nicename.
|
951 |
-
// Note: This check is only for back-compat. You should pass a WP_User object.
|
952 |
-
if ( isset( $old_user_data->user_nicename ) ) {
|
953 |
-
$old_nicename = $old_user_data->user_nicename;
|
954 |
-
} else {
|
955 |
-
_doing_it_wrong( __FUNCTION__, ' The function ba_eas_update_nicename_cache() expects $old_user_data to be a WP_User object.', 'Edit Author Slug 1.0.4' );
|
956 |
-
$old_nicename = $old_user_data;
|
957 |
-
}
|
958 |
-
|
959 |
-
// Delete the old nicename from the cache.
|
960 |
-
wp_cache_delete( $old_nicename, 'userslugs' );
|
961 |
-
|
962 |
-
// Add the new nicename to the cache.
|
963 |
-
wp_cache_add( $new_nicename, $user_id, 'userslugs' );
|
964 |
-
}
|
37 |
*
|
38 |
* @since 1.4.0
|
39 |
*
|
40 |
+
* @param int|bool $do_bulk Whether or not to perform a bulk update.
|
41 |
*
|
42 |
* @return bool True if bulk update should occur.
|
43 |
*/
|
69 |
*
|
70 |
* @return bool|int User id on success. False on failure.
|
71 |
*/
|
72 |
+
function ba_eas_auto_update_user_nicename( $user_id = 0, $bulk = false, $structure = '' ) {
|
73 |
|
74 |
// Bail if there's no id or object.
|
75 |
if ( empty( $user_id ) ) {
|
140 |
// Add it back in case other plugins do some updating.
|
141 |
add_action( 'profile_update', 'ba_eas_auto_update_user_nicename' );
|
142 |
|
143 |
+
// Only delete the `userslugs` cache if the user was successfully updated.
|
144 |
+
// TODO: Remove when WP 4.5 is the minimum version.
|
145 |
+
// See https://core.trac.wordpress.org/ticket/35750.
|
|
|
146 |
if ( ! empty( $user_id ) && ! is_wp_error( $user_id ) ) {
|
147 |
|
148 |
+
// Delete the old nicename from the cache.
|
149 |
+
wp_cache_delete( $old_nicename, 'userslugs' );
|
150 |
}
|
151 |
|
152 |
return $user_id;
|
153 |
}
|
154 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
/**
|
156 |
* Auto-update the user_nicename for a given user.
|
157 |
*
|
165 |
*/
|
166 |
function ba_eas_auto_update_user_nicename_bulk( $do_bulk = false ) {
|
167 |
|
|
|
|
|
|
|
168 |
// Bail if the user didn't ask to run the bulk update.
|
169 |
if ( ! ba_eas_do_bulk_update( $do_bulk ) ) {
|
170 |
return false;
|
171 |
}
|
172 |
|
173 |
+
// Nonce check.
|
174 |
+
check_admin_referer( 'edit-author-slug-options' );
|
175 |
+
|
176 |
+
global $wpdb;
|
177 |
+
|
178 |
// Default to the auto-update nicename structure.
|
179 |
$structure = ba_eas()->default_user_nicename;
|
180 |
|
199 |
|
200 |
// Set the default updated count.
|
201 |
$updated = 0;
|
202 |
+
$when = array();
|
203 |
+
$where = array();
|
204 |
|
205 |
// Loop through all the users and maybe update their nicenames.
|
206 |
foreach ( $users as $key => $user_id ) {
|
207 |
|
208 |
+
$user = get_user_by( 'id', $user_id );
|
209 |
+
if ( empty( $user->ID ) ) {
|
210 |
+
continue;
|
211 |
+
}
|
212 |
+
|
213 |
// Reset the max execution time.
|
214 |
set_time_limit( 30 );
|
215 |
|
216 |
+
$user = get_user_by( 'id', $user_id );
|
217 |
+
$nicename = ba_eas_get_nicename_by_structure( $user->ID, $structure );
|
218 |
+
$exists = ba_eas_nicename_exists( $nicename, $user );
|
219 |
|
220 |
+
if ( ! $exists && $nicename && $user->nicename !== $nicename ) {
|
221 |
+
$when[] = $wpdb->prepare( 'WHEN %d THEN %s', $user->ID, $nicename );
|
222 |
+
$where[] = $wpdb->prepare( '%d', $user->ID );
|
223 |
}
|
224 |
|
225 |
+
// Remove the processed user from the users array and clean the cache.
|
226 |
unset( $users[ $key ] );
|
227 |
+
clean_user_cache( $user );
|
228 |
+
if ( $exists ) {
|
229 |
+
clean_user_cache( $exists );
|
230 |
+
}
|
231 |
+
}
|
232 |
+
|
233 |
+
// If we have some when statements, the update the nicenames.
|
234 |
+
if ( ! empty( $when ) ) {
|
235 |
+
|
236 |
+
// Setup our when and where statements.
|
237 |
+
$when_sql = implode( ' ', $when );
|
238 |
+
$where_sql = '';
|
239 |
+
if ( ! empty( $where ) ) {
|
240 |
+
$where_sql = 'WHERE ID IN ( ' . implode( ',', $where ) . ' )';
|
241 |
+
}
|
242 |
+
|
243 |
+
// Run the update.
|
244 |
+
$sql = "
|
245 |
+
UPDATE $wpdb->users
|
246 |
+
SET user_nicename = CASE ID
|
247 |
+
{$when_sql}
|
248 |
+
ELSE user_nicename
|
249 |
+
END
|
250 |
+
{$where_sql}
|
251 |
+
";
|
252 |
+
$updated = $wpdb->query( $sql ); // WPCS: unprepared SQL ok.
|
253 |
}
|
254 |
|
255 |
+
// Unset some vars to help with memory.
|
256 |
+
unset( $users, $when, $when_sql, $where, $where_sql );
|
257 |
+
|
258 |
// Add a message to the settings page denoting user how many users were updated.
|
259 |
add_settings_error(
|
260 |
'_ba_eas_bulk_auto_update',
|
393 |
* characters that can be converted to ASCII.
|
394 |
*/
|
395 |
function ba_eas_nicename_is_ascii( $nicename = '' ) {
|
396 |
+
$sanitize_nicename = ba_eas_sanitize_nicename( $nicename );
|
397 |
+
$sanitize_nicename_strict = ba_eas_sanitize_nicename( $nicename, false );
|
398 |
+
return ( $sanitize_nicename === $sanitize_nicename_strict );
|
399 |
}
|
400 |
|
401 |
/**
|
426 |
|
427 |
case 'username':
|
428 |
|
429 |
+
$nicename = $user->user_login;
|
|
|
|
|
|
|
430 |
break;
|
431 |
|
432 |
case 'nickname':
|
433 |
|
434 |
+
$nicename = $user->nickname;
|
|
|
|
|
|
|
435 |
break;
|
436 |
|
437 |
case 'displayname':
|
438 |
|
439 |
+
$nicename = $user->display_name;
|
|
|
|
|
|
|
440 |
break;
|
441 |
|
442 |
case 'firstname':
|
443 |
|
444 |
+
$nicename = $user->first_name;
|
|
|
|
|
|
|
445 |
break;
|
446 |
|
447 |
case 'lastname':
|
448 |
|
449 |
+
$nicename = $user->last_name;
|
|
|
|
|
|
|
450 |
break;
|
451 |
|
452 |
case 'firstlast':
|
468 |
case 'userid':
|
469 |
|
470 |
$nicename = $user->ID;
|
|
|
471 |
break;
|
472 |
} // End switch().
|
473 |
|
474 |
// Sanitize and trim the new user nicename.
|
475 |
$nicename = ba_eas_trim_nicename( ba_eas_sanitize_nicename( $nicename ) );
|
476 |
|
477 |
+
/**
|
478 |
+
* Filters the return of `ba_eas_get_nicename_by_structure`.
|
479 |
+
*
|
480 |
+
* @since 1.4.0
|
481 |
+
*
|
482 |
+
* @param string $nicename The nicename.
|
483 |
+
* @param int $user_id The user id.
|
484 |
+
* @param string $structure The passed nicename structure.
|
485 |
+
*/
|
486 |
return apply_filters( 'ba_eas_get_nicename_by_structure', $nicename, $user_id, $structure );
|
487 |
}
|
488 |
|
489 |
+
/**
|
490 |
+
* Check if a nicename exists.
|
491 |
+
*
|
492 |
+
* @since 1.5.0
|
493 |
+
*
|
494 |
+
* @param string $nicename The nicename to check.
|
495 |
+
* @param int|WP_User $user_or_id The user id or user object.
|
496 |
+
*
|
497 |
+
* @return bool|WP_User The WP_User object. False on failure.
|
498 |
+
*/
|
499 |
+
function ba_eas_nicename_exists( $nicename = '', $user_or_id = 0 ) {
|
500 |
+
|
501 |
+
// Default to false.
|
502 |
+
$retval = false;
|
503 |
+
|
504 |
+
// Get the user objects if they exist.
|
505 |
+
$user = new WP_User( $user_or_id );
|
506 |
+
$existing = get_user_by( 'slug', $nicename );
|
507 |
+
|
508 |
+
// Return the existing user object if it exists.
|
509 |
+
if ( ! empty( $existing->ID ) ) {
|
510 |
+
$retval = $existing;
|
511 |
+
}
|
512 |
+
|
513 |
+
// Check if a user was passed and if it matches the existing user.
|
514 |
+
if ( $retval && ! empty( $user->ID ) && $existing->ID === $user->ID ) {
|
515 |
+
$retval = false;
|
516 |
+
}
|
517 |
+
|
518 |
+
/**
|
519 |
+
* Filters the return of `ba_eas_nicename_exists()`.
|
520 |
+
*
|
521 |
+
* @since 1.5.0
|
522 |
+
*
|
523 |
+
* @param bool|WP_User $retval The WP_User object. False on failure.
|
524 |
+
* @param string $nicename The user nicename.
|
525 |
+
* @param int|WP_User $user_or_id The user id or user object.
|
526 |
+
*/
|
527 |
+
return apply_filters( 'ba_eas_nicename_exists', $retval, $nicename, $user_or_id );
|
528 |
+
}
|
529 |
+
|
530 |
/** Author Base ***************************************************************/
|
531 |
|
532 |
/**
|
540 |
*/
|
541 |
function ba_eas_wp_rewrite_overrides() {
|
542 |
|
|
|
|
|
|
|
543 |
// Set to our author base if it exists.
|
544 |
+
$author_base = ba_eas()->author_base;
|
545 |
+
|
546 |
+
// Get the role-based option.
|
547 |
+
$role_based = ba_eas_do_role_based_author_base();
|
548 |
+
|
549 |
+
// Override `WP_Rewrite::author_structure` with our new value.
|
550 |
+
if ( ba_eas_remove_front() ) {
|
551 |
+
$GLOBALS['wp_rewrite']->author_structure = '/' . $author_base . '/%author%';
|
552 |
+
}
|
553 |
+
|
554 |
+
// If we have the default author base and not doing role-based.
|
555 |
+
if ( 'author' === $author_base && ! $role_based ) {
|
556 |
+
return;
|
557 |
}
|
558 |
|
559 |
// If doing role-based, set accordingly.
|
560 |
+
if ( $role_based && false === strpos( $author_base, '%ba_eas_author_role%' ) ) {
|
561 |
$author_base = '%ba_eas_author_role%';
|
562 |
}
|
563 |
|
564 |
// Override WP_Rewrite::author_base with our new value.
|
565 |
$GLOBALS['wp_rewrite']->author_base = $author_base;
|
|
|
|
|
|
|
|
|
|
|
566 |
}
|
567 |
|
568 |
/**
|
574 |
*/
|
575 |
function ba_eas_remove_front() {
|
576 |
|
577 |
+
$reval = ( ba_eas_has_front() && ba_eas()->remove_front );
|
578 |
+
|
579 |
/**
|
580 |
* Filters the return of the `remove_front` option.
|
581 |
*
|
583 |
*
|
584 |
* @param bool $remove_front The `remove_front` option.
|
585 |
*/
|
586 |
+
return (bool) apply_filters( 'ba_eas_remove_front', $reval );
|
587 |
}
|
588 |
|
589 |
/**
|
595 |
*/
|
596 |
function ba_eas_has_front() {
|
597 |
|
598 |
+
$retval = ( '/' !== $GLOBALS['wp_rewrite']->front );
|
599 |
+
|
600 |
/**
|
601 |
* Filters the return of the `ba_eas_has_front` option.
|
602 |
*
|
604 |
*
|
605 |
* @param bool $has_front The `remove_front` option.
|
606 |
*/
|
607 |
+
return (bool) apply_filters( 'ba_eas_has_front', $retval );
|
608 |
}
|
609 |
|
610 |
/**
|
658 |
}
|
659 |
|
660 |
// Remove front if applicable.
|
661 |
+
if ( ba_eas_remove_front() ) {
|
662 |
$link = str_replace( $GLOBALS['wp_rewrite']->front, '/', $link );
|
663 |
}
|
664 |
|
690 |
$author = get_queried_object();
|
691 |
|
692 |
// Make sure we have a WP_User object.
|
693 |
+
if ( ! $author instanceof WP_User ) {
|
694 |
return $template;
|
695 |
}
|
696 |
|
812 |
return apply_filters( 'ba_eas_get_user_role', $role, $user_id );
|
813 |
}
|
814 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
815 |
/**
|
816 |
* Return an array of WP roles.
|
817 |
*
|
825 |
*/
|
826 |
function ba_eas_get_roles() {
|
827 |
|
|
|
|
|
|
|
828 |
// Pull out just the roles array.
|
829 |
+
$_wp_roles = array();
|
830 |
|
831 |
// Remove user caps.
|
832 |
+
foreach ( wp_roles()->roles as $role => $details ) {
|
833 |
+
$_wp_roles[ $role ] = $details;
|
834 |
unset( $_wp_roles[ $role ]['capabilities'] );
|
835 |
}
|
836 |
|
837 |
return $_wp_roles;
|
838 |
}
|
839 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
840 |
/**
|
841 |
* Get an list of default role slugs
|
842 |
*
|
850 |
$roles = ba_eas_get_roles();
|
851 |
|
852 |
// Convert role names into role slugs.
|
853 |
+
foreach ( (array) $roles as $role => $details ) {
|
854 |
$roles[ $role ]['slug'] = sanitize_title( translate_user_role( $details['name'] ) );
|
855 |
}
|
856 |
|
899 |
return $base;
|
900 |
}
|
901 |
} // End if().
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/edit-author-slug.js
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
-
|
|
|
|
|
2 |
|
3 |
// Front show/hide.
|
4 |
if ( $( 'input[name="_ba_eas_remove_front"]' ).prop( 'checked' ) ) {
|
@@ -9,24 +11,24 @@ jQuery( document ).ready(function( $ ) {
|
|
9 |
$( 'input[name="_ba_eas_remove_front"]' ).on( 'click', function() {
|
10 |
if ( $( this ).prop( 'checked' ) ) {
|
11 |
$( 'span[class="eas-demo-author-base-front"]' ).fadeOut( 'fast', function() {
|
12 |
-
$( this ).addClass( 'hidden' );
|
13 |
-
});
|
14 |
} else {
|
15 |
$( 'span[class="eas-demo-author-base-front hidden"]' ).fadeIn( 'slow', function() {
|
16 |
-
$( this ).removeClass( 'hidden' );
|
17 |
-
});
|
18 |
}
|
19 |
});
|
20 |
|
21 |
// Make example nicenames clickable.
|
22 |
-
$( 'input[name="ba_eas_author_slug"]' ).click(function() {
|
23 |
if ( 'ba_eas_author_slug_custom_radio' !== $( this ).attr( 'id' ) ) {
|
24 |
$( 'input[name="ba_eas_author_slug_custom"]' ).val( $( this ).val() ).text( $( this ).siblings( 'span' ).text() );
|
25 |
}
|
26 |
});
|
27 |
|
28 |
// If focus moves to the custom author slug input, select the radio.
|
29 |
-
$( 'input[name="ba_eas_author_slug_custom"]' ).focus(function() {
|
30 |
$( '#ba_eas_author_slug_custom_radio' ).attr( 'checked', 'checked' );
|
31 |
});
|
32 |
|
@@ -37,12 +39,12 @@ $( this ).removeClass( 'hidden' );
|
|
37 |
$( 'input[class="eas-checkbox"]' ).on( 'click', function() {
|
38 |
if ( $( this ).prop( 'checked' ) ) {
|
39 |
$( this ).parents( 'tr' ).next( 'tr' ).fadeIn( 'slow', function() {
|
40 |
-
$( this ).removeClass( 'hidden' );
|
41 |
-
});
|
42 |
} else {
|
43 |
$( this ).parents( 'tr' ).next( 'tr' ).fadeOut( 'fast', function() {
|
44 |
-
$( this ).addClass( 'hidden' );
|
45 |
-
});
|
46 |
}
|
47 |
});
|
48 |
});
|
1 |
+
/* jshint devel: true */
|
2 |
+
|
3 |
+
jQuery( document ).ready( function( $ ) {
|
4 |
|
5 |
// Front show/hide.
|
6 |
if ( $( 'input[name="_ba_eas_remove_front"]' ).prop( 'checked' ) ) {
|
11 |
$( 'input[name="_ba_eas_remove_front"]' ).on( 'click', function() {
|
12 |
if ( $( this ).prop( 'checked' ) ) {
|
13 |
$( 'span[class="eas-demo-author-base-front"]' ).fadeOut( 'fast', function() {
|
14 |
+
$( this ).addClass( 'hidden' );
|
15 |
+
});
|
16 |
} else {
|
17 |
$( 'span[class="eas-demo-author-base-front hidden"]' ).fadeIn( 'slow', function() {
|
18 |
+
$( this ).removeClass( 'hidden' );
|
19 |
+
});
|
20 |
}
|
21 |
});
|
22 |
|
23 |
// Make example nicenames clickable.
|
24 |
+
$( 'input[name="ba_eas_author_slug"]' ).click( function() {
|
25 |
if ( 'ba_eas_author_slug_custom_radio' !== $( this ).attr( 'id' ) ) {
|
26 |
$( 'input[name="ba_eas_author_slug_custom"]' ).val( $( this ).val() ).text( $( this ).siblings( 'span' ).text() );
|
27 |
}
|
28 |
});
|
29 |
|
30 |
// If focus moves to the custom author slug input, select the radio.
|
31 |
+
$( 'input[name="ba_eas_author_slug_custom"]' ).focus( function() {
|
32 |
$( '#ba_eas_author_slug_custom_radio' ).attr( 'checked', 'checked' );
|
33 |
});
|
34 |
|
39 |
$( 'input[class="eas-checkbox"]' ).on( 'click', function() {
|
40 |
if ( $( this ).prop( 'checked' ) ) {
|
41 |
$( this ).parents( 'tr' ).next( 'tr' ).fadeIn( 'slow', function() {
|
42 |
+
$( this ).removeClass( 'hidden' );
|
43 |
+
});
|
44 |
} else {
|
45 |
$( this ).parents( 'tr' ).next( 'tr' ).fadeOut( 'fast', function() {
|
46 |
+
$( this ).addClass( 'hidden' );
|
47 |
+
});
|
48 |
}
|
49 |
});
|
50 |
});
|
js/edit-author-slug.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
/*! edit-author-slug - v1.
|
2 |
-
jQuery(document).ready(function(
|
1 |
+
/*! edit-author-slug - v1.5.2 - 2017-06-21 5:33:46 AM UTC - https://github.com/thebrandonallen/edit-author-slug/ */
|
2 |
+
jQuery(document).ready(function(s){s('input[name="_ba_eas_remove_front"]').prop("checked")&&s('span[class="eas-demo-author-base-front"]').addClass("hidden"),s('input[name="_ba_eas_remove_front"]').on("click",function(){s(this).prop("checked")?s('span[class="eas-demo-author-base-front"]').fadeOut("fast",function(){s(this).addClass("hidden")}):s('span[class="eas-demo-author-base-front hidden"]').fadeIn("slow",function(){s(this).removeClass("hidden")})}),s('input[name="ba_eas_author_slug"]').click(function(){"ba_eas_author_slug_custom_radio"!==s(this).attr("id")&&s('input[name="ba_eas_author_slug_custom"]').val(s(this).val()).text(s(this).siblings("span").text())}),s('input[name="ba_eas_author_slug_custom"]').focus(function(){s("#ba_eas_author_slug_custom_radio").attr("checked","checked")}),s('input[class="eas-checkbox"]').not(":checked").parents("tr").next("tr").addClass("hidden"),s('input[class="eas-checkbox"]').on("click",function(){s(this).prop("checked")?s(this).parents("tr").next("tr").fadeIn("slow",function(){s(this).removeClass("hidden")}):s(this).parents("tr").next("tr").fadeOut("fast",function(){s(this).addClass("hidden")})})});
|
languages/edit-author-slug.pot
CHANGED
@@ -3,10 +3,10 @@
|
|
3 |
# Submit translations to https://translate.wordpress.org/projects/wp-plugins/edit-author-slug.
|
4 |
msgid ""
|
5 |
msgstr ""
|
6 |
-
"Project-Id-Version: Edit Author Slug 1.
|
7 |
"Report-Msgid-Bugs-To: "
|
8 |
"https://github.com/thebrandonallen/edit-author-slug/issues\n"
|
9 |
-
"POT-Creation-Date: 2017-
|
10 |
"MIME-Version: 1.0\n"
|
11 |
"Content-Type: text/plain; charset=utf-8\n"
|
12 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -26,14 +26,6 @@ msgstr ""
|
|
26 |
"X-Textdomain-Support: yes\n"
|
27 |
"X-Generator: grunt-wp-i18n1.0.0\n"
|
28 |
|
29 |
-
#: edit-author-slug.php:256
|
30 |
-
msgid "Method does not exist."
|
31 |
-
msgstr ""
|
32 |
-
|
33 |
-
#: edit-author-slug.php:279 edit-author-slug.php:296
|
34 |
-
msgid "Cheatin’ huh?"
|
35 |
-
msgstr ""
|
36 |
-
|
37 |
#: includes/admin.php:66
|
38 |
msgid ""
|
39 |
"Choose an Author Slug based on the above profile information, or create "
|
@@ -44,7 +36,7 @@ msgstr ""
|
|
44 |
msgid "ie. - 'user-name', 'firstname-lastname', or 'master-ninja'"
|
45 |
msgstr ""
|
46 |
|
47 |
-
#: includes/admin.php:69 includes/admin.php:71 includes/admin.php:
|
48 |
msgid "Author Slug"
|
49 |
msgstr ""
|
50 |
|
@@ -60,104 +52,104 @@ msgstr ""
|
|
60 |
msgid "Custom author slug:"
|
61 |
msgstr ""
|
62 |
|
63 |
-
#: includes/admin.php:
|
64 |
msgid "<strong>ERROR</strong>: An author slug cannot be blank. Please try again."
|
65 |
msgstr ""
|
66 |
|
67 |
-
#: includes/admin.php:
|
68 |
msgid ""
|
69 |
"<strong>ERROR</strong>: An author slug can only contain alphanumeric "
|
70 |
"characters, underscores (_) and dashes (-)."
|
71 |
msgstr ""
|
72 |
|
73 |
-
#: includes/admin.php:
|
74 |
msgid ""
|
75 |
"<strong>ERROR</strong>: That author slug appears to be invalid. Please try "
|
76 |
"something different."
|
77 |
msgstr ""
|
78 |
|
79 |
-
#: includes/admin.php:
|
80 |
msgid "<strong>ERROR</strong>: An author slug may not be longer than 50 characters."
|
81 |
msgstr ""
|
82 |
|
83 |
-
#: includes/admin.php:
|
84 |
#. translators: 1: author slug
|
85 |
msgid ""
|
86 |
"<strong>ERROR</strong>: The author slug, %1$s, already exists. Please try "
|
87 |
"something different."
|
88 |
msgstr ""
|
89 |
|
90 |
-
#: includes/admin.php:
|
91 |
msgid "Edit Author Slug Settings"
|
92 |
msgstr ""
|
93 |
|
94 |
-
#: includes/admin.php:
|
95 |
msgid "Author Base"
|
96 |
msgstr ""
|
97 |
|
98 |
-
#: includes/admin.php:
|
99 |
msgid "Remove Front"
|
100 |
msgstr ""
|
101 |
|
102 |
-
#: includes/admin.php:
|
103 |
msgid "Role-Based Author Base"
|
104 |
msgstr ""
|
105 |
|
106 |
-
#: includes/admin.php:
|
107 |
msgid "Role Slugs"
|
108 |
msgstr ""
|
109 |
|
110 |
-
#: includes/admin.php:
|
111 |
msgid "Automatic Author Slug Creation"
|
112 |
msgstr ""
|
113 |
|
114 |
-
#: includes/admin.php:
|
115 |
msgid "Automatically Update"
|
116 |
msgstr ""
|
117 |
|
118 |
-
#: includes/admin.php:
|
119 |
msgid "Author Slug Structure"
|
120 |
msgstr ""
|
121 |
|
122 |
-
#: includes/admin.php:
|
123 |
msgid "Bulk Update Author Slugs"
|
124 |
msgstr ""
|
125 |
|
126 |
-
#: includes/admin.php:
|
127 |
msgid "Bulk Update"
|
128 |
msgstr ""
|
129 |
|
130 |
-
#: includes/admin.php:
|
131 |
msgid "Change your author base to something more fun!"
|
132 |
msgstr ""
|
133 |
|
134 |
-
#: includes/admin.php:
|
135 |
msgid ""
|
136 |
"Allow Author Slugs to be automatically updated, and set the default Author "
|
137 |
"Slug structure for users. Automatic updating will only occur when a user "
|
138 |
"can't edit Author Slugs on their own."
|
139 |
msgstr ""
|
140 |
|
141 |
-
#: includes/admin.php:
|
142 |
msgid ""
|
143 |
"This could have SEO repercussions if users update their profiles "
|
144 |
"frequently, and it will override any manual editing of the Author Slug you "
|
145 |
"may have previously completed."
|
146 |
msgstr ""
|
147 |
|
148 |
-
#: includes/admin.php:
|
149 |
msgid "Defaults to 'author'"
|
150 |
msgstr ""
|
151 |
|
152 |
-
#: includes/admin.php:
|
153 |
msgid "Remove the \"front\" portion of the author permalink structure."
|
154 |
msgstr ""
|
155 |
|
156 |
-
#: includes/admin.php:
|
157 |
msgid "Set user's Author Base according to their role."
|
158 |
msgstr ""
|
159 |
|
160 |
-
#: includes/admin.php:
|
161 |
#. translators: 1: rewrite tag, 2: rewrite tag demo usage, 3: demo URL using
|
162 |
#. rewrite tag
|
163 |
msgid ""
|
@@ -166,65 +158,73 @@ msgid ""
|
|
166 |
"something like \"%3$s\"."
|
167 |
msgstr ""
|
168 |
|
169 |
-
#: includes/admin.php:
|
170 |
msgid "Automatically update Author Slug when a user updates their profile."
|
171 |
msgstr ""
|
172 |
|
173 |
-
#: includes/admin.php:
|
174 |
msgid "Default author slug options"
|
175 |
msgstr ""
|
176 |
|
177 |
-
#: includes/admin.php:
|
178 |
msgid "Update all users at once based on the specified Author Slug structure."
|
179 |
msgstr ""
|
180 |
|
181 |
-
#: includes/admin.php:
|
182 |
msgid ""
|
183 |
"Update all users according to the below Author Slug setting. This will only "
|
184 |
"be run after clicking \"Save Changes\"."
|
185 |
msgstr ""
|
186 |
|
187 |
-
#: includes/admin.php:
|
188 |
msgid "Default bulk update author slug options"
|
189 |
msgstr ""
|
190 |
|
191 |
-
#: includes/admin.php:
|
192 |
msgid "Settings"
|
193 |
msgstr ""
|
194 |
|
195 |
-
#: includes/admin.php:
|
196 |
msgid "username (Default)"
|
197 |
msgstr ""
|
198 |
|
199 |
-
#: includes/admin.php:
|
200 |
msgid "nickname"
|
201 |
msgstr ""
|
202 |
|
203 |
-
#: includes/admin.php:
|
204 |
msgid "displayname"
|
205 |
msgstr ""
|
206 |
|
207 |
-
#: includes/admin.php:
|
208 |
msgid "firstname"
|
209 |
msgstr ""
|
210 |
|
211 |
-
#: includes/admin.php:
|
212 |
msgid "lastname"
|
213 |
msgstr ""
|
214 |
|
215 |
-
#: includes/admin.php:
|
216 |
msgid "firstname-lastname"
|
217 |
msgstr ""
|
218 |
|
219 |
-
#: includes/admin.php:
|
220 |
msgid "lastname-firstname"
|
221 |
msgstr ""
|
222 |
|
223 |
-
#: includes/admin.php:
|
224 |
msgid "userid (Experimental)"
|
225 |
msgstr ""
|
226 |
|
227 |
-
#: includes/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
#. translators: Updated author slugs count.
|
229 |
msgid "%d user author slug updated."
|
230 |
msgid_plural "%d user author slugs updated."
|
3 |
# Submit translations to https://translate.wordpress.org/projects/wp-plugins/edit-author-slug.
|
4 |
msgid ""
|
5 |
msgstr ""
|
6 |
+
"Project-Id-Version: Edit Author Slug 1.5.2\n"
|
7 |
"Report-Msgid-Bugs-To: "
|
8 |
"https://github.com/thebrandonallen/edit-author-slug/issues\n"
|
9 |
+
"POT-Creation-Date: 2017-06-21 05:33:46+00:00\n"
|
10 |
"MIME-Version: 1.0\n"
|
11 |
"Content-Type: text/plain; charset=utf-8\n"
|
12 |
"Content-Transfer-Encoding: 8bit\n"
|
26 |
"X-Textdomain-Support: yes\n"
|
27 |
"X-Generator: grunt-wp-i18n1.0.0\n"
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
#: includes/admin.php:66
|
30 |
msgid ""
|
31 |
"Choose an Author Slug based on the above profile information, or create "
|
36 |
msgid "ie. - 'user-name', 'firstname-lastname', or 'master-ninja'"
|
37 |
msgstr ""
|
38 |
|
39 |
+
#: includes/admin.php:69 includes/admin.php:71 includes/admin.php:300
|
40 |
msgid "Author Slug"
|
41 |
msgstr ""
|
42 |
|
52 |
msgid "Custom author slug:"
|
53 |
msgstr ""
|
54 |
|
55 |
+
#: includes/admin.php:159
|
56 |
msgid "<strong>ERROR</strong>: An author slug cannot be blank. Please try again."
|
57 |
msgstr ""
|
58 |
|
59 |
+
#: includes/admin.php:202
|
60 |
msgid ""
|
61 |
"<strong>ERROR</strong>: An author slug can only contain alphanumeric "
|
62 |
"characters, underscores (_) and dashes (-)."
|
63 |
msgstr ""
|
64 |
|
65 |
+
#: includes/admin.php:211
|
66 |
msgid ""
|
67 |
"<strong>ERROR</strong>: That author slug appears to be invalid. Please try "
|
68 |
"something different."
|
69 |
msgstr ""
|
70 |
|
71 |
+
#: includes/admin.php:220
|
72 |
msgid "<strong>ERROR</strong>: An author slug may not be longer than 50 characters."
|
73 |
msgstr ""
|
74 |
|
75 |
+
#: includes/admin.php:235
|
76 |
#. translators: 1: author slug
|
77 |
msgid ""
|
78 |
"<strong>ERROR</strong>: The author slug, %1$s, already exists. Please try "
|
79 |
"something different."
|
80 |
msgstr ""
|
81 |
|
82 |
+
#: includes/admin.php:382 includes/admin.php:400
|
83 |
msgid "Edit Author Slug Settings"
|
84 |
msgstr ""
|
85 |
|
86 |
+
#: includes/admin.php:424 includes/admin.php:432
|
87 |
msgid "Author Base"
|
88 |
msgstr ""
|
89 |
|
90 |
+
#: includes/admin.php:446
|
91 |
msgid "Remove Front"
|
92 |
msgstr ""
|
93 |
|
94 |
+
#: includes/admin.php:460
|
95 |
msgid "Role-Based Author Base"
|
96 |
msgstr ""
|
97 |
|
98 |
+
#: includes/admin.php:473
|
99 |
msgid "Role Slugs"
|
100 |
msgstr ""
|
101 |
|
102 |
+
#: includes/admin.php:483
|
103 |
msgid "Automatic Author Slug Creation"
|
104 |
msgstr ""
|
105 |
|
106 |
+
#: includes/admin.php:491
|
107 |
msgid "Automatically Update"
|
108 |
msgstr ""
|
109 |
|
110 |
+
#: includes/admin.php:504 includes/admin.php:538
|
111 |
msgid "Author Slug Structure"
|
112 |
msgstr ""
|
113 |
|
114 |
+
#: includes/admin.php:517
|
115 |
msgid "Bulk Update Author Slugs"
|
116 |
msgstr ""
|
117 |
|
118 |
+
#: includes/admin.php:525
|
119 |
msgid "Bulk Update"
|
120 |
msgstr ""
|
121 |
|
122 |
+
#: includes/admin.php:557
|
123 |
msgid "Change your author base to something more fun!"
|
124 |
msgstr ""
|
125 |
|
126 |
+
#: includes/admin.php:570
|
127 |
msgid ""
|
128 |
"Allow Author Slugs to be automatically updated, and set the default Author "
|
129 |
"Slug structure for users. Automatic updating will only occur when a user "
|
130 |
"can't edit Author Slugs on their own."
|
131 |
msgstr ""
|
132 |
|
133 |
+
#: includes/admin.php:570
|
134 |
msgid ""
|
135 |
"This could have SEO repercussions if users update their profiles "
|
136 |
"frequently, and it will override any manual editing of the Author Slug you "
|
137 |
"may have previously completed."
|
138 |
msgstr ""
|
139 |
|
140 |
+
#: includes/admin.php:592
|
141 |
msgid "Defaults to 'author'"
|
142 |
msgstr ""
|
143 |
|
144 |
+
#: includes/admin.php:619
|
145 |
msgid "Remove the \"front\" portion of the author permalink structure."
|
146 |
msgstr ""
|
147 |
|
148 |
+
#: includes/admin.php:633
|
149 |
msgid "Set user's Author Base according to their role."
|
150 |
msgstr ""
|
151 |
|
152 |
+
#: includes/admin.php:637
|
153 |
#. translators: 1: rewrite tag, 2: rewrite tag demo usage, 3: demo URL using
|
154 |
#. rewrite tag
|
155 |
msgid ""
|
158 |
"something like \"%3$s\"."
|
159 |
msgstr ""
|
160 |
|
161 |
+
#: includes/admin.php:750
|
162 |
msgid "Automatically update Author Slug when a user updates their profile."
|
163 |
msgstr ""
|
164 |
|
165 |
+
#: includes/admin.php:774
|
166 |
msgid "Default author slug options"
|
167 |
msgstr ""
|
168 |
|
169 |
+
#: includes/admin.php:794
|
170 |
msgid "Update all users at once based on the specified Author Slug structure."
|
171 |
msgstr ""
|
172 |
|
173 |
+
#: includes/admin.php:810
|
174 |
msgid ""
|
175 |
"Update all users according to the below Author Slug setting. This will only "
|
176 |
"be run after clicking \"Save Changes\"."
|
177 |
msgstr ""
|
178 |
|
179 |
+
#: includes/admin.php:834
|
180 |
msgid "Default bulk update author slug options"
|
181 |
msgstr ""
|
182 |
|
183 |
+
#: includes/admin.php:865
|
184 |
msgid "Settings"
|
185 |
msgstr ""
|
186 |
|
187 |
+
#: includes/admin.php:890 tests/test-admin.php:962
|
188 |
msgid "username (Default)"
|
189 |
msgstr ""
|
190 |
|
191 |
+
#: includes/admin.php:891 tests/test-admin.php:963
|
192 |
msgid "nickname"
|
193 |
msgstr ""
|
194 |
|
195 |
+
#: includes/admin.php:892 tests/test-admin.php:964
|
196 |
msgid "displayname"
|
197 |
msgstr ""
|
198 |
|
199 |
+
#: includes/admin.php:893 tests/test-admin.php:965
|
200 |
msgid "firstname"
|
201 |
msgstr ""
|
202 |
|
203 |
+
#: includes/admin.php:894 tests/test-admin.php:966
|
204 |
msgid "lastname"
|
205 |
msgstr ""
|
206 |
|
207 |
+
#: includes/admin.php:895 tests/test-admin.php:967
|
208 |
msgid "firstname-lastname"
|
209 |
msgstr ""
|
210 |
|
211 |
+
#: includes/admin.php:896 tests/test-admin.php:968
|
212 |
msgid "lastname-firstname"
|
213 |
msgstr ""
|
214 |
|
215 |
+
#: includes/admin.php:897 tests/test-admin.php:969
|
216 |
msgid "userid (Experimental)"
|
217 |
msgstr ""
|
218 |
|
219 |
+
#: includes/classes/class-edit-author-slug.php:201
|
220 |
+
msgid "Use class constant, BA_Edit_Author_Slug::VERSION, instead."
|
221 |
+
msgstr ""
|
222 |
+
|
223 |
+
#: includes/classes/class-edit-author-slug.php:208
|
224 |
+
msgid "Use class constant, BA_Edit_Author_Slug::DB_VERSION, instead."
|
225 |
+
msgstr ""
|
226 |
+
|
227 |
+
#: includes/functions.php:264
|
228 |
#. translators: Updated author slugs count.
|
229 |
msgid "%d user author slug updated."
|
230 |
msgid_plural "%d user author slugs updated."
|
readme.md
DELETED
@@ -1,307 +0,0 @@
|
|
1 |
-
# Edit Author Slug [![Build Status](https://travis-ci.org/thebrandonallen/edit-author-slug.svg?branch=master)](https://travis-ci.org/thebrandonallen/edit-author-slug) #
|
2 |
-
**Contributors:** [thebrandonallen](https://profiles.wordpress.org/thebrandonallen)
|
3 |
-
**Tags:** author, author base, author slug, user nicename, nicename, permalink, permalinks, slug, users, user, role, roles
|
4 |
-
**Requires at least:** 4.3
|
5 |
-
**Tested up to:** 4.7.3
|
6 |
-
**Stable tag:** 1.4.1
|
7 |
-
**License:** GPLv2 or later
|
8 |
-
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
-
|
10 |
-
Allows an admin (or capable user) to edit the author slug of a user, and change the author base.
|
11 |
-
|
12 |
-
## Description ##
|
13 |
-
|
14 |
-
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.
|
15 |
-
|
16 |
-
WordPress default structure *http://example.com/author/username/*.
|
17 |
-
|
18 |
-
Edit Author Slug allows for *http://example.com/ninja/master-ninja/*.
|
19 |
-
|
20 |
-
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).
|
21 |
-
|
22 |
-
Development of this plugin takes place on [GitHub](https://github.com/thebrandonallen/edit-author-slug/ "Edit Author Slug on Github"). Pull requests are always welcome!
|
23 |
-
|
24 |
-
Translations should be submitted to [Translate WordPress](https://translate.wordpress.org/projects/wp-plugins/edit-author-slug).
|
25 |
-
|
26 |
-
## Installation ##
|
27 |
-
|
28 |
-
1. Upload `edit-author-slug` folder to your WordPress plugins directory (typically 'wp-content/plugins')
|
29 |
-
2. Activate the plugin through the 'Plugins' menu in WordPress
|
30 |
-
3. Go to Users > Your Profile, or Users > All Users > (username), and edit the author slug.
|
31 |
-
4. Click "Update Profile" or "Update User"
|
32 |
-
5. Go to Settings > Edit Author Slug to edit settings
|
33 |
-
6. Click "Save Changes"
|
34 |
-
|
35 |
-
## Screenshots ##
|
36 |
-
|
37 |
-
1. Settings
|
38 |
-
2. Individual user author slug
|
39 |
-
|
40 |
-
## Frequently Asked Questions ##
|
41 |
-
|
42 |
-
### What is an author slug? ###
|
43 |
-
|
44 |
-
On standard WordPress installs, it's the final part of an author permalink.
|
45 |
-
e.g. - https://example.com/author/author-slug/
|
46 |
-
|
47 |
-
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.
|
48 |
-
|
49 |
-
### Will my changes persist if I deactivate or delete the Edit Author Slug plugin? ###
|
50 |
-
|
51 |
-
It depends.
|
52 |
-
|
53 |
-
Changing a user's author slug is permanent, as this changes the user's `user_nicename` field in the database.
|
54 |
-
|
55 |
-
If you've changed the author base, deactivating or deleting the plugin will revert your author base back to `author`.
|
56 |
-
|
57 |
-
### Why can't I edit my Author Slug? ###
|
58 |
-
|
59 |
-
Make sure you are an admin, or have been assigned the `edit_users` capability.
|
60 |
-
|
61 |
-
### Why isn't my new Author Slug working? ###
|
62 |
-
|
63 |
-
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.
|
64 |
-
|
65 |
-
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.
|
66 |
-
|
67 |
-
## Changelog ##
|
68 |
-
|
69 |
-
### 1.4.1 ###
|
70 |
-
* Release date: April 24, 2017
|
71 |
-
* Fix failing string replacement in bulk update message.
|
72 |
-
|
73 |
-
### 1.4.0 ###
|
74 |
-
* Release date: April 4, 2017
|
75 |
-
* Lots of code cleanup to better adhere to WordPress Coding Standards.
|
76 |
-
* Improved performance of `ba_eas_sanitize_author_base()` by preventing unnecessary processing.
|
77 |
-
* Fixed an issue where the demo author permalink URL could have a double slash.
|
78 |
-
* Improvements to bulk update for sites with a large user base.
|
79 |
-
|
80 |
-
### 1.3.0 ###
|
81 |
-
* Release date: January 25, 2017
|
82 |
-
* Fix a potential bug where a sanitized author base could end up with double forward slashes.
|
83 |
-
* Introduce the `%ba_eas_author_role%` permalink structure tag. This can be used to customize role-based author bases.
|
84 |
-
* Bonus: All alternative facts are now free!
|
85 |
-
|
86 |
-
### 1.2.1 ###
|
87 |
-
* Release date: February 29, 2016
|
88 |
-
* Fixed stupid error where the default user nicename wasn't being properly retrieved from the database. Sorry about that :(
|
89 |
-
* Unfortunately, some unicorns were lost during the development of this release, but they are a resilient creature.
|
90 |
-
|
91 |
-
### 1.2.0 ###
|
92 |
-
* Release date: February 1, 2016
|
93 |
-
* Added the ability to use forward slashes in the author base.
|
94 |
-
* Improved display on the settings page, and storing, of role slugs.
|
95 |
-
* Packaged translations are now removed. Anyone interested in translating the plugin should do so at [Translate WordPress](https://translate.wordpress.org/projects/wp-plugins/edit-author-slug).
|
96 |
-
* 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).
|
97 |
-
* Added ability to remove the front portion of author links.
|
98 |
-
* Accessibility improvements to the settings page.
|
99 |
-
|
100 |
-
### 1.1.2 ###
|
101 |
-
* Release date: October 11, 2015
|
102 |
-
* Fix loading of minified JS in the admin. Props nuyensgert.
|
103 |
-
|
104 |
-
### 1.1.1 ###
|
105 |
-
* Release date: September 29, 2015
|
106 |
-
* Fix a few minor output escaping issues missed in the 1.1.0 release.
|
107 |
-
|
108 |
-
### 1.1.0 ###
|
109 |
-
* Release date: September 29, 2015
|
110 |
-
* Added the ability to update all author slugs at once with the "Bulk Update" tool.
|
111 |
-
* Greatly improved the checks and error messages when manually updating an author slug for a user.
|
112 |
-
* Further accessibility improvements to match WP 4.3.
|
113 |
-
* Improved validation of author slugs to better match that of WP.
|
114 |
-
|
115 |
-
### 1.0.6 ###
|
116 |
-
* Release date: September 14, 2015
|
117 |
-
* Fix potential, although unlikely, persistent XSS vulnerability.
|
118 |
-
* Prevent debug notice in admin. Props chesio.
|
119 |
-
* Update heading tags to h1 to match WP 4.3.
|
120 |
-
|
121 |
-
### 1.0.5.1 ###
|
122 |
-
* Release date: August 4, 2015
|
123 |
-
* Identical to 1.0.5, which failed to commit properly.
|
124 |
-
|
125 |
-
### 1.0.5 ###
|
126 |
-
* Release date: August 4, 2015
|
127 |
-
* Add WP_User object as a parameter passed to the `ba_eas_show_user_nicename_options_list` filter
|
128 |
-
* Add Japanese translation files. Props SmokyJp.
|
129 |
-
* Fixed possible (although unlikely) cache invalidation issue
|
130 |
-
* Minor code improvements and optimizations.
|
131 |
-
|
132 |
-
### 1.0.4 ###
|
133 |
-
* Release date: April 21, 2015
|
134 |
-
* Improve upgrade routine for older installs
|
135 |
-
* Improve output escaping
|
136 |
-
* Various minor fixes and improvements
|
137 |
-
|
138 |
-
### 1.0.3 ###
|
139 |
-
* Release date: October 8, 2014
|
140 |
-
|
141 |
-
I swear I tested this! :(
|
142 |
-
|
143 |
-
* Fix custom roles slugs not saving
|
144 |
-
|
145 |
-
### 1.0.2 ###
|
146 |
-
* Release date: September 4, 2014
|
147 |
-
* A number of localization fixes and improvements
|
148 |
-
* Role slug improvements
|
149 |
-
* Temporary, semi work-around for Co-Authors Plus [https://github.com/Automattic/Co-Authors-Plus/pull/204]
|
150 |
-
|
151 |
-
### 1.0.1 ###
|
152 |
-
* Release date: April 17, 2014
|
153 |
-
* Fix possible syntax error when updating a profile (props Christine https://wordpress.org/support/topic/undefined-property-error-1)
|
154 |
-
|
155 |
-
### 1.0 ###
|
156 |
-
* Release date: February 26, 2014
|
157 |
-
* Added ability to do role-based author bases
|
158 |
-
* Added ability to use role-based author templates
|
159 |
-
* Moderate code refactoring
|
160 |
-
* Various code fixes and improvements
|
161 |
-
* Add "nickname" as option for auto-update
|
162 |
-
* First pass at unit test (only checks if the plugin is installed, for now)
|
163 |
-
|
164 |
-
### 0.9.6 ###
|
165 |
-
* Release date: December 18, 2013
|
166 |
-
* Fixed loading of translation files. Looks in wp-content/plugins/edit-author-slug/languages. If you're running 3.7+ (and you are... aren't you?), it will fall back to wp-content/languages/plugins if a proper localization can't be found in the edit-author-slug folder.
|
167 |
-
|
168 |
-
### 0.9.5 ###
|
169 |
-
* Release date: April 29, 2013
|
170 |
-
* Fixed instances where the Author Base wouldn't change, or would result in a 404
|
171 |
-
|
172 |
-
### 0.9.4 ###
|
173 |
-
* Release date: January 31, 2013
|
174 |
-
* Update readme references to plugin settings
|
175 |
-
* Fix some copy pasta in settings
|
176 |
-
* Update screenshots
|
177 |
-
|
178 |
-
### 0.9.3 ###
|
179 |
-
* Release date: January 31, 2013
|
180 |
-
* Quickly caught a few things I missed, so this release was skipped. See 0.9.4 for changes
|
181 |
-
|
182 |
-
### 0.9.2 ###
|
183 |
-
* Release date: June 25, 2012
|
184 |
-
* Fix issue where any profile information other than the Author Slug could not be updated
|
185 |
-
* Minor code improvement
|
186 |
-
|
187 |
-
### 0.9.1 ###
|
188 |
-
* Release date: June 14, 2012
|
189 |
-
* Add 'Settings' link to plugins list table
|
190 |
-
|
191 |
-
### 0.9 ###
|
192 |
-
* Release date: June 13, 2012
|
193 |
-
* Allow Author Slug to be automatically created/updated based on a defined structure
|
194 |
-
* Switched to using the Settings API, which also means that all options moved to the Settings > Edit Author Slug page
|
195 |
-
* Various code improvements/optimizations
|
196 |
-
|
197 |
-
### 0.8.1 ###
|
198 |
-
* Release date: February 14, 2012
|
199 |
-
* Fix a bug that prevented non-admin users from updating their profile
|
200 |
-
|
201 |
-
### 0.8 ###
|
202 |
-
* Release date: December 15, 2011
|
203 |
-
* Drastically improved error handling and feedback for author slug editing.
|
204 |
-
* Restore duplicate author slug check as old method could alter the slug without any sort of warning.
|
205 |
-
* Further improve the logic for flushing rewrite rules.
|
206 |
-
* Introduce ba_eas_can_edit_author_slug() and matching filter to make it even easier to give users the ability to update their own author slug.
|
207 |
-
* Add message in plugins list warning users of WP less than 3.2 that 0.8 is the last update they'll receive.
|
208 |
-
|
209 |
-
### 0.7.2 ###
|
210 |
-
* Release date: February 13, 2011
|
211 |
-
* Remove overzealous cap check.
|
212 |
-
|
213 |
-
### 0.7.1 ###
|
214 |
-
* Release date: February 13, 2011
|
215 |
-
* Fix some unfortunate errors I missed before tagging 0.7.
|
216 |
-
|
217 |
-
### 0.7 ###
|
218 |
-
* Release date: February 13, 2011
|
219 |
-
* Significant code refactoring.
|
220 |
-
* Added custom capability to give site admins the ability to add author slug access to other roles.
|
221 |
-
* Improvements/optimizations to code logic.
|
222 |
-
* Fixed an incorrect textdomain string.
|
223 |
-
* Removed filter added in 0.6 as it was messy. It's much easier to achieve the same result without the plugin.
|
224 |
-
* Got rid of wp_die() statement on duplicate author slugs in favor of WP's built-in duplicate author slug method.
|
225 |
-
|
226 |
-
### 0.6.1 ###
|
227 |
-
* Release date: December 14, 2010
|
228 |
-
* Added Dutch translation - props Juliette Reinders Folmer.
|
229 |
-
* Don't hard code the languages folder path.
|
230 |
-
* Improve class check/initialization.
|
231 |
-
|
232 |
-
### 0.6 ###
|
233 |
-
* Release date: November 3, 2010
|
234 |
-
* Some code cleanup.
|
235 |
-
* More security hardening.
|
236 |
-
* Added filter to allow for the complete removal of the Author Base (http://brandonallen.org/2010/11/03/how-to-remove-the-author-base-with-edit-author-slug/).
|
237 |
-
* Flush rewrite rules only when necessary instead of every page load.
|
238 |
-
|
239 |
-
### 0.5 ###
|
240 |
-
* Release date: June 22, 2010
|
241 |
-
* Added 'Author Slug' column to Users > Authors & Users (Users > Users in 3.0) page (props Yonat Sharon for the jumpstart).
|
242 |
-
* Ended support for the WP 2.8 branch. Most likely still works, but I will not support it.
|
243 |
-
* Various bug fixes.
|
244 |
-
|
245 |
-
### 0.4 ###
|
246 |
-
* Release date: May 18, 2010
|
247 |
-
* Added ability to change the Author Base.
|
248 |
-
* Updated documentation.
|
249 |
-
* Added some extra security via WP esc_* functions.
|
250 |
-
* Added Belorussian translation, props Marcis G.
|
251 |
-
|
252 |
-
### 0.3.1 ###
|
253 |
-
* Release date: March 21, 2010
|
254 |
-
* Added Hebrew Translation, props Yonat Sharon.
|
255 |
-
|
256 |
-
### 0.3 ###
|
257 |
-
* Release date: March 21, 2010
|
258 |
-
* Now localization friendly.
|
259 |
-
|
260 |
-
### 0.2.1 ###
|
261 |
-
* Release date: February 15, 2010
|
262 |
-
* Fixed a bug that prevented updating a user if the author slug did not change.
|
263 |
-
|
264 |
-
### 0.2 ###
|
265 |
-
* Release date: January 27, 2010
|
266 |
-
* Added a check to avoid duplicate slugs.
|
267 |
-
* Properly sanitize slug before comparison and database insertion.
|
268 |
-
* Updated plugin URI.
|
269 |
-
|
270 |
-
### 0.1.4 ###
|
271 |
-
* Release date: January 18, 2010
|
272 |
-
* Update tags to reflect WordPress 2.9.1 compatibility.
|
273 |
-
* Update link to plugin homepage.
|
274 |
-
|
275 |
-
### 0.1.3 ###
|
276 |
-
* Release date: December 21, 2009
|
277 |
-
* Update tags to reflect WordPress 2.9 compatibility.
|
278 |
-
|
279 |
-
### 0.1.2 ###
|
280 |
-
* Release date: November 28, 2009
|
281 |
-
* Fix version number issues.
|
282 |
-
|
283 |
-
### 0.1.1 ###
|
284 |
-
* Release date: November 27, 2009
|
285 |
-
* Remove extra debug functions left behind.
|
286 |
-
* Add screenshot.
|
287 |
-
|
288 |
-
### 0.1 ###
|
289 |
-
* Release date: November 27, 2009
|
290 |
-
* Initial release.
|
291 |
-
|
292 |
-
## Upgrade Notice ##
|
293 |
-
|
294 |
-
### 1.0 ###
|
295 |
-
Role-based author bases are here!
|
296 |
-
|
297 |
-
### 0.4 ###
|
298 |
-
Adds ability to change the Author Base (not a required upgrade)
|
299 |
-
|
300 |
-
### 0.3 ###
|
301 |
-
Edit Author Slug can now be localized. You can find edit-author-slug.pot in 'edit-author-slug/languages' to get you started.
|
302 |
-
|
303 |
-
### 0.2 ###
|
304 |
-
Added a check to avoid duplicate duplicate author slugs, and better sanitization.
|
305 |
-
|
306 |
-
### TODO ###
|
307 |
-
* Allow Author Slug editing of users from one centralized location
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
=== Edit Author Slug ===
|
2 |
Contributors: thebrandonallen
|
3 |
Tags: author, author base, author slug, user nicename, nicename, permalink, permalinks, slug, users, user, role, roles
|
4 |
-
Requires at least: 4.
|
5 |
-
Tested up to: 4.
|
6 |
-
Stable tag: 1.
|
7 |
License: GPLv2 or later
|
8 |
-
License URI:
|
9 |
|
10 |
Allows an admin (or capable user) to edit the author slug of a user, and change the author base.
|
11 |
|
@@ -46,7 +46,7 @@ e.g. - https://example.com/author/author-slug/
|
|
46 |
|
47 |
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.
|
48 |
|
49 |
-
= Will my changes persist if I deactivate or delete the Edit Author Slug plugin? =
|
50 |
|
51 |
It depends.
|
52 |
|
@@ -54,42 +54,56 @@ Changing a user's author slug is permanent, as this changes the user's `user_nic
|
|
54 |
|
55 |
If you've changed the author base, deactivating or deleting the plugin will revert your author base back to `author`.
|
56 |
|
57 |
-
= Why can't I edit my Author Slug? =
|
58 |
|
59 |
Make sure you are an admin, or have been assigned the `edit_users` capability.
|
60 |
|
61 |
-
= Why isn't my new Author Slug working? =
|
62 |
|
63 |
-
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.
|
64 |
|
65 |
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.
|
66 |
|
67 |
== Changelog ==
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
= 1.4.1 =
|
70 |
-
* Release date:
|
71 |
* Fix failing string replacement in bulk update message.
|
72 |
|
73 |
= 1.4.0 =
|
74 |
-
* Release date:
|
75 |
* Lots of code cleanup to better adhere to WordPress Coding Standards.
|
76 |
* Improved performance of `ba_eas_sanitize_author_base()` by preventing unnecessary processing.
|
77 |
* Fixed an issue where the demo author permalink URL could have a double slash.
|
78 |
* Improvements to bulk update for sites with a large user base.
|
79 |
|
80 |
= 1.3.0 =
|
81 |
-
* Release date:
|
82 |
* Fix a potential bug where a sanitized author base could end up with double forward slashes.
|
83 |
* Introduce the `%ba_eas_author_role%` permalink structure tag. This can be used to customize role-based author bases.
|
84 |
* Bonus: All alternative facts are now free!
|
85 |
|
86 |
= 1.2.1 =
|
87 |
-
* Release date:
|
88 |
* Fixed stupid error where the default user nicename wasn't being properly retrieved from the database. Sorry about that :(
|
89 |
* Unfortunately, some unicorns were lost during the development of this release, but they are a resilient creature.
|
90 |
|
91 |
= 1.2.0 =
|
92 |
-
* Release date:
|
93 |
* Added the ability to use forward slashes in the author base.
|
94 |
* Improved display on the settings page, and storing, of role slugs.
|
95 |
* Packaged translations are now removed. Anyone interested in translating the plugin should do so at [Translate WordPress](https://translate.wordpress.org/projects/wp-plugins/edit-author-slug).
|
@@ -97,211 +111,5 @@ If this doesn't work, make sure you don't have any slug conflicts from other pos
|
|
97 |
* Added ability to remove the front portion of author links.
|
98 |
* Accessibility improvements to the settings page.
|
99 |
|
100 |
-
=
|
101 |
-
*
|
102 |
-
* Fix loading of minified JS in the admin. Props nuyensgert.
|
103 |
-
|
104 |
-
= 1.1.1 =
|
105 |
-
* Release date: September 29, 2015
|
106 |
-
* Fix a few minor output escaping issues missed in the 1.1.0 release.
|
107 |
-
|
108 |
-
= 1.1.0 =
|
109 |
-
* Release date: September 29, 2015
|
110 |
-
* Added the ability to update all author slugs at once with the "Bulk Update" tool.
|
111 |
-
* Greatly improved the checks and error messages when manually updating an author slug for a user.
|
112 |
-
* Further accessibility improvements to match WP 4.3.
|
113 |
-
* Improved validation of author slugs to better match that of WP.
|
114 |
-
|
115 |
-
= 1.0.6 =
|
116 |
-
* Release date: September 14, 2015
|
117 |
-
* Fix potential, although unlikely, persistent XSS vulnerability.
|
118 |
-
* Prevent debug notice in admin. Props chesio.
|
119 |
-
* Update heading tags to h1 to match WP 4.3.
|
120 |
-
|
121 |
-
= 1.0.5.1 =
|
122 |
-
* Release date: August 4, 2015
|
123 |
-
* Identical to 1.0.5, which failed to commit properly.
|
124 |
-
|
125 |
-
= 1.0.5 =
|
126 |
-
* Release date: August 4, 2015
|
127 |
-
* Add WP_User object as a parameter passed to the `ba_eas_show_user_nicename_options_list` filter
|
128 |
-
* Add Japanese translation files. Props SmokyJp.
|
129 |
-
* Fixed possible (although unlikely) cache invalidation issue
|
130 |
-
* Minor code improvements and optimizations.
|
131 |
-
|
132 |
-
= 1.0.4 =
|
133 |
-
* Release date: April 21, 2015
|
134 |
-
* Improve upgrade routine for older installs
|
135 |
-
* Improve output escaping
|
136 |
-
* Various minor fixes and improvements
|
137 |
-
|
138 |
-
= 1.0.3 =
|
139 |
-
* Release date: October 8, 2014
|
140 |
-
|
141 |
-
I swear I tested this! :(
|
142 |
-
|
143 |
-
* Fix custom roles slugs not saving
|
144 |
-
|
145 |
-
= 1.0.2 =
|
146 |
-
* Release date: September 4, 2014
|
147 |
-
* A number of localization fixes and improvements
|
148 |
-
* Role slug improvements
|
149 |
-
* Temporary, semi work-around for Co-Authors Plus [https://github.com/Automattic/Co-Authors-Plus/pull/204]
|
150 |
-
|
151 |
-
= 1.0.1 =
|
152 |
-
* Release date: April 17, 2014
|
153 |
-
* Fix possible syntax error when updating a profile (props Christine https://wordpress.org/support/topic/undefined-property-error-1)
|
154 |
-
|
155 |
-
= 1.0 =
|
156 |
-
* Release date: February 26, 2014
|
157 |
-
* Added ability to do role-based author bases
|
158 |
-
* Added ability to use role-based author templates
|
159 |
-
* Moderate code refactoring
|
160 |
-
* Various code fixes and improvements
|
161 |
-
* Add "nickname" as option for auto-update
|
162 |
-
* First pass at unit test (only checks if the plugin is installed, for now)
|
163 |
-
|
164 |
-
= 0.9.6 =
|
165 |
-
* Release date: December 18, 2013
|
166 |
-
* Fixed loading of translation files. Looks in wp-content/plugins/edit-author-slug/languages. If you're running 3.7+ (and you are... aren't you?), it will fall back to wp-content/languages/plugins if a proper localization can't be found in the edit-author-slug folder.
|
167 |
-
|
168 |
-
= 0.9.5 =
|
169 |
-
* Release date: April 29, 2013
|
170 |
-
* Fixed instances where the Author Base wouldn't change, or would result in a 404
|
171 |
-
|
172 |
-
= 0.9.4 =
|
173 |
-
* Release date: January 31, 2013
|
174 |
-
* Update readme references to plugin settings
|
175 |
-
* Fix some copy pasta in settings
|
176 |
-
* Update screenshots
|
177 |
-
|
178 |
-
= 0.9.3 =
|
179 |
-
* Release date: January 31, 2013
|
180 |
-
* Quickly caught a few things I missed, so this release was skipped. See 0.9.4 for changes
|
181 |
-
|
182 |
-
= 0.9.2 =
|
183 |
-
* Release date: June 25, 2012
|
184 |
-
* Fix issue where any profile information other than the Author Slug could not be updated
|
185 |
-
* Minor code improvement
|
186 |
-
|
187 |
-
= 0.9.1 =
|
188 |
-
* Release date: June 14, 2012
|
189 |
-
* Add 'Settings' link to plugins list table
|
190 |
-
|
191 |
-
= 0.9 =
|
192 |
-
* Release date: June 13, 2012
|
193 |
-
* Allow Author Slug to be automatically created/updated based on a defined structure
|
194 |
-
* Switched to using the Settings API, which also means that all options moved to the Settings > Edit Author Slug page
|
195 |
-
* Various code improvements/optimizations
|
196 |
-
|
197 |
-
= 0.8.1 =
|
198 |
-
* Release date: February 14, 2012
|
199 |
-
* Fix a bug that prevented non-admin users from updating their profile
|
200 |
-
|
201 |
-
= 0.8 =
|
202 |
-
* Release date: December 15, 2011
|
203 |
-
* Drastically improved error handling and feedback for author slug editing.
|
204 |
-
* Restore duplicate author slug check as old method could alter the slug without any sort of warning.
|
205 |
-
* Further improve the logic for flushing rewrite rules.
|
206 |
-
* Introduce ba_eas_can_edit_author_slug() and matching filter to make it even easier to give users the ability to update their own author slug.
|
207 |
-
* Add message in plugins list warning users of WP less than 3.2 that 0.8 is the last update they'll receive.
|
208 |
-
|
209 |
-
= 0.7.2 =
|
210 |
-
* Release date: February 13, 2011
|
211 |
-
* Remove overzealous cap check.
|
212 |
-
|
213 |
-
= 0.7.1 =
|
214 |
-
* Release date: February 13, 2011
|
215 |
-
* Fix some unfortunate errors I missed before tagging 0.7.
|
216 |
-
|
217 |
-
= 0.7 =
|
218 |
-
* Release date: February 13, 2011
|
219 |
-
* Significant code refactoring.
|
220 |
-
* Added custom capability to give site admins the ability to add author slug access to other roles.
|
221 |
-
* Improvements/optimizations to code logic.
|
222 |
-
* Fixed an incorrect textdomain string.
|
223 |
-
* Removed filter added in 0.6 as it was messy. It's much easier to achieve the same result without the plugin.
|
224 |
-
* Got rid of wp_die() statement on duplicate author slugs in favor of WP's built-in duplicate author slug method.
|
225 |
-
|
226 |
-
= 0.6.1 =
|
227 |
-
* Release date: December 14, 2010
|
228 |
-
* Added Dutch translation - props Juliette Reinders Folmer.
|
229 |
-
* Don't hard code the languages folder path.
|
230 |
-
* Improve class check/initialization.
|
231 |
-
|
232 |
-
= 0.6 =
|
233 |
-
* Release date: November 3, 2010
|
234 |
-
* Some code cleanup.
|
235 |
-
* More security hardening.
|
236 |
-
* Added filter to allow for the complete removal of the Author Base (http://brandonallen.org/2010/11/03/how-to-remove-the-author-base-with-edit-author-slug/).
|
237 |
-
* Flush rewrite rules only when necessary instead of every page load.
|
238 |
-
|
239 |
-
= 0.5 =
|
240 |
-
* Release date: June 22, 2010
|
241 |
-
* Added 'Author Slug' column to Users > Authors & Users (Users > Users in 3.0) page (props Yonat Sharon for the jumpstart).
|
242 |
-
* Ended support for the WP 2.8 branch. Most likely still works, but I will not support it.
|
243 |
-
* Various bug fixes.
|
244 |
-
|
245 |
-
= 0.4 =
|
246 |
-
* Release date: May 18, 2010
|
247 |
-
* Added ability to change the Author Base.
|
248 |
-
* Updated documentation.
|
249 |
-
* Added some extra security via WP esc_* functions.
|
250 |
-
* Added Belorussian translation, props Marcis G.
|
251 |
-
|
252 |
-
= 0.3.1 =
|
253 |
-
* Release date: March 21, 2010
|
254 |
-
* Added Hebrew Translation, props Yonat Sharon.
|
255 |
-
|
256 |
-
= 0.3 =
|
257 |
-
* Release date: March 21, 2010
|
258 |
-
* Now localization friendly.
|
259 |
-
|
260 |
-
= 0.2.1 =
|
261 |
-
* Release date: February 15, 2010
|
262 |
-
* Fixed a bug that prevented updating a user if the author slug did not change.
|
263 |
-
|
264 |
-
= 0.2 =
|
265 |
-
* Release date: January 27, 2010
|
266 |
-
* Added a check to avoid duplicate slugs.
|
267 |
-
* Properly sanitize slug before comparison and database insertion.
|
268 |
-
* Updated plugin URI.
|
269 |
-
|
270 |
-
= 0.1.4 =
|
271 |
-
* Release date: January 18, 2010
|
272 |
-
* Update tags to reflect WordPress 2.9.1 compatibility.
|
273 |
-
* Update link to plugin homepage.
|
274 |
-
|
275 |
-
= 0.1.3 =
|
276 |
-
* Release date: December 21, 2009
|
277 |
-
* Update tags to reflect WordPress 2.9 compatibility.
|
278 |
-
|
279 |
-
= 0.1.2 =
|
280 |
-
* Release date: November 28, 2009
|
281 |
-
* Fix version number issues.
|
282 |
-
|
283 |
-
= 0.1.1 =
|
284 |
-
* Release date: November 27, 2009
|
285 |
-
* Remove extra debug functions left behind.
|
286 |
-
* Add screenshot.
|
287 |
-
|
288 |
-
= 0.1 =
|
289 |
-
* Release date: November 27, 2009
|
290 |
-
* Initial release.
|
291 |
-
|
292 |
-
== Upgrade Notice ==
|
293 |
-
|
294 |
-
= 1.0 =
|
295 |
-
Role-based author bases are here!
|
296 |
-
|
297 |
-
= 0.4 =
|
298 |
-
Adds ability to change the Author Base (not a required upgrade)
|
299 |
-
|
300 |
-
= 0.3 =
|
301 |
-
Edit Author Slug can now be localized. You can find edit-author-slug.pot in 'edit-author-slug/languages' to get you started.
|
302 |
-
|
303 |
-
= 0.2 =
|
304 |
-
Added a check to avoid duplicate duplicate author slugs, and better sanitization.
|
305 |
-
|
306 |
-
= TODO =
|
307 |
-
* Allow Author Slug editing of users from one centralized location
|
1 |
=== Edit Author Slug ===
|
2 |
Contributors: thebrandonallen
|
3 |
Tags: author, author base, author slug, user nicename, nicename, permalink, permalinks, slug, users, user, role, roles
|
4 |
+
Requires at least: 4.4
|
5 |
+
Tested up to: 4.8
|
6 |
+
Stable tag: 1.5.2
|
7 |
License: GPLv2 or later
|
8 |
+
License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
9 |
|
10 |
Allows an admin (or capable user) to edit the author slug of a user, and change the author base.
|
11 |
|
46 |
|
47 |
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.
|
48 |
|
49 |
+
= Will my changes persist if I deactivate or delete the Edit Author Slug plugin? =
|
50 |
|
51 |
It depends.
|
52 |
|
54 |
|
55 |
If you've changed the author base, deactivating or deleting the plugin will revert your author base back to `author`.
|
56 |
|
57 |
+
= Why can't I edit my Author Slug? =
|
58 |
|
59 |
Make sure you are an admin, or have been assigned the `edit_users` capability.
|
60 |
|
61 |
+
= Why isn't my new Author Slug working? =
|
62 |
|
63 |
+
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.
|
64 |
|
65 |
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.
|
66 |
|
67 |
== Changelog ==
|
68 |
|
69 |
+
= 1.5.2 =
|
70 |
+
* Release date: 2017-06-21
|
71 |
+
* 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.
|
72 |
+
|
73 |
+
= 1.5.1 =
|
74 |
+
* Release date: 2017-06-02
|
75 |
+
* Fix PHP notice when manually updating a user profile. Props @mydigitalsauce.
|
76 |
+
|
77 |
+
= 1.5.0 =
|
78 |
+
* Release date: 2017-05-30
|
79 |
+
* Bumped minimum required WordPress version to 4.4.
|
80 |
+
* 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.
|
81 |
+
* This release is primarily an under-the-hood release with a number of optimizations and performance improvements.
|
82 |
+
|
83 |
= 1.4.1 =
|
84 |
+
* Release date: 2017-04-24
|
85 |
* Fix failing string replacement in bulk update message.
|
86 |
|
87 |
= 1.4.0 =
|
88 |
+
* Release date: 2017-04-04
|
89 |
* Lots of code cleanup to better adhere to WordPress Coding Standards.
|
90 |
* Improved performance of `ba_eas_sanitize_author_base()` by preventing unnecessary processing.
|
91 |
* Fixed an issue where the demo author permalink URL could have a double slash.
|
92 |
* Improvements to bulk update for sites with a large user base.
|
93 |
|
94 |
= 1.3.0 =
|
95 |
+
* Release date: 2017-01-25
|
96 |
* Fix a potential bug where a sanitized author base could end up with double forward slashes.
|
97 |
* Introduce the `%ba_eas_author_role%` permalink structure tag. This can be used to customize role-based author bases.
|
98 |
* Bonus: All alternative facts are now free!
|
99 |
|
100 |
= 1.2.1 =
|
101 |
+
* Release date: 2016-02-29
|
102 |
* Fixed stupid error where the default user nicename wasn't being properly retrieved from the database. Sorry about that :(
|
103 |
* Unfortunately, some unicorns were lost during the development of this release, but they are a resilient creature.
|
104 |
|
105 |
= 1.2.0 =
|
106 |
+
* Release date: 2016-02-01
|
107 |
* Added the ability to use forward slashes in the author base.
|
108 |
* Improved display on the settings page, and storing, of role slugs.
|
109 |
* Packaged translations are now removed. Anyone interested in translating the plugin should do so at [Translate WordPress](https://translate.wordpress.org/projects/wp-plugins/edit-author-slug).
|
111 |
* Added ability to remove the front portion of author links.
|
112 |
* Accessibility improvements to the settings page.
|
113 |
|
114 |
+
= Full Changelog =
|
115 |
+
* https://github.com/thebrandonallen/edit-author-slug/blob/master/CHANGELOG.md
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uninstall.php
CHANGED
@@ -13,7 +13,7 @@ defined( 'ABSPATH' ) || exit;
|
|
13 |
|
14 |
// Make sure we're uninstalling.
|
15 |
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
16 |
-
exit
|
17 |
}
|
18 |
|
19 |
// Delete all the options.
|
13 |
|
14 |
// Make sure we're uninstalling.
|
15 |
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
16 |
+
exit;
|
17 |
}
|
18 |
|
19 |
// Delete all the options.
|