Version Description
- Release date: April 24, 2017
- Fix failing string replacement in bulk update message.
Download this release
Release Info
| Developer | thebrandonallen |
| Plugin | |
| Version | 1.4.1 |
| Comparing to | |
| See all releases | |
Code changes from version 1.3.0 to 1.4.1
- edit-author-slug.php +115 -72
- includes/admin.php +67 -48
- includes/functions.php +167 -104
- js/edit-author-slug.min.js +1 -1
- languages/edit-author-slug.pot +59 -53
- readme.md +73 -7
- readme.txt +73 -7
edit-author-slug.php
CHANGED
|
@@ -1,24 +1,22 @@
|
|
| 1 |
<?php
|
| 2 |
/**
|
| 3 |
-
* Plugin Name:
|
| 4 |
-
* Plugin URI:
|
| 5 |
-
* Description:
|
| 6 |
-
*
|
| 7 |
-
*
|
| 8 |
-
*
|
| 9 |
-
*
|
| 10 |
-
*
|
| 11 |
-
* Text Domain: edit-author-slug
|
| 12 |
-
* Domain Path: /languages
|
| 13 |
*
|
| 14 |
* @package Edit_Author_Slug
|
| 15 |
* @subpackage Main
|
| 16 |
* @author Brandon Allen
|
| 17 |
-
* @version 1.
|
| 18 |
*/
|
| 19 |
|
| 20 |
/*
|
| 21 |
-
Copyright 2009-
|
| 22 |
|
| 23 |
This program is free software; you can redistribute it and/or modify
|
| 24 |
it under the terms of the GNU General Public License as published by
|
|
@@ -34,7 +32,7 @@
|
|
| 34 |
along with this program; if not, write to the Free Software
|
| 35 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
| 36 |
|
| 37 |
-
|
| 38 |
*/
|
| 39 |
|
| 40 |
// Exit if accessed directly.
|
|
@@ -57,20 +55,18 @@ if ( ! class_exists( 'BA_Edit_Author_Slug' ) ) :
|
|
| 57 |
/**
|
| 58 |
* The plugin version.
|
| 59 |
*
|
| 60 |
-
* @since
|
| 61 |
-
* @
|
| 62 |
-
* @var string
|
| 63 |
*/
|
| 64 |
-
|
| 65 |
|
| 66 |
/**
|
| 67 |
-
* The
|
| 68 |
*
|
| 69 |
-
* @since
|
| 70 |
-
* @
|
| 71 |
-
* @var int
|
| 72 |
*/
|
| 73 |
-
|
| 74 |
|
| 75 |
/**
|
| 76 |
* The current installed database version.
|
|
@@ -117,15 +113,6 @@ if ( ! class_exists( 'BA_Edit_Author_Slug' ) ) :
|
|
| 117 |
*/
|
| 118 |
public $plugin_basename = '';
|
| 119 |
|
| 120 |
-
/**
|
| 121 |
-
* The text domain for Edit Author Slug.
|
| 122 |
-
*
|
| 123 |
-
* @since 0.9.6
|
| 124 |
-
* @access public
|
| 125 |
-
* @var string
|
| 126 |
-
*/
|
| 127 |
-
public $domain = 'edit-author-slug';
|
| 128 |
-
|
| 129 |
/**
|
| 130 |
* The author base.
|
| 131 |
*
|
|
@@ -204,17 +191,50 @@ if ( ! class_exists( 'BA_Edit_Author_Slug' ) ) :
|
|
| 204 |
|
| 205 |
// Only run these methods if they haven't been ran previously.
|
| 206 |
if ( null === $instance ) {
|
| 207 |
-
$instance = new
|
| 208 |
-
$instance->setup_globals();
|
| 209 |
-
$instance->includes();
|
| 210 |
-
$instance->options_back_compat();
|
| 211 |
-
$instance->setup_actions();
|
| 212 |
}
|
| 213 |
|
| 214 |
// Always return the instance.
|
| 215 |
return $instance;
|
| 216 |
}
|
| 217 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
/**
|
| 219 |
* Magic method to prevent notices and errors from invalid method calls.
|
| 220 |
*
|
|
@@ -231,7 +251,11 @@ if ( ! class_exists( 'BA_Edit_Author_Slug' ) ) :
|
|
| 231 |
_deprecated_function( 'BA_Edit_Author_Slug::author_base_rewrite', '1.2.0', 'ba_eas_wp_rewrite_overrides' );
|
| 232 |
ba_eas_wp_rewrite_overrides();
|
| 233 |
} else {
|
| 234 |
-
_doing_it_wrong(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 235 |
}
|
| 236 |
|
| 237 |
unset( $name, $args );
|
|
@@ -250,7 +274,11 @@ if ( ! class_exists( 'BA_Edit_Author_Slug' ) ) :
|
|
| 250 |
* @return void
|
| 251 |
*/
|
| 252 |
private function __clone() {
|
| 253 |
-
_doing_it_wrong(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 254 |
}
|
| 255 |
|
| 256 |
/**
|
|
@@ -263,7 +291,11 @@ if ( ! class_exists( 'BA_Edit_Author_Slug' ) ) :
|
|
| 263 |
* @return void
|
| 264 |
*/
|
| 265 |
private function __wakeup() {
|
| 266 |
-
_doing_it_wrong(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 267 |
}
|
| 268 |
|
| 269 |
/* Private Methods ****************************************************/
|
|
@@ -286,10 +318,12 @@ if ( ! class_exists( 'BA_Edit_Author_Slug' ) ) :
|
|
| 286 |
/* Options ********************************************************/
|
| 287 |
|
| 288 |
// Load the remove front option.
|
| 289 |
-
$
|
|
|
|
| 290 |
|
| 291 |
// Load auto-update option.
|
| 292 |
-
$
|
|
|
|
| 293 |
|
| 294 |
// Load the default nicename structure for auto-update.
|
| 295 |
$default_user_nicename = get_option( '_ba_eas_default_user_nicename' );
|
|
@@ -299,7 +333,8 @@ if ( ! class_exists( 'BA_Edit_Author_Slug' ) ) :
|
|
| 299 |
}
|
| 300 |
|
| 301 |
// Load role-based author slug option.
|
| 302 |
-
$
|
|
|
|
| 303 |
}
|
| 304 |
|
| 305 |
/**
|
|
@@ -321,6 +356,34 @@ if ( ! class_exists( 'BA_Edit_Author_Slug' ) ) :
|
|
| 321 |
}
|
| 322 |
}
|
| 323 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 324 |
/**
|
| 325 |
* Display Author slug edit field on User/Profile edit page.
|
| 326 |
*
|
|
@@ -352,37 +415,17 @@ if ( ! class_exists( 'BA_Edit_Author_Slug' ) ) :
|
|
| 352 |
*/
|
| 353 |
private function options_back_compat() {
|
| 354 |
|
| 355 |
-
//
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
// Sanitize the db value.
|
| 359 |
-
$base = ba_eas_sanitize_author_base( $base );
|
| 360 |
-
|
| 361 |
-
// Author base.
|
| 362 |
-
if ( ! empty( $base ) ) {
|
| 363 |
-
$this->author_base = $base;
|
| 364 |
-
}
|
| 365 |
-
|
| 366 |
-
// Current DB version.
|
| 367 |
-
$this->current_db_version = absint( get_option( '_ba_eas_db_version' ) );
|
| 368 |
-
|
| 369 |
-
// Pre-0.9 Back compat.
|
| 370 |
-
} elseif ( $options = get_option( 'ba_edit_author_slug' ) ) {
|
| 371 |
-
|
| 372 |
-
// Sanitize the db value.
|
| 373 |
-
if ( ! empty( $options['author_base'] ) ) {
|
| 374 |
-
$base = ba_eas_sanitize_author_base( $options['author_base'] );
|
| 375 |
-
}
|
| 376 |
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
}
|
| 386 |
}
|
| 387 |
}
|
| 388 |
|
|
@@ -406,7 +449,7 @@ if ( ! class_exists( 'BA_Edit_Author_Slug' ) ) :
|
|
| 406 |
|
| 407 |
// Look in wp-content/plugins/edit-author-slug/languages first.
|
| 408 |
// Fallback to wp-content/languages/plugins.
|
| 409 |
-
load_plugin_textdomain(
|
| 410 |
}
|
| 411 |
|
| 412 |
/**
|
| 1 |
<?php
|
| 2 |
/**
|
| 3 |
+
* Plugin Name: Edit Author Slug
|
| 4 |
+
* Plugin URI: https://github.com/thebrandonallen/edit-author-slug/
|
| 5 |
+
* Description: Allows an Admin (or capable user) to edit the author slug of a user, and change the Author Base. <em>i.e. - (WordPress default structure) http://example.com/author/username/ (Plugin allows) http://example.com/ninja/master-ninja/</em>
|
| 6 |
+
* Author: Brandon Allen
|
| 7 |
+
* Author URI: https://github.com/thebrandonallen/
|
| 8 |
+
* Text Domain: edit-author-slug
|
| 9 |
+
* Domain Path: /languages
|
| 10 |
+
* Version: 1.4.1
|
|
|
|
|
|
|
| 11 |
*
|
| 12 |
* @package Edit_Author_Slug
|
| 13 |
* @subpackage Main
|
| 14 |
* @author Brandon Allen
|
| 15 |
+
* @version 1.4.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
|
| 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.
|
| 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.
|
| 113 |
*/
|
| 114 |
public $plugin_basename = '';
|
| 115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
/**
|
| 117 |
* The author base.
|
| 118 |
*
|
| 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 |
*
|
| 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 );
|
| 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 |
/**
|
| 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 ****************************************************/
|
| 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' );
|
| 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 |
/**
|
| 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 |
*
|
| 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 |
|
| 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 |
/**
|
includes/admin.php
CHANGED
|
@@ -26,39 +26,23 @@ defined( 'ABSPATH' ) || exit;
|
|
| 26 |
function ba_eas_show_user_nicename( $user ) {
|
| 27 |
|
| 28 |
// Return early if the user can't edit the author slug.
|
| 29 |
-
if ( ! ba_eas_can_edit_author_slug() ) {
|
| 30 |
return;
|
| 31 |
}
|
| 32 |
|
| 33 |
// Setup the nicename.
|
| 34 |
-
$nicename =
|
| 35 |
-
if ( ! empty( $user->user_nicename ) ) {
|
| 36 |
-
$nicename = $user->user_nicename;
|
| 37 |
-
}
|
| 38 |
|
| 39 |
// Setup options array.
|
| 40 |
-
$options = array(
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
// Setup the last name.
|
| 50 |
-
if ( ! empty( $user->last_name ) ) {
|
| 51 |
-
$options['lastname'] = ba_eas_sanitize_nicename( $user->last_name );
|
| 52 |
-
}
|
| 53 |
-
|
| 54 |
-
// Setup the first/last name combos.
|
| 55 |
-
if ( ! empty( $options['firstname'] ) && ! empty( $options['lastname'] ) ) {
|
| 56 |
-
$options['firslast'] = $options['firstname'] . '-' . $options['lastname'];
|
| 57 |
-
$options['lastfirst'] = $options['lastname'] . '-' . $options['firstname'];
|
| 58 |
-
}
|
| 59 |
-
|
| 60 |
-
// Setup the user id.
|
| 61 |
-
$options['userid'] = (int) $user->ID;
|
| 62 |
|
| 63 |
/**
|
| 64 |
* Filters the array of user nicename options.
|
|
@@ -153,7 +137,8 @@ function ba_eas_update_user_nicename( $errors, $update, $user ) {
|
|
| 153 |
// Stash the original user object.
|
| 154 |
$_user = get_userdata( $user->ID );
|
| 155 |
|
| 156 |
-
$user_nicename
|
|
|
|
| 157 |
|
| 158 |
if ( isset( $_POST['ba_eas_author_slug'] ) ) {
|
| 159 |
$user_nicename = trim( wp_unslash( $_POST['ba_eas_author_slug'] ) );
|
|
@@ -184,7 +169,8 @@ function ba_eas_update_user_nicename( $errors, $update, $user ) {
|
|
| 184 |
$ascii = ba_eas_nicename_is_ascii( $user_nicename );
|
| 185 |
|
| 186 |
// Sanitize the author slug and cache the pre-filtered, sanitized version.
|
| 187 |
-
$user_nicename
|
|
|
|
| 188 |
|
| 189 |
/**
|
| 190 |
* Filters the sanitized user nicename before any final checks are run.
|
|
@@ -248,6 +234,7 @@ function ba_eas_update_user_nicename( $errors, $update, $user ) {
|
|
| 248 |
if ( $exists && (int) $exists->ID !== $user->ID ) {
|
| 249 |
|
| 250 |
// Setup the error message.
|
|
|
|
| 251 |
$message = __(
|
| 252 |
'<strong>ERROR</strong>: The author slug, %1$s, already exists. Please try something different.',
|
| 253 |
'edit-author-slug'
|
|
@@ -368,7 +355,7 @@ function ba_eas_show_user_nicename_scripts( $hook_suffix = '' ) {
|
|
| 368 |
);
|
| 369 |
|
| 370 |
// Bail if we shouldn't add our js.
|
| 371 |
-
if ( ! in_array( $hook_suffix, $user_pages ) || ! ba_eas_can_edit_author_slug() ) {
|
| 372 |
return;
|
| 373 |
}
|
| 374 |
|
|
@@ -448,7 +435,9 @@ function ba_eas_register_admin_settings() {
|
|
| 448 |
'ba_eas_admin_setting_callback_author_base',
|
| 449 |
'edit-author-slug',
|
| 450 |
'ba_eas_author_base',
|
| 451 |
-
array(
|
|
|
|
|
|
|
| 452 |
);
|
| 453 |
register_setting( 'edit-author-slug', '_ba_eas_author_base', 'ba_eas_sanitize_author_base' );
|
| 454 |
|
|
@@ -460,7 +449,9 @@ function ba_eas_register_admin_settings() {
|
|
| 460 |
'ba_eas_admin_setting_callback_remove_front',
|
| 461 |
'edit-author-slug',
|
| 462 |
'ba_eas_author_base',
|
| 463 |
-
array(
|
|
|
|
|
|
|
| 464 |
);
|
| 465 |
register_setting( 'edit-author-slug', '_ba_eas_remove_front', 'intval' );
|
| 466 |
}
|
|
@@ -472,7 +463,9 @@ function ba_eas_register_admin_settings() {
|
|
| 472 |
'ba_eas_admin_setting_callback_do_role_based',
|
| 473 |
'edit-author-slug',
|
| 474 |
'ba_eas_author_base',
|
| 475 |
-
array(
|
|
|
|
|
|
|
| 476 |
);
|
| 477 |
register_setting( 'edit-author-slug', '_ba_eas_do_role_based', 'intval' );
|
| 478 |
|
|
@@ -501,7 +494,9 @@ function ba_eas_register_admin_settings() {
|
|
| 501 |
'ba_eas_admin_setting_callback_do_auto_update',
|
| 502 |
'edit-author-slug',
|
| 503 |
'ba_eas_auto_update',
|
| 504 |
-
array(
|
|
|
|
|
|
|
| 505 |
);
|
| 506 |
register_setting( 'edit-author-slug', '_ba_eas_do_auto_update', 'intval' );
|
| 507 |
|
|
@@ -512,7 +507,9 @@ function ba_eas_register_admin_settings() {
|
|
| 512 |
'ba_eas_admin_setting_callback_default_user_nicename',
|
| 513 |
'edit-author-slug',
|
| 514 |
'ba_eas_auto_update',
|
| 515 |
-
array(
|
|
|
|
|
|
|
| 516 |
);
|
| 517 |
register_setting( 'edit-author-slug', '_ba_eas_default_user_nicename', 'sanitize_key' );
|
| 518 |
|
|
@@ -531,7 +528,9 @@ function ba_eas_register_admin_settings() {
|
|
| 531 |
'ba_eas_admin_setting_callback_bulk_update',
|
| 532 |
'edit-author-slug',
|
| 533 |
'ba_eas_bulk_update',
|
| 534 |
-
array(
|
|
|
|
|
|
|
| 535 |
);
|
| 536 |
register_setting( 'edit-author-slug', '_ba_eas_bulk_update', 'ba_eas_auto_update_user_nicename_bulk' );
|
| 537 |
|
|
@@ -542,7 +541,9 @@ function ba_eas_register_admin_settings() {
|
|
| 542 |
'ba_eas_admin_setting_callback_bulk_update_structure',
|
| 543 |
'edit-author-slug',
|
| 544 |
'ba_eas_bulk_update',
|
| 545 |
-
array(
|
|
|
|
|
|
|
| 546 |
);
|
| 547 |
register_setting( 'edit-author-slug', '_ba_eas_bulk_update_structure', '__return_false' );
|
| 548 |
}
|
|
@@ -581,18 +582,27 @@ function ba_eas_admin_setting_callback_auto_update_section() {
|
|
| 581 |
function ba_eas_admin_setting_callback_author_base() {
|
| 582 |
|
| 583 |
$author_base = ba_eas_sanitize_author_base( ba_eas()->author_base );
|
|
|
|
| 584 |
|
| 585 |
-
//
|
| 586 |
-
|
| 587 |
-
|
| 588 |
-
|
| 589 |
-
$author_link = $author_link . user_trailingslashit( '/author-slug' );
|
| 590 |
?>
|
| 591 |
|
| 592 |
<input id="_ba_eas_author_base" name="_ba_eas_author_base" type="text" value="<?php echo esc_attr( $author_base ); ?>" class="regular-text code" />
|
| 593 |
<em><?php esc_html_e( "Defaults to 'author'", 'edit-author-slug' ); ?></em>
|
| 594 |
<br /><br />
|
| 595 |
-
<strong>Demo:</strong>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 596 |
|
| 597 |
<?php
|
| 598 |
}
|
|
@@ -625,6 +635,7 @@ function ba_eas_admin_setting_callback_do_role_based() {
|
|
| 625 |
<?php esc_html_e( "Set user's Author Base according to their role.", 'edit-author-slug' ); ?>
|
| 626 |
<br /><br />
|
| 627 |
<?php echo sprintf(
|
|
|
|
| 628 |
esc_html__(
|
| 629 |
'Use the %1$s rewrite tag to customize the role-based author base. If you set the author base to "%2$s", the resulting author structure will be something like "%3$s".',
|
| 630 |
'edit-author-slug'
|
|
@@ -845,7 +856,15 @@ function ba_eas_admin_setting_callback_bulk_update_structure() {
|
|
| 845 |
function ba_eas_add_settings_link( $links, $file ) {
|
| 846 |
|
| 847 |
if ( ba_eas()->plugin_basename === $file ) {
|
| 848 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 849 |
array_unshift( $links, $settings_link );
|
| 850 |
}
|
| 851 |
|
|
@@ -900,13 +919,13 @@ function ba_eas_default_user_nicename_options_list() {
|
|
| 900 |
*/
|
| 901 |
function ba_eas_settings_updated() {
|
| 902 |
|
| 903 |
-
//
|
| 904 |
-
if ( ! isset( $_REQUEST['
|
| 905 |
return;
|
| 906 |
}
|
| 907 |
|
| 908 |
-
//
|
| 909 |
-
if ( ! isset( $_REQUEST['
|
| 910 |
return;
|
| 911 |
}
|
| 912 |
|
| 26 |
function ba_eas_show_user_nicename( $user ) {
|
| 27 |
|
| 28 |
// Return early if the user can't edit the author slug.
|
| 29 |
+
if ( empty( $user->ID ) || ! ba_eas_can_edit_author_slug() ) {
|
| 30 |
return;
|
| 31 |
}
|
| 32 |
|
| 33 |
// Setup the nicename.
|
| 34 |
+
$nicename = $user->user_nicename;
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
// Setup options array.
|
| 37 |
+
$options = array(
|
| 38 |
+
'username' => ba_eas_get_nicename_by_structure( $user->ID, 'username' ),
|
| 39 |
+
'displayname' => ba_eas_get_nicename_by_structure( $user->ID, 'displayname' ),
|
| 40 |
+
'firstname' => ba_eas_get_nicename_by_structure( $user->ID, 'firstname' ),
|
| 41 |
+
'lastname' => ba_eas_get_nicename_by_structure( $user->ID, 'lastname' ),
|
| 42 |
+
'firstlast' => ba_eas_get_nicename_by_structure( $user->ID, 'firstlast' ),
|
| 43 |
+
'lastfirst' => ba_eas_get_nicename_by_structure( $user->ID, 'lastfirst' ),
|
| 44 |
+
'userid' => ba_eas_get_nicename_by_structure( $user->ID, 'userid' ),
|
| 45 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
/**
|
| 48 |
* Filters the array of user nicename options.
|
| 137 |
// Stash the original user object.
|
| 138 |
$_user = get_userdata( $user->ID );
|
| 139 |
|
| 140 |
+
$user_nicename = '';
|
| 141 |
+
$user_nicename_custom = '';
|
| 142 |
|
| 143 |
if ( isset( $_POST['ba_eas_author_slug'] ) ) {
|
| 144 |
$user_nicename = trim( wp_unslash( $_POST['ba_eas_author_slug'] ) );
|
| 169 |
$ascii = ba_eas_nicename_is_ascii( $user_nicename );
|
| 170 |
|
| 171 |
// Sanitize the author slug and cache the pre-filtered, sanitized version.
|
| 172 |
+
$user_nicename = ba_eas_sanitize_nicename( $user_nicename );
|
| 173 |
+
$raw_nicename_sanitized = $user_nicename;
|
| 174 |
|
| 175 |
/**
|
| 176 |
* Filters the sanitized user nicename before any final checks are run.
|
| 234 |
if ( $exists && (int) $exists->ID !== $user->ID ) {
|
| 235 |
|
| 236 |
// Setup the error message.
|
| 237 |
+
/* translators: 1: author slug */
|
| 238 |
$message = __(
|
| 239 |
'<strong>ERROR</strong>: The author slug, %1$s, already exists. Please try something different.',
|
| 240 |
'edit-author-slug'
|
| 355 |
);
|
| 356 |
|
| 357 |
// Bail if we shouldn't add our js.
|
| 358 |
+
if ( ! in_array( $hook_suffix, $user_pages, true ) || ! ba_eas_can_edit_author_slug() ) {
|
| 359 |
return;
|
| 360 |
}
|
| 361 |
|
| 435 |
'ba_eas_admin_setting_callback_author_base',
|
| 436 |
'edit-author-slug',
|
| 437 |
'ba_eas_author_base',
|
| 438 |
+
array(
|
| 439 |
+
'label_for' => '_ba_eas_author_base',
|
| 440 |
+
)
|
| 441 |
);
|
| 442 |
register_setting( 'edit-author-slug', '_ba_eas_author_base', 'ba_eas_sanitize_author_base' );
|
| 443 |
|
| 449 |
'ba_eas_admin_setting_callback_remove_front',
|
| 450 |
'edit-author-slug',
|
| 451 |
'ba_eas_author_base',
|
| 452 |
+
array(
|
| 453 |
+
'label_for' => '_ba_eas_remove_front',
|
| 454 |
+
)
|
| 455 |
);
|
| 456 |
register_setting( 'edit-author-slug', '_ba_eas_remove_front', 'intval' );
|
| 457 |
}
|
| 463 |
'ba_eas_admin_setting_callback_do_role_based',
|
| 464 |
'edit-author-slug',
|
| 465 |
'ba_eas_author_base',
|
| 466 |
+
array(
|
| 467 |
+
'label_for' => '_ba_eas_do_role_based',
|
| 468 |
+
)
|
| 469 |
);
|
| 470 |
register_setting( 'edit-author-slug', '_ba_eas_do_role_based', 'intval' );
|
| 471 |
|
| 494 |
'ba_eas_admin_setting_callback_do_auto_update',
|
| 495 |
'edit-author-slug',
|
| 496 |
'ba_eas_auto_update',
|
| 497 |
+
array(
|
| 498 |
+
'label_for' => '_ba_eas_do_auto_update',
|
| 499 |
+
)
|
| 500 |
);
|
| 501 |
register_setting( 'edit-author-slug', '_ba_eas_do_auto_update', 'intval' );
|
| 502 |
|
| 507 |
'ba_eas_admin_setting_callback_default_user_nicename',
|
| 508 |
'edit-author-slug',
|
| 509 |
'ba_eas_auto_update',
|
| 510 |
+
array(
|
| 511 |
+
'label_for' => '_ba_eas_default_user_nicename',
|
| 512 |
+
)
|
| 513 |
);
|
| 514 |
register_setting( 'edit-author-slug', '_ba_eas_default_user_nicename', 'sanitize_key' );
|
| 515 |
|
| 528 |
'ba_eas_admin_setting_callback_bulk_update',
|
| 529 |
'edit-author-slug',
|
| 530 |
'ba_eas_bulk_update',
|
| 531 |
+
array(
|
| 532 |
+
'label_for' => '_ba_eas_bulk_update',
|
| 533 |
+
)
|
| 534 |
);
|
| 535 |
register_setting( 'edit-author-slug', '_ba_eas_bulk_update', 'ba_eas_auto_update_user_nicename_bulk' );
|
| 536 |
|
| 541 |
'ba_eas_admin_setting_callback_bulk_update_structure',
|
| 542 |
'edit-author-slug',
|
| 543 |
'ba_eas_bulk_update',
|
| 544 |
+
array(
|
| 545 |
+
'label_for' => '_ba_eas_bulk_update_structure',
|
| 546 |
+
)
|
| 547 |
);
|
| 548 |
register_setting( 'edit-author-slug', '_ba_eas_bulk_update_structure', '__return_false' );
|
| 549 |
}
|
| 582 |
function ba_eas_admin_setting_callback_author_base() {
|
| 583 |
|
| 584 |
$author_base = ba_eas_sanitize_author_base( ba_eas()->author_base );
|
| 585 |
+
$front = trim( $GLOBALS['wp_rewrite']->front, '/' );
|
| 586 |
|
| 587 |
+
// Add the trailing slash back if `$front` isn't empty.
|
| 588 |
+
if ( ! empty( $front ) ) {
|
| 589 |
+
$front = trailingslashit( $front );
|
| 590 |
+
}
|
|
|
|
| 591 |
?>
|
| 592 |
|
| 593 |
<input id="_ba_eas_author_base" name="_ba_eas_author_base" type="text" value="<?php echo esc_attr( $author_base ); ?>" class="regular-text code" />
|
| 594 |
<em><?php esc_html_e( "Defaults to 'author'", 'edit-author-slug' ); ?></em>
|
| 595 |
<br /><br />
|
| 596 |
+
<strong>Demo:</strong>
|
| 597 |
+
<em><?php
|
| 598 |
+
echo sprintf(
|
| 599 |
+
'%1$s%2$s%3$s%4$s',
|
| 600 |
+
esc_url( home_url( '/' ) ),
|
| 601 |
+
'<span class="eas-demo-author-base-front">' . esc_html( $front ) . '</span>',
|
| 602 |
+
'<span class="eas-demo-author-base">' . esc_html( $author_base ) . '</span>',
|
| 603 |
+
esc_html( user_trailingslashit( '/author-slug' ) )
|
| 604 |
+
);
|
| 605 |
+
?></em>
|
| 606 |
|
| 607 |
<?php
|
| 608 |
}
|
| 635 |
<?php esc_html_e( "Set user's Author Base according to their role.", 'edit-author-slug' ); ?>
|
| 636 |
<br /><br />
|
| 637 |
<?php echo sprintf(
|
| 638 |
+
/* translators: 1: rewrite tag, 2: rewrite tag demo usage, 3: demo URL using rewrite tag */
|
| 639 |
esc_html__(
|
| 640 |
'Use the %1$s rewrite tag to customize the role-based author base. If you set the author base to "%2$s", the resulting author structure will be something like "%3$s".',
|
| 641 |
'edit-author-slug'
|
| 856 |
function ba_eas_add_settings_link( $links, $file ) {
|
| 857 |
|
| 858 |
if ( ba_eas()->plugin_basename === $file ) {
|
| 859 |
+
|
| 860 |
+
$settings_url = add_query_arg(
|
| 861 |
+
array(
|
| 862 |
+
'page' => 'edit-author-slug',
|
| 863 |
+
),
|
| 864 |
+
admin_url( 'options-general.php' )
|
| 865 |
+
);
|
| 866 |
+
|
| 867 |
+
$settings_link = '<a href="' . esc_url( $settings_url ) . '">' . esc_html__( 'Settings', 'edit-author-slug' ) . '</a>';
|
| 868 |
array_unshift( $links, $settings_link );
|
| 869 |
}
|
| 870 |
|
| 919 |
*/
|
| 920 |
function ba_eas_settings_updated() {
|
| 921 |
|
| 922 |
+
// Check that a valid nonce was passed.
|
| 923 |
+
if ( ! isset( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'edit-author-slug-options' ) ) {
|
| 924 |
return;
|
| 925 |
}
|
| 926 |
|
| 927 |
+
// Make sure we're on the Edit Author Slug settings page.
|
| 928 |
+
if ( ! isset( $_REQUEST['option_page'] ) || 'edit-author-slug' !== $_REQUEST['option_page'] ) {
|
| 929 |
return;
|
| 930 |
}
|
| 931 |
|
includes/functions.php
CHANGED
|
@@ -32,6 +32,32 @@ function ba_eas_do_auto_update() {
|
|
| 32 |
return (bool) apply_filters( 'ba_eas_do_auto_update', ba_eas()->do_auto_update );
|
| 33 |
}
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
/**
|
| 36 |
* Auto-update the user_nicename for a given user.
|
| 37 |
*
|
|
@@ -80,88 +106,11 @@ function ba_eas_auto_update_user_nicename( $user_id, $bulk = false, $structure =
|
|
| 80 |
*/
|
| 81 |
$structure = apply_filters( 'ba_eas_auto_update_user_nicename_structure', $structure, $user_id );
|
| 82 |
|
| 83 |
-
// Make sure we have a structure.
|
| 84 |
-
if ( empty( $structure ) ) {
|
| 85 |
-
$structure = 'username';
|
| 86 |
-
}
|
| 87 |
-
|
| 88 |
// Setup the current nicename.
|
| 89 |
-
$old_nicename = $user->
|
| 90 |
-
if ( ! empty( $user->user_nicename ) ) {
|
| 91 |
-
$old_nicename = $user->user_nicename;
|
| 92 |
-
}
|
| 93 |
-
|
| 94 |
-
// Setup default nicename.
|
| 95 |
-
$nicename = $old_nicename;
|
| 96 |
-
|
| 97 |
-
// Setup the new nicename based on the provided structure.
|
| 98 |
-
switch ( $structure ) {
|
| 99 |
-
|
| 100 |
-
case 'username':
|
| 101 |
-
|
| 102 |
-
if ( ! empty( $user->user_login ) ) {
|
| 103 |
-
$nicename = $user->user_login;
|
| 104 |
-
}
|
| 105 |
-
|
| 106 |
-
break;
|
| 107 |
-
|
| 108 |
-
case 'nickname':
|
| 109 |
-
|
| 110 |
-
if ( ! empty( $user->nickname ) ) {
|
| 111 |
-
$nicename = $user->nickname;
|
| 112 |
-
}
|
| 113 |
-
|
| 114 |
-
break;
|
| 115 |
-
|
| 116 |
-
case 'displayname':
|
| 117 |
-
|
| 118 |
-
if ( ! empty( $user->display_name ) ) {
|
| 119 |
-
$nicename = $user->display_name;
|
| 120 |
-
}
|
| 121 |
-
|
| 122 |
-
break;
|
| 123 |
-
|
| 124 |
-
case 'firstname':
|
| 125 |
-
|
| 126 |
-
if ( ! empty( $user->first_name ) ) {
|
| 127 |
-
$nicename = $user->first_name;
|
| 128 |
-
}
|
| 129 |
-
|
| 130 |
-
break;
|
| 131 |
-
|
| 132 |
-
case 'lastname':
|
| 133 |
-
|
| 134 |
-
if ( ! empty( $user->last_name ) ) {
|
| 135 |
-
$nicename = $user->last_name;
|
| 136 |
-
}
|
| 137 |
-
|
| 138 |
-
break;
|
| 139 |
-
|
| 140 |
-
case 'firstlast':
|
| 141 |
-
|
| 142 |
-
if ( ! empty( $user->first_name ) && ! empty( $user->last_name ) ) {
|
| 143 |
-
$nicename = $user->first_name . '-' . $user->last_name;
|
| 144 |
-
}
|
| 145 |
-
|
| 146 |
-
break;
|
| 147 |
-
|
| 148 |
-
case 'lastfirst':
|
| 149 |
-
|
| 150 |
-
if ( ! empty( $user->first_name ) && ! empty( $user->last_name ) ) {
|
| 151 |
-
$nicename = $user->last_name . '-' . $user->first_name;
|
| 152 |
-
}
|
| 153 |
-
|
| 154 |
-
break;
|
| 155 |
-
|
| 156 |
-
case 'userid':
|
| 157 |
-
|
| 158 |
-
$nicename = $user_id;
|
| 159 |
-
|
| 160 |
-
break;
|
| 161 |
-
}
|
| 162 |
|
| 163 |
// Sanitize and trim the new user nicename.
|
| 164 |
-
$nicename =
|
| 165 |
|
| 166 |
/**
|
| 167 |
* Filters the auto-updated user nicename before being saved.
|
|
@@ -183,7 +132,10 @@ function ba_eas_auto_update_user_nicename( $user_id, $bulk = false, $structure =
|
|
| 183 |
remove_action( 'profile_update', 'ba_eas_auto_update_user_nicename' );
|
| 184 |
|
| 185 |
// Update if there's a change.
|
| 186 |
-
$user_id = wp_update_user( array(
|
|
|
|
|
|
|
|
|
|
| 187 |
|
| 188 |
// Add it back in case other plugins do some updating.
|
| 189 |
add_action( 'profile_update', 'ba_eas_auto_update_user_nicename' );
|
|
@@ -226,16 +178,21 @@ function ba_eas_auto_update_user_nicename_single( $user_id = 0 ) {
|
|
| 226 |
*
|
| 227 |
* @since 0.9.0
|
| 228 |
*
|
| 229 |
-
* @param string $
|
| 230 |
*
|
| 231 |
* @return bool False to prevent the setting from being saved to the db.
|
| 232 |
*/
|
| 233 |
-
function ba_eas_auto_update_user_nicename_bulk( $
|
| 234 |
|
| 235 |
// Nonce check.
|
| 236 |
check_admin_referer( 'edit-author-slug-options' );
|
| 237 |
|
| 238 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 239 |
$structure = ba_eas()->default_user_nicename;
|
| 240 |
|
| 241 |
// If a bulk update structure was passed, use that.
|
|
@@ -243,16 +200,10 @@ function ba_eas_auto_update_user_nicename_bulk( $value = false ) {
|
|
| 243 |
$structure = sanitize_key( $_POST['_ba_eas_bulk_update_structure'] );
|
| 244 |
}
|
| 245 |
|
| 246 |
-
// Sanitize the option value.
|
| 247 |
-
$value = (bool) absint( $value );
|
| 248 |
-
|
| 249 |
-
// Bail if the user didn't ask to run the bulk update.
|
| 250 |
-
if ( ! $value ) {
|
| 251 |
-
return false;
|
| 252 |
-
}
|
| 253 |
-
|
| 254 |
// Get an array of ids of all users.
|
| 255 |
-
$users = get_users( array(
|
|
|
|
|
|
|
| 256 |
|
| 257 |
/**
|
| 258 |
* Filters the array of user ids who will have their user nicenames updated.
|
|
@@ -267,22 +218,37 @@ function ba_eas_auto_update_user_nicename_bulk( $value = false ) {
|
|
| 267 |
$updated = 0;
|
| 268 |
|
| 269 |
// Loop through all the users and maybe update their nicenames.
|
| 270 |
-
foreach ( $users as $user_id ) {
|
|
|
|
|
|
|
|
|
|
| 271 |
|
| 272 |
// Maybe update the user nicename.
|
| 273 |
$id = ba_eas_auto_update_user_nicename( $user_id, true, $structure );
|
| 274 |
|
| 275 |
-
// If updating was a success,
|
| 276 |
if ( ! empty( $id ) && ! is_wp_error( $id ) ) {
|
| 277 |
$updated++;
|
| 278 |
}
|
|
|
|
|
|
|
|
|
|
| 279 |
}
|
| 280 |
|
| 281 |
// Add a message to the settings page denoting user how many users were updated.
|
| 282 |
add_settings_error(
|
| 283 |
'_ba_eas_bulk_auto_update',
|
| 284 |
'bulk_user_nicenames_updated',
|
| 285 |
-
sprintf(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 286 |
'updated'
|
| 287 |
);
|
| 288 |
|
|
@@ -325,18 +291,18 @@ function ba_eas_sanitize_author_base( $author_base = 'author' ) {
|
|
| 325 |
$original_author_base = $author_base;
|
| 326 |
|
| 327 |
// Only do extra sanitization when needed.
|
| 328 |
-
if ( ! empty( $author_base )
|
| 329 |
|
| 330 |
// Split the author base string on forward slashes.
|
| 331 |
$parts = explode( '/', $author_base );
|
|
|
|
| 332 |
|
| 333 |
// Sanitize all parts except our rewrite tag, `%ba_eas_author_role%`.
|
| 334 |
foreach ( $parts as $key => $part ) {
|
|
|
|
| 335 |
if ( '%ba_eas_author_role%' !== $part ) {
|
| 336 |
-
$
|
| 337 |
}
|
| 338 |
-
|
| 339 |
-
$parts[ $key ] = $part;
|
| 340 |
}
|
| 341 |
|
| 342 |
// Sanitize the parts, and put them back together.
|
|
@@ -351,6 +317,8 @@ function ba_eas_sanitize_author_base( $author_base = 'author' ) {
|
|
| 351 |
/**
|
| 352 |
* Filters the sanitized author base.
|
| 353 |
*
|
|
|
|
|
|
|
| 354 |
* @param string $author_base The sanitized author base.
|
| 355 |
* @param string $original_author_base The unsanitized author base.
|
| 356 |
*/
|
|
@@ -408,6 +376,101 @@ function ba_eas_nicename_is_ascii( $nicename = '' ) {
|
|
| 408 |
return ba_eas_sanitize_nicename( $nicename ) === ba_eas_sanitize_nicename( $nicename, false );
|
| 409 |
}
|
| 410 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 411 |
/** Author Base ***************************************************************/
|
| 412 |
|
| 413 |
/**
|
|
@@ -693,6 +756,8 @@ function ba_eas_get_user_role( $roles = array(), $user_id = 0 ) {
|
|
| 693 |
* WP_Roles object. This is a wrapper function for `wp_roles()` with a fallback
|
| 694 |
* for those on WP < 4.3.
|
| 695 |
*
|
|
|
|
|
|
|
| 696 |
* @global WP_Roles $wp_roles
|
| 697 |
*
|
| 698 |
* @return WP_Roles
|
|
@@ -704,10 +769,8 @@ function ba_eas_get_wp_roles() {
|
|
| 704 |
|
| 705 |
} else {
|
| 706 |
|
| 707 |
-
global $wp_roles;
|
| 708 |
-
|
| 709 |
// Make sure the `$wp_roles` global has been set.
|
| 710 |
-
if ( ! isset( $wp_roles ) ) {
|
| 711 |
$wp_roles = new WP_Roles();
|
| 712 |
}
|
| 713 |
}
|
|
@@ -813,7 +876,7 @@ if ( ! function_exists( 'array_replace_recursive' ) ) {
|
|
| 813 |
/**
|
| 814 |
* Add array_replace_recursive() for users of PHP 5.2.x
|
| 815 |
*
|
| 816 |
-
* http://php.net/manual/en/function.array-replace-recursive.php#109390
|
| 817 |
*
|
| 818 |
* @since 1.0.2
|
| 819 |
*
|
|
@@ -850,7 +913,7 @@ if ( ! function_exists( 'array_replace_recursive' ) ) {
|
|
| 850 |
|
| 851 |
return $base;
|
| 852 |
}
|
| 853 |
-
} //
|
| 854 |
|
| 855 |
/**
|
| 856 |
* Clean and update the nicename cache.
|
| 32 |
return (bool) apply_filters( 'ba_eas_do_auto_update', ba_eas()->do_auto_update );
|
| 33 |
}
|
| 34 |
|
| 35 |
+
/**
|
| 36 |
+
* Determines if a bulk update should occur.
|
| 37 |
+
*
|
| 38 |
+
* @since 1.4.0
|
| 39 |
+
*
|
| 40 |
+
* @param mixed $do_bulk Whether or not to perform a bulk update.
|
| 41 |
+
*
|
| 42 |
+
* @return bool True if bulk update should occur.
|
| 43 |
+
*/
|
| 44 |
+
function ba_eas_do_bulk_update( $do_bulk = false ) {
|
| 45 |
+
|
| 46 |
+
// Sanitize the option value.
|
| 47 |
+
$retval = ( is_numeric( $do_bulk ) || is_bool( $do_bulk ) )
|
| 48 |
+
? (bool) $do_bulk
|
| 49 |
+
: false;
|
| 50 |
+
|
| 51 |
+
/**
|
| 52 |
+
* Filters the return of the `ba_eas_do_bulk_update()`.
|
| 53 |
+
*
|
| 54 |
+
* @since 1.4.0
|
| 55 |
+
*
|
| 56 |
+
* @param bool $retval The `do_auto_update` option.
|
| 57 |
+
*/
|
| 58 |
+
return (bool) apply_filters( 'ba_eas_do_bulk_update', $retval );
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
/**
|
| 62 |
* Auto-update the user_nicename for a given user.
|
| 63 |
*
|
| 106 |
*/
|
| 107 |
$structure = apply_filters( 'ba_eas_auto_update_user_nicename_structure', $structure, $user_id );
|
| 108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
// Setup the current nicename.
|
| 110 |
+
$old_nicename = $user->user_nicename;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
// Sanitize and trim the new user nicename.
|
| 113 |
+
$nicename = ba_eas_get_nicename_by_structure( $user_id, $structure );
|
| 114 |
|
| 115 |
/**
|
| 116 |
* Filters the auto-updated user nicename before being saved.
|
| 132 |
remove_action( 'profile_update', 'ba_eas_auto_update_user_nicename' );
|
| 133 |
|
| 134 |
// Update if there's a change.
|
| 135 |
+
$user_id = wp_update_user( array(
|
| 136 |
+
'ID' => $user_id,
|
| 137 |
+
'user_nicename' => $nicename,
|
| 138 |
+
) );
|
| 139 |
|
| 140 |
// Add it back in case other plugins do some updating.
|
| 141 |
add_action( 'profile_update', 'ba_eas_auto_update_user_nicename' );
|
| 178 |
*
|
| 179 |
* @since 0.9.0
|
| 180 |
*
|
| 181 |
+
* @param string|bool $do_bulk The option value passed to the settings API.
|
| 182 |
*
|
| 183 |
* @return bool False to prevent the setting from being saved to the db.
|
| 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 |
|
| 198 |
// If a bulk update structure was passed, use that.
|
| 200 |
$structure = sanitize_key( $_POST['_ba_eas_bulk_update_structure'] );
|
| 201 |
}
|
| 202 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
// Get an array of ids of all users.
|
| 204 |
+
$users = get_users( array(
|
| 205 |
+
'fields' => 'ID',
|
| 206 |
+
) );
|
| 207 |
|
| 208 |
/**
|
| 209 |
* Filters the array of user ids who will have their user nicenames updated.
|
| 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 |
// Maybe update the user nicename.
|
| 227 |
$id = ba_eas_auto_update_user_nicename( $user_id, true, $structure );
|
| 228 |
|
| 229 |
+
// If updating was a success, then bump the updated count.
|
| 230 |
if ( ! empty( $id ) && ! is_wp_error( $id ) ) {
|
| 231 |
$updated++;
|
| 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',
|
| 241 |
'bulk_user_nicenames_updated',
|
| 242 |
+
sprintf(
|
| 243 |
+
/* translators: Updated author slugs count. */
|
| 244 |
+
_n(
|
| 245 |
+
'%d user author slug updated.',
|
| 246 |
+
'%d user author slugs updated.',
|
| 247 |
+
$updated,
|
| 248 |
+
'edit-author-slug'
|
| 249 |
+
),
|
| 250 |
+
$updated
|
| 251 |
+
),
|
| 252 |
'updated'
|
| 253 |
);
|
| 254 |
|
| 291 |
$original_author_base = $author_base;
|
| 292 |
|
| 293 |
// Only do extra sanitization when needed.
|
| 294 |
+
if ( ! empty( $author_base ) && 'author' !== $author_base ) {
|
| 295 |
|
| 296 |
// Split the author base string on forward slashes.
|
| 297 |
$parts = explode( '/', $author_base );
|
| 298 |
+
$parts = array_filter( array_map( 'trim', $parts ) );
|
| 299 |
|
| 300 |
// Sanitize all parts except our rewrite tag, `%ba_eas_author_role%`.
|
| 301 |
foreach ( $parts as $key => $part ) {
|
| 302 |
+
|
| 303 |
if ( '%ba_eas_author_role%' !== $part ) {
|
| 304 |
+
$parts[ $key ] = sanitize_title( $part );
|
| 305 |
}
|
|
|
|
|
|
|
| 306 |
}
|
| 307 |
|
| 308 |
// Sanitize the parts, and put them back together.
|
| 317 |
/**
|
| 318 |
* Filters the sanitized author base.
|
| 319 |
*
|
| 320 |
+
* @since 1.2.0
|
| 321 |
+
*
|
| 322 |
* @param string $author_base The sanitized author base.
|
| 323 |
* @param string $original_author_base The unsanitized author base.
|
| 324 |
*/
|
| 376 |
return ba_eas_sanitize_nicename( $nicename ) === ba_eas_sanitize_nicename( $nicename, false );
|
| 377 |
}
|
| 378 |
|
| 379 |
+
/**
|
| 380 |
+
* Returns a nicename built according to the passed structure.
|
| 381 |
+
*
|
| 382 |
+
* @since 1.4.0
|
| 383 |
+
*
|
| 384 |
+
* @param int $user_id The user id.
|
| 385 |
+
* @param string $structure The structure to build the nicename against.
|
| 386 |
+
*
|
| 387 |
+
* @return string Defaults to empty.
|
| 388 |
+
*/
|
| 389 |
+
function ba_eas_get_nicename_by_structure( $user_id = 0, $structure = '' ) {
|
| 390 |
+
|
| 391 |
+
// Validate the user id.
|
| 392 |
+
$user = get_userdata( $user_id );
|
| 393 |
+
|
| 394 |
+
// Bail if we don't have a valid user id.
|
| 395 |
+
if ( empty( $user->ID ) ) {
|
| 396 |
+
return '';
|
| 397 |
+
}
|
| 398 |
+
|
| 399 |
+
// Set the default nicename.
|
| 400 |
+
$nicename = '';
|
| 401 |
+
|
| 402 |
+
// Setup the new nicename based on the provided structure.
|
| 403 |
+
switch ( $structure ) {
|
| 404 |
+
|
| 405 |
+
case 'username':
|
| 406 |
+
|
| 407 |
+
if ( ! empty( $user->user_login ) ) {
|
| 408 |
+
$nicename = $user->user_login;
|
| 409 |
+
}
|
| 410 |
+
|
| 411 |
+
break;
|
| 412 |
+
|
| 413 |
+
case 'nickname':
|
| 414 |
+
|
| 415 |
+
if ( ! empty( $user->nickname ) ) {
|
| 416 |
+
$nicename = $user->nickname;
|
| 417 |
+
}
|
| 418 |
+
|
| 419 |
+
break;
|
| 420 |
+
|
| 421 |
+
case 'displayname':
|
| 422 |
+
|
| 423 |
+
if ( ! empty( $user->display_name ) ) {
|
| 424 |
+
$nicename = $user->display_name;
|
| 425 |
+
}
|
| 426 |
+
|
| 427 |
+
break;
|
| 428 |
+
|
| 429 |
+
case 'firstname':
|
| 430 |
+
|
| 431 |
+
if ( ! empty( $user->first_name ) ) {
|
| 432 |
+
$nicename = $user->first_name;
|
| 433 |
+
}
|
| 434 |
+
|
| 435 |
+
break;
|
| 436 |
+
|
| 437 |
+
case 'lastname':
|
| 438 |
+
|
| 439 |
+
if ( ! empty( $user->last_name ) ) {
|
| 440 |
+
$nicename = $user->last_name;
|
| 441 |
+
}
|
| 442 |
+
|
| 443 |
+
break;
|
| 444 |
+
|
| 445 |
+
case 'firstlast':
|
| 446 |
+
|
| 447 |
+
if ( ! empty( $user->first_name ) && ! empty( $user->last_name ) ) {
|
| 448 |
+
$nicename = $user->first_name . '-' . $user->last_name;
|
| 449 |
+
}
|
| 450 |
+
|
| 451 |
+
break;
|
| 452 |
+
|
| 453 |
+
case 'lastfirst':
|
| 454 |
+
|
| 455 |
+
if ( ! empty( $user->first_name ) && ! empty( $user->last_name ) ) {
|
| 456 |
+
$nicename = $user->last_name . '-' . $user->first_name;
|
| 457 |
+
}
|
| 458 |
+
|
| 459 |
+
break;
|
| 460 |
+
|
| 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 |
/**
|
| 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
|
| 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 |
}
|
| 876 |
/**
|
| 877 |
* Add array_replace_recursive() for users of PHP 5.2.x
|
| 878 |
*
|
| 879 |
+
* @see http://php.net/manual/en/function.array-replace-recursive.php#109390
|
| 880 |
*
|
| 881 |
* @since 1.0.2
|
| 882 |
*
|
| 913 |
|
| 914 |
return $base;
|
| 915 |
}
|
| 916 |
+
} // End if().
|
| 917 |
|
| 918 |
/**
|
| 919 |
* Clean and update the nicename cache.
|
js/edit-author-slug.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
| 1 |
-
/*! edit-author-slug - v1.
|
| 2 |
jQuery(document).ready(function(a){a('input[name="_ba_eas_remove_front"]').prop("checked")&&a('span[class="eas-demo-author-base-front"]').addClass("hidden"),a('input[name="_ba_eas_remove_front"]').on("click",function(){a(this).prop("checked")?a('span[class="eas-demo-author-base-front"]').fadeOut("fast",function(){a(this).addClass("hidden")}):a('span[class="eas-demo-author-base-front hidden"]').fadeIn("slow",function(){a(this).removeClass("hidden")})}),a('input[name="ba_eas_author_slug"]').click(function(){"ba_eas_author_slug_custom_radio"!==a(this).attr("id")&&a('input[name="ba_eas_author_slug_custom"]').val(a(this).val()).text(a(this).siblings("span").text())}),a('input[name="ba_eas_author_slug_custom"]').focus(function(){a("#ba_eas_author_slug_custom_radio").attr("checked","checked")}),a('input[class="eas-checkbox"]').not(":checked").parents("tr").next("tr").addClass("hidden"),a('input[class="eas-checkbox"]').on("click",function(){a(this).prop("checked")?a(this).parents("tr").next("tr").fadeIn("slow",function(){a(this).removeClass("hidden")}):a(this).parents("tr").next("tr").fadeOut("fast",function(){a(this).addClass("hidden")})})});
|
| 1 |
+
/*! edit-author-slug - v1.4.1 - 2017-04-24 8:00:07 PM UTC - https://github.com/thebrandonallen/edit-author-slug/ */
|
| 2 |
jQuery(document).ready(function(a){a('input[name="_ba_eas_remove_front"]').prop("checked")&&a('span[class="eas-demo-author-base-front"]').addClass("hidden"),a('input[name="_ba_eas_remove_front"]').on("click",function(){a(this).prop("checked")?a('span[class="eas-demo-author-base-front"]').fadeOut("fast",function(){a(this).addClass("hidden")}):a('span[class="eas-demo-author-base-front hidden"]').fadeIn("slow",function(){a(this).removeClass("hidden")})}),a('input[name="ba_eas_author_slug"]').click(function(){"ba_eas_author_slug_custom_radio"!==a(this).attr("id")&&a('input[name="ba_eas_author_slug_custom"]').val(a(this).val()).text(a(this).siblings("span").text())}),a('input[name="ba_eas_author_slug_custom"]').focus(function(){a("#ba_eas_author_slug_custom_radio").attr("checked","checked")}),a('input[class="eas-checkbox"]').not(":checked").parents("tr").next("tr").addClass("hidden"),a('input[class="eas-checkbox"]').on("click",function(){a(this).prop("checked")?a(this).parents("tr").next("tr").fadeIn("slow",function(){a(this).removeClass("hidden")}):a(this).parents("tr").next("tr").fadeOut("fast",function(){a(this).addClass("hidden")})})});
|
languages/edit-author-slug.pot
CHANGED
|
@@ -3,227 +3,233 @@
|
|
| 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"
|
| 13 |
"PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n"
|
| 14 |
"Last-Translator: BRANDON ALLEN <plugins@brandonallen.me>\n"
|
| 15 |
"Language-Team: ENGLISH <plugins@brandonallen.me>\n"
|
| 16 |
-
"X-Generator: grunt-wp-i18n 0.5.4\n"
|
| 17 |
-
"X-Poedit-KeywordsList: "
|
| 18 |
-
"__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_"
|
| 19 |
-
"attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n"
|
| 20 |
"Language: en\n"
|
| 21 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
| 22 |
"X-Poedit-Country: United States\n"
|
| 23 |
"X-Poedit-SourceCharset: UTF-8\n"
|
|
|
|
|
|
|
|
|
|
| 24 |
"X-Poedit-Basepath: ../\n"
|
| 25 |
"X-Poedit-SearchPath-0: .\n"
|
| 26 |
"X-Poedit-Bookmarks: \n"
|
| 27 |
"X-Textdomain-Support: yes\n"
|
|
|
|
| 28 |
|
| 29 |
-
#: edit-author-slug.php:
|
| 30 |
msgid "Method does not exist."
|
| 31 |
msgstr ""
|
| 32 |
|
| 33 |
-
#: edit-author-slug.php:
|
| 34 |
msgid "Cheatin’ huh?"
|
| 35 |
msgstr ""
|
| 36 |
|
| 37 |
-
#: includes/admin.php:
|
| 38 |
msgid ""
|
| 39 |
"Choose an Author Slug based on the above profile information, or create "
|
| 40 |
"your own."
|
| 41 |
msgstr ""
|
| 42 |
|
| 43 |
-
#: includes/admin.php:
|
| 44 |
msgid "ie. - 'user-name', 'firstname-lastname', or 'master-ninja'"
|
| 45 |
msgstr ""
|
| 46 |
|
| 47 |
-
#: includes/admin.php:
|
| 48 |
msgid "Author Slug"
|
| 49 |
msgstr ""
|
| 50 |
|
| 51 |
-
#: includes/admin.php:
|
| 52 |
msgid "Custom:"
|
| 53 |
msgstr ""
|
| 54 |
|
| 55 |
-
#: includes/admin.php:
|
| 56 |
msgid "Enter a custom author slug in the following field"
|
| 57 |
msgstr ""
|
| 58 |
|
| 59 |
-
#: includes/admin.php:
|
| 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 |
msgid ""
|
| 85 |
"<strong>ERROR</strong>: The author slug, %1$s, already exists. Please try "
|
| 86 |
"something different."
|
| 87 |
msgstr ""
|
| 88 |
|
| 89 |
-
#: includes/admin.php:
|
| 90 |
msgid "Edit Author Slug Settings"
|
| 91 |
msgstr ""
|
| 92 |
|
| 93 |
-
#: includes/admin.php:
|
| 94 |
msgid "Author Base"
|
| 95 |
msgstr ""
|
| 96 |
|
| 97 |
-
#: includes/admin.php:
|
| 98 |
msgid "Remove Front"
|
| 99 |
msgstr ""
|
| 100 |
|
| 101 |
-
#: includes/admin.php:
|
| 102 |
msgid "Role-Based Author Base"
|
| 103 |
msgstr ""
|
| 104 |
|
| 105 |
-
#: includes/admin.php:
|
| 106 |
msgid "Role Slugs"
|
| 107 |
msgstr ""
|
| 108 |
|
| 109 |
-
#: includes/admin.php:
|
| 110 |
msgid "Automatic Author Slug Creation"
|
| 111 |
msgstr ""
|
| 112 |
|
| 113 |
-
#: includes/admin.php:
|
| 114 |
msgid "Automatically Update"
|
| 115 |
msgstr ""
|
| 116 |
|
| 117 |
-
#: includes/admin.php:
|
| 118 |
msgid "Author Slug Structure"
|
| 119 |
msgstr ""
|
| 120 |
|
| 121 |
-
#: includes/admin.php:
|
| 122 |
msgid "Bulk Update Author Slugs"
|
| 123 |
msgstr ""
|
| 124 |
|
| 125 |
-
#: includes/admin.php:
|
| 126 |
msgid "Bulk Update"
|
| 127 |
msgstr ""
|
| 128 |
|
| 129 |
-
#: includes/admin.php:
|
| 130 |
msgid "Change your author base to something more fun!"
|
| 131 |
msgstr ""
|
| 132 |
|
| 133 |
-
#: includes/admin.php:
|
| 134 |
msgid ""
|
| 135 |
"Allow Author Slugs to be automatically updated, and set the default Author "
|
| 136 |
"Slug structure for users. Automatic updating will only occur when a user "
|
| 137 |
"can't edit Author Slugs on their own."
|
| 138 |
msgstr ""
|
| 139 |
|
| 140 |
-
#: includes/admin.php:
|
| 141 |
msgid ""
|
| 142 |
"This could have SEO repercussions if users update their profiles "
|
| 143 |
"frequently, and it will override any manual editing of the Author Slug you "
|
| 144 |
"may have previously completed."
|
| 145 |
msgstr ""
|
| 146 |
|
| 147 |
-
#: includes/admin.php:
|
| 148 |
msgid "Defaults to 'author'"
|
| 149 |
msgstr ""
|
| 150 |
|
| 151 |
-
#: includes/admin.php:
|
| 152 |
msgid "Remove the \"front\" portion of the author permalink structure."
|
| 153 |
msgstr ""
|
| 154 |
|
| 155 |
-
#: includes/admin.php:
|
| 156 |
msgid "Set user's Author Base according to their role."
|
| 157 |
msgstr ""
|
| 158 |
|
| 159 |
-
#: includes/admin.php:
|
|
|
|
|
|
|
| 160 |
msgid ""
|
| 161 |
"Use the %1$s rewrite tag to customize the role-based author base. If you "
|
| 162 |
"set the author base to \"%2$s\", the resulting author structure will be "
|
| 163 |
"something like \"%3$s\"."
|
| 164 |
msgstr ""
|
| 165 |
|
| 166 |
-
#: includes/admin.php:
|
| 167 |
msgid "Automatically update Author Slug when a user updates their profile."
|
| 168 |
msgstr ""
|
| 169 |
|
| 170 |
-
#: includes/admin.php:
|
| 171 |
msgid "Default author slug options"
|
| 172 |
msgstr ""
|
| 173 |
|
| 174 |
-
#: includes/admin.php:
|
| 175 |
msgid "Update all users at once based on the specified Author Slug structure."
|
| 176 |
msgstr ""
|
| 177 |
|
| 178 |
-
#: includes/admin.php:
|
| 179 |
msgid ""
|
| 180 |
"Update all users according to the below Author Slug setting. This will only "
|
| 181 |
"be run after clicking \"Save Changes\"."
|
| 182 |
msgstr ""
|
| 183 |
|
| 184 |
-
#: includes/admin.php:
|
| 185 |
msgid "Default bulk update author slug options"
|
| 186 |
msgstr ""
|
| 187 |
|
| 188 |
-
#: includes/admin.php:
|
| 189 |
msgid "Settings"
|
| 190 |
msgstr ""
|
| 191 |
|
| 192 |
-
#: includes/admin.php:
|
| 193 |
msgid "username (Default)"
|
| 194 |
msgstr ""
|
| 195 |
|
| 196 |
-
#: includes/admin.php:
|
| 197 |
msgid "nickname"
|
| 198 |
msgstr ""
|
| 199 |
|
| 200 |
-
#: includes/admin.php:
|
| 201 |
msgid "displayname"
|
| 202 |
msgstr ""
|
| 203 |
|
| 204 |
-
#: includes/admin.php:
|
| 205 |
msgid "firstname"
|
| 206 |
msgstr ""
|
| 207 |
|
| 208 |
-
#: includes/admin.php:
|
| 209 |
msgid "lastname"
|
| 210 |
msgstr ""
|
| 211 |
|
| 212 |
-
#: includes/admin.php:
|
| 213 |
msgid "firstname-lastname"
|
| 214 |
msgstr ""
|
| 215 |
|
| 216 |
-
#: includes/admin.php:
|
| 217 |
msgid "lastname-firstname"
|
| 218 |
msgstr ""
|
| 219 |
|
| 220 |
-
#: includes/admin.php:
|
| 221 |
msgid "userid (Experimental)"
|
| 222 |
msgstr ""
|
| 223 |
|
| 224 |
-
#: includes/functions.php:
|
| 225 |
-
|
| 226 |
-
|
|
|
|
|
|
|
|
|
|
| 227 |
|
| 228 |
#. Description of the plugin/theme
|
| 229 |
msgid ""
|
| 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.4.1\n"
|
| 7 |
"Report-Msgid-Bugs-To: "
|
| 8 |
"https://github.com/thebrandonallen/edit-author-slug/issues\n"
|
| 9 |
+
"POT-Creation-Date: 2017-04-24 20:00:08+00:00\n"
|
| 10 |
"MIME-Version: 1.0\n"
|
| 11 |
"Content-Type: text/plain; charset=utf-8\n"
|
| 12 |
"Content-Transfer-Encoding: 8bit\n"
|
| 13 |
"PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n"
|
| 14 |
"Last-Translator: BRANDON ALLEN <plugins@brandonallen.me>\n"
|
| 15 |
"Language-Team: ENGLISH <plugins@brandonallen.me>\n"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
"Language: en\n"
|
| 17 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
| 18 |
"X-Poedit-Country: United States\n"
|
| 19 |
"X-Poedit-SourceCharset: UTF-8\n"
|
| 20 |
+
"X-Poedit-KeywordsList: "
|
| 21 |
+
"__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_"
|
| 22 |
+
"attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n"
|
| 23 |
"X-Poedit-Basepath: ../\n"
|
| 24 |
"X-Poedit-SearchPath-0: .\n"
|
| 25 |
"X-Poedit-Bookmarks: \n"
|
| 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 "
|
| 40 |
"your own."
|
| 41 |
msgstr ""
|
| 42 |
|
| 43 |
+
#: includes/admin.php:66
|
| 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:302
|
| 48 |
msgid "Author Slug"
|
| 49 |
msgstr ""
|
| 50 |
|
| 51 |
+
#: includes/admin.php:89
|
| 52 |
msgid "Custom:"
|
| 53 |
msgstr ""
|
| 54 |
|
| 55 |
+
#: includes/admin.php:90
|
| 56 |
msgid "Enter a custom author slug in the following field"
|
| 57 |
msgstr ""
|
| 58 |
|
| 59 |
+
#: includes/admin.php:92
|
| 60 |
msgid "Custom author slug:"
|
| 61 |
msgstr ""
|
| 62 |
|
| 63 |
+
#: includes/admin.php:160
|
| 64 |
msgid "<strong>ERROR</strong>: An author slug cannot be blank. Please try again."
|
| 65 |
msgstr ""
|
| 66 |
|
| 67 |
+
#: includes/admin.php:206
|
| 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:215
|
| 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:224
|
| 80 |
msgid "<strong>ERROR</strong>: An author slug may not be longer than 50 characters."
|
| 81 |
msgstr ""
|
| 82 |
|
| 83 |
+
#: includes/admin.php:238
|
| 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:384 includes/admin.php:402
|
| 91 |
msgid "Edit Author Slug Settings"
|
| 92 |
msgstr ""
|
| 93 |
|
| 94 |
+
#: includes/admin.php:426 includes/admin.php:434
|
| 95 |
msgid "Author Base"
|
| 96 |
msgstr ""
|
| 97 |
|
| 98 |
+
#: includes/admin.php:448
|
| 99 |
msgid "Remove Front"
|
| 100 |
msgstr ""
|
| 101 |
|
| 102 |
+
#: includes/admin.php:462
|
| 103 |
msgid "Role-Based Author Base"
|
| 104 |
msgstr ""
|
| 105 |
|
| 106 |
+
#: includes/admin.php:475
|
| 107 |
msgid "Role Slugs"
|
| 108 |
msgstr ""
|
| 109 |
|
| 110 |
+
#: includes/admin.php:485
|
| 111 |
msgid "Automatic Author Slug Creation"
|
| 112 |
msgstr ""
|
| 113 |
|
| 114 |
+
#: includes/admin.php:493
|
| 115 |
msgid "Automatically Update"
|
| 116 |
msgstr ""
|
| 117 |
|
| 118 |
+
#: includes/admin.php:506 includes/admin.php:540
|
| 119 |
msgid "Author Slug Structure"
|
| 120 |
msgstr ""
|
| 121 |
|
| 122 |
+
#: includes/admin.php:519
|
| 123 |
msgid "Bulk Update Author Slugs"
|
| 124 |
msgstr ""
|
| 125 |
|
| 126 |
+
#: includes/admin.php:527
|
| 127 |
msgid "Bulk Update"
|
| 128 |
msgstr ""
|
| 129 |
|
| 130 |
+
#: includes/admin.php:559
|
| 131 |
msgid "Change your author base to something more fun!"
|
| 132 |
msgstr ""
|
| 133 |
|
| 134 |
+
#: includes/admin.php:572
|
| 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:572
|
| 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:594
|
| 149 |
msgid "Defaults to 'author'"
|
| 150 |
msgstr ""
|
| 151 |
|
| 152 |
+
#: includes/admin.php:621
|
| 153 |
msgid "Remove the \"front\" portion of the author permalink structure."
|
| 154 |
msgstr ""
|
| 155 |
|
| 156 |
+
#: includes/admin.php:635
|
| 157 |
msgid "Set user's Author Base according to their role."
|
| 158 |
msgstr ""
|
| 159 |
|
| 160 |
+
#: includes/admin.php:639
|
| 161 |
+
#. translators: 1: rewrite tag, 2: rewrite tag demo usage, 3: demo URL using
|
| 162 |
+
#. rewrite tag
|
| 163 |
msgid ""
|
| 164 |
"Use the %1$s rewrite tag to customize the role-based author base. If you "
|
| 165 |
"set the author base to \"%2$s\", the resulting author structure will be "
|
| 166 |
"something like \"%3$s\"."
|
| 167 |
msgstr ""
|
| 168 |
|
| 169 |
+
#: includes/admin.php:752
|
| 170 |
msgid "Automatically update Author Slug when a user updates their profile."
|
| 171 |
msgstr ""
|
| 172 |
|
| 173 |
+
#: includes/admin.php:776
|
| 174 |
msgid "Default author slug options"
|
| 175 |
msgstr ""
|
| 176 |
|
| 177 |
+
#: includes/admin.php:796
|
| 178 |
msgid "Update all users at once based on the specified Author Slug structure."
|
| 179 |
msgstr ""
|
| 180 |
|
| 181 |
+
#: includes/admin.php:812
|
| 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:836
|
| 188 |
msgid "Default bulk update author slug options"
|
| 189 |
msgstr ""
|
| 190 |
|
| 191 |
+
#: includes/admin.php:867
|
| 192 |
msgid "Settings"
|
| 193 |
msgstr ""
|
| 194 |
|
| 195 |
+
#: includes/admin.php:892 tests/test-admin.php:622
|
| 196 |
msgid "username (Default)"
|
| 197 |
msgstr ""
|
| 198 |
|
| 199 |
+
#: includes/admin.php:893 tests/test-admin.php:623
|
| 200 |
msgid "nickname"
|
| 201 |
msgstr ""
|
| 202 |
|
| 203 |
+
#: includes/admin.php:894 tests/test-admin.php:624
|
| 204 |
msgid "displayname"
|
| 205 |
msgstr ""
|
| 206 |
|
| 207 |
+
#: includes/admin.php:895 tests/test-admin.php:625
|
| 208 |
msgid "firstname"
|
| 209 |
msgstr ""
|
| 210 |
|
| 211 |
+
#: includes/admin.php:896 tests/test-admin.php:626
|
| 212 |
msgid "lastname"
|
| 213 |
msgstr ""
|
| 214 |
|
| 215 |
+
#: includes/admin.php:897 tests/test-admin.php:627
|
| 216 |
msgid "firstname-lastname"
|
| 217 |
msgstr ""
|
| 218 |
|
| 219 |
+
#: includes/admin.php:898 tests/test-admin.php:628
|
| 220 |
msgid "lastname-firstname"
|
| 221 |
msgstr ""
|
| 222 |
|
| 223 |
+
#: includes/admin.php:899 tests/test-admin.php:629
|
| 224 |
msgid "userid (Experimental)"
|
| 225 |
msgstr ""
|
| 226 |
|
| 227 |
+
#: includes/functions.php:244
|
| 228 |
+
#. translators: Updated author slugs count.
|
| 229 |
+
msgid "%d user author slug updated."
|
| 230 |
+
msgid_plural "%d user author slugs updated."
|
| 231 |
+
msgstr[0] ""
|
| 232 |
+
msgstr[1] ""
|
| 233 |
|
| 234 |
#. Description of the plugin/theme
|
| 235 |
msgid ""
|
readme.md
CHANGED
|
@@ -2,8 +2,8 @@
|
|
| 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.
|
| 6 |
-
**Stable tag:** 1.
|
| 7 |
**License:** GPLv2 or later
|
| 8 |
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html
|
| 9 |
|
|
@@ -39,28 +39,57 @@ Translations should be submitted to [Translate WordPress](https://translate.word
|
|
| 39 |
|
| 40 |
## Frequently Asked Questions ##
|
| 41 |
|
| 42 |
-
###
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
Make sure you are an admin, or have been assigned the `edit_users` capability.
|
| 45 |
|
| 46 |
-
### Why isn't my new Author Slug working? ###
|
| 47 |
|
| 48 |
-
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.
|
| 49 |
|
| 50 |
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.
|
| 51 |
|
| 52 |
## Changelog ##
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
### 1.3.0 ###
|
|
|
|
| 55 |
* Fix a potential bug where a sanitized author base could end up with double forward slashes.
|
| 56 |
* Introduce the `%ba_eas_author_role%` permalink structure tag. This can be used to customize role-based author bases.
|
| 57 |
* Bonus: All alternative facts are now free!
|
| 58 |
|
| 59 |
### 1.2.1 ###
|
|
|
|
| 60 |
* Fixed stupid error where the default user nicename wasn't being properly retrieved from the database. Sorry about that :(
|
| 61 |
* Unfortunately, some unicorns were lost during the development of this release, but they are a resilient creature.
|
| 62 |
|
| 63 |
### 1.2.0 ###
|
|
|
|
| 64 |
* Added the ability to use forward slashes in the author base.
|
| 65 |
* Improved display on the settings page, and storing, of role slugs.
|
| 66 |
* 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).
|
|
@@ -69,50 +98,62 @@ If this doesn't work, make sure you don't have any slug conflicts from other pos
|
|
| 69 |
* Accessibility improvements to the settings page.
|
| 70 |
|
| 71 |
### 1.1.2 ###
|
|
|
|
| 72 |
* Fix loading of minified JS in the admin. Props nuyensgert.
|
| 73 |
|
| 74 |
### 1.1.1 ###
|
|
|
|
| 75 |
* Fix a few minor output escaping issues missed in the 1.1.0 release.
|
| 76 |
|
| 77 |
### 1.1.0 ###
|
|
|
|
| 78 |
* Added the ability to update all author slugs at once with the "Bulk Update" tool.
|
| 79 |
* Greatly improved the checks and error messages when manually updating an author slug for a user.
|
| 80 |
* Further accessibility improvements to match WP 4.3.
|
| 81 |
* Improved validation of author slugs to better match that of WP.
|
| 82 |
|
| 83 |
### 1.0.6 ###
|
|
|
|
| 84 |
* Fix potential, although unlikely, persistent XSS vulnerability.
|
| 85 |
* Prevent debug notice in admin. Props chesio.
|
| 86 |
* Update heading tags to h1 to match WP 4.3.
|
| 87 |
|
| 88 |
### 1.0.5.1 ###
|
|
|
|
| 89 |
* Identical to 1.0.5, which failed to commit properly.
|
| 90 |
|
| 91 |
### 1.0.5 ###
|
|
|
|
| 92 |
* Add WP_User object as a parameter passed to the `ba_eas_show_user_nicename_options_list` filter
|
| 93 |
* Add Japanese translation files. Props SmokyJp.
|
| 94 |
* Fixed possible (although unlikely) cache invalidation issue
|
| 95 |
* Minor code improvements and optimizations.
|
| 96 |
|
| 97 |
### 1.0.4 ###
|
|
|
|
| 98 |
* Improve upgrade routine for older installs
|
| 99 |
* Improve output escaping
|
| 100 |
* Various minor fixes and improvements
|
| 101 |
|
| 102 |
### 1.0.3 ###
|
|
|
|
|
|
|
| 103 |
I swear I tested this! :(
|
| 104 |
|
| 105 |
* Fix custom roles slugs not saving
|
| 106 |
|
| 107 |
### 1.0.2 ###
|
|
|
|
| 108 |
* A number of localization fixes and improvements
|
| 109 |
* Role slug improvements
|
| 110 |
* Temporary, semi work-around for Co-Authors Plus [https://github.com/Automattic/Co-Authors-Plus/pull/204]
|
| 111 |
|
| 112 |
### 1.0.1 ###
|
|
|
|
| 113 |
* Fix possible syntax error when updating a profile (props Christine https://wordpress.org/support/topic/undefined-property-error-1)
|
| 114 |
|
| 115 |
### 1.0 ###
|
|
|
|
| 116 |
* Added ability to do role-based author bases
|
| 117 |
* Added ability to use role-based author templates
|
| 118 |
* Moderate code refactoring
|
|
@@ -121,35 +162,44 @@ I swear I tested this! :(
|
|
| 121 |
* First pass at unit test (only checks if the plugin is installed, for now)
|
| 122 |
|
| 123 |
### 0.9.6 ###
|
|
|
|
| 124 |
* 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.
|
| 125 |
|
| 126 |
### 0.9.5 ###
|
|
|
|
| 127 |
* Fixed instances where the Author Base wouldn't change, or would result in a 404
|
| 128 |
|
| 129 |
### 0.9.4 ###
|
|
|
|
| 130 |
* Update readme references to plugin settings
|
| 131 |
* Fix some copy pasta in settings
|
| 132 |
* Update screenshots
|
| 133 |
|
| 134 |
### 0.9.3 ###
|
|
|
|
| 135 |
* Quickly caught a few things I missed, so this release was skipped. See 0.9.4 for changes
|
| 136 |
|
| 137 |
### 0.9.2 ###
|
|
|
|
| 138 |
* Fix issue where any profile information other than the Author Slug could not be updated
|
| 139 |
* Minor code improvement
|
| 140 |
|
| 141 |
### 0.9.1 ###
|
|
|
|
| 142 |
* Add 'Settings' link to plugins list table
|
| 143 |
|
| 144 |
### 0.9 ###
|
|
|
|
| 145 |
* Allow Author Slug to be automatically created/updated based on a defined structure
|
| 146 |
* Switched to using the Settings API, which also means that all options moved to the Settings > Edit Author Slug page
|
| 147 |
* Various code improvements/optimizations
|
| 148 |
|
| 149 |
### 0.8.1 ###
|
|
|
|
| 150 |
* Fix a bug that prevented non-admin users from updating their profile
|
| 151 |
|
| 152 |
### 0.8 ###
|
|
|
|
| 153 |
* Drastically improved error handling and feedback for author slug editing.
|
| 154 |
* Restore duplicate author slug check as old method could alter the slug without any sort of warning.
|
| 155 |
* Further improve the logic for flushing rewrite rules.
|
|
@@ -157,12 +207,15 @@ I swear I tested this! :(
|
|
| 157 |
* Add message in plugins list warning users of WP less than 3.2 that 0.8 is the last update they'll receive.
|
| 158 |
|
| 159 |
### 0.7.2 ###
|
|
|
|
| 160 |
* Remove overzealous cap check.
|
| 161 |
|
| 162 |
### 0.7.1 ###
|
|
|
|
| 163 |
* Fix some unfortunate errors I missed before tagging 0.7.
|
| 164 |
|
| 165 |
### 0.7 ###
|
|
|
|
| 166 |
* Significant code refactoring.
|
| 167 |
* Added custom capability to give site admins the ability to add author slug access to other roles.
|
| 168 |
* Improvements/optimizations to code logic.
|
|
@@ -171,56 +224,69 @@ I swear I tested this! :(
|
|
| 171 |
* Got rid of wp_die() statement on duplicate author slugs in favor of WP's built-in duplicate author slug method.
|
| 172 |
|
| 173 |
### 0.6.1 ###
|
|
|
|
| 174 |
* Added Dutch translation - props Juliette Reinders Folmer.
|
| 175 |
* Don't hard code the languages folder path.
|
| 176 |
* Improve class check/initialization.
|
| 177 |
|
| 178 |
### 0.6 ###
|
|
|
|
| 179 |
* Some code cleanup.
|
| 180 |
* More security hardening.
|
| 181 |
* 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/).
|
| 182 |
* Flush rewrite rules only when necessary instead of every page load.
|
| 183 |
|
| 184 |
### 0.5 ###
|
|
|
|
| 185 |
* Added 'Author Slug' column to Users > Authors & Users (Users > Users in 3.0) page (props Yonat Sharon for the jumpstart).
|
| 186 |
* Ended support for the WP 2.8 branch. Most likely still works, but I will not support it.
|
| 187 |
* Various bug fixes.
|
| 188 |
|
| 189 |
### 0.4 ###
|
|
|
|
| 190 |
* Added ability to change the Author Base.
|
| 191 |
* Updated documentation.
|
| 192 |
* Added some extra security via WP esc_* functions.
|
| 193 |
* Added Belorussian translation, props Marcis G.
|
| 194 |
|
| 195 |
### 0.3.1 ###
|
|
|
|
| 196 |
* Added Hebrew Translation, props Yonat Sharon.
|
| 197 |
|
| 198 |
### 0.3 ###
|
|
|
|
| 199 |
* Now localization friendly.
|
| 200 |
|
| 201 |
### 0.2.1 ###
|
|
|
|
| 202 |
* Fixed a bug that prevented updating a user if the author slug did not change.
|
| 203 |
|
| 204 |
### 0.2 ###
|
|
|
|
| 205 |
* Added a check to avoid duplicate slugs.
|
| 206 |
* Properly sanitize slug before comparison and database insertion.
|
| 207 |
* Updated plugin URI.
|
| 208 |
|
| 209 |
### 0.1.4 ###
|
| 210 |
-
*
|
|
|
|
| 211 |
* Update link to plugin homepage.
|
| 212 |
|
| 213 |
### 0.1.3 ###
|
| 214 |
-
*
|
|
|
|
| 215 |
|
| 216 |
### 0.1.2 ###
|
|
|
|
| 217 |
* Fix version number issues.
|
| 218 |
|
| 219 |
### 0.1.1 ###
|
|
|
|
| 220 |
* Remove extra debug functions left behind.
|
| 221 |
* Add screenshot.
|
| 222 |
|
| 223 |
### 0.1 ###
|
|
|
|
| 224 |
* Initial release.
|
| 225 |
|
| 226 |
## Upgrade Notice ##
|
| 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 |
|
| 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).
|
| 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
|
| 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.
|
| 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.
|
| 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 ##
|
readme.txt
CHANGED
|
@@ -2,8 +2,8 @@
|
|
| 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.3
|
| 5 |
-
Tested up to: 4.7.
|
| 6 |
-
Stable tag: 1.
|
| 7 |
License: GPLv2 or later
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 9 |
|
|
@@ -39,28 +39,57 @@ Translations should be submitted to [Translate WordPress](https://translate.word
|
|
| 39 |
|
| 40 |
== Frequently Asked Questions ==
|
| 41 |
|
| 42 |
-
=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
Make sure you are an admin, or have been assigned the `edit_users` capability.
|
| 45 |
|
| 46 |
-
= Why isn't my new Author Slug working? =
|
| 47 |
|
| 48 |
-
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.
|
| 49 |
|
| 50 |
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.
|
| 51 |
|
| 52 |
== Changelog ==
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
= 1.3.0 =
|
|
|
|
| 55 |
* Fix a potential bug where a sanitized author base could end up with double forward slashes.
|
| 56 |
* Introduce the `%ba_eas_author_role%` permalink structure tag. This can be used to customize role-based author bases.
|
| 57 |
* Bonus: All alternative facts are now free!
|
| 58 |
|
| 59 |
= 1.2.1 =
|
|
|
|
| 60 |
* Fixed stupid error where the default user nicename wasn't being properly retrieved from the database. Sorry about that :(
|
| 61 |
* Unfortunately, some unicorns were lost during the development of this release, but they are a resilient creature.
|
| 62 |
|
| 63 |
= 1.2.0 =
|
|
|
|
| 64 |
* Added the ability to use forward slashes in the author base.
|
| 65 |
* Improved display on the settings page, and storing, of role slugs.
|
| 66 |
* 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).
|
|
@@ -69,50 +98,62 @@ If this doesn't work, make sure you don't have any slug conflicts from other pos
|
|
| 69 |
* Accessibility improvements to the settings page.
|
| 70 |
|
| 71 |
= 1.1.2 =
|
|
|
|
| 72 |
* Fix loading of minified JS in the admin. Props nuyensgert.
|
| 73 |
|
| 74 |
= 1.1.1 =
|
|
|
|
| 75 |
* Fix a few minor output escaping issues missed in the 1.1.0 release.
|
| 76 |
|
| 77 |
= 1.1.0 =
|
|
|
|
| 78 |
* Added the ability to update all author slugs at once with the "Bulk Update" tool.
|
| 79 |
* Greatly improved the checks and error messages when manually updating an author slug for a user.
|
| 80 |
* Further accessibility improvements to match WP 4.3.
|
| 81 |
* Improved validation of author slugs to better match that of WP.
|
| 82 |
|
| 83 |
= 1.0.6 =
|
|
|
|
| 84 |
* Fix potential, although unlikely, persistent XSS vulnerability.
|
| 85 |
* Prevent debug notice in admin. Props chesio.
|
| 86 |
* Update heading tags to h1 to match WP 4.3.
|
| 87 |
|
| 88 |
= 1.0.5.1 =
|
|
|
|
| 89 |
* Identical to 1.0.5, which failed to commit properly.
|
| 90 |
|
| 91 |
= 1.0.5 =
|
|
|
|
| 92 |
* Add WP_User object as a parameter passed to the `ba_eas_show_user_nicename_options_list` filter
|
| 93 |
* Add Japanese translation files. Props SmokyJp.
|
| 94 |
* Fixed possible (although unlikely) cache invalidation issue
|
| 95 |
* Minor code improvements and optimizations.
|
| 96 |
|
| 97 |
= 1.0.4 =
|
|
|
|
| 98 |
* Improve upgrade routine for older installs
|
| 99 |
* Improve output escaping
|
| 100 |
* Various minor fixes and improvements
|
| 101 |
|
| 102 |
= 1.0.3 =
|
|
|
|
|
|
|
| 103 |
I swear I tested this! :(
|
| 104 |
|
| 105 |
* Fix custom roles slugs not saving
|
| 106 |
|
| 107 |
= 1.0.2 =
|
|
|
|
| 108 |
* A number of localization fixes and improvements
|
| 109 |
* Role slug improvements
|
| 110 |
* Temporary, semi work-around for Co-Authors Plus [https://github.com/Automattic/Co-Authors-Plus/pull/204]
|
| 111 |
|
| 112 |
= 1.0.1 =
|
|
|
|
| 113 |
* Fix possible syntax error when updating a profile (props Christine https://wordpress.org/support/topic/undefined-property-error-1)
|
| 114 |
|
| 115 |
= 1.0 =
|
|
|
|
| 116 |
* Added ability to do role-based author bases
|
| 117 |
* Added ability to use role-based author templates
|
| 118 |
* Moderate code refactoring
|
|
@@ -121,35 +162,44 @@ I swear I tested this! :(
|
|
| 121 |
* First pass at unit test (only checks if the plugin is installed, for now)
|
| 122 |
|
| 123 |
= 0.9.6 =
|
|
|
|
| 124 |
* 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.
|
| 125 |
|
| 126 |
= 0.9.5 =
|
|
|
|
| 127 |
* Fixed instances where the Author Base wouldn't change, or would result in a 404
|
| 128 |
|
| 129 |
= 0.9.4 =
|
|
|
|
| 130 |
* Update readme references to plugin settings
|
| 131 |
* Fix some copy pasta in settings
|
| 132 |
* Update screenshots
|
| 133 |
|
| 134 |
= 0.9.3 =
|
|
|
|
| 135 |
* Quickly caught a few things I missed, so this release was skipped. See 0.9.4 for changes
|
| 136 |
|
| 137 |
= 0.9.2 =
|
|
|
|
| 138 |
* Fix issue where any profile information other than the Author Slug could not be updated
|
| 139 |
* Minor code improvement
|
| 140 |
|
| 141 |
= 0.9.1 =
|
|
|
|
| 142 |
* Add 'Settings' link to plugins list table
|
| 143 |
|
| 144 |
= 0.9 =
|
|
|
|
| 145 |
* Allow Author Slug to be automatically created/updated based on a defined structure
|
| 146 |
* Switched to using the Settings API, which also means that all options moved to the Settings > Edit Author Slug page
|
| 147 |
* Various code improvements/optimizations
|
| 148 |
|
| 149 |
= 0.8.1 =
|
|
|
|
| 150 |
* Fix a bug that prevented non-admin users from updating their profile
|
| 151 |
|
| 152 |
= 0.8 =
|
|
|
|
| 153 |
* Drastically improved error handling and feedback for author slug editing.
|
| 154 |
* Restore duplicate author slug check as old method could alter the slug without any sort of warning.
|
| 155 |
* Further improve the logic for flushing rewrite rules.
|
|
@@ -157,12 +207,15 @@ I swear I tested this! :(
|
|
| 157 |
* Add message in plugins list warning users of WP less than 3.2 that 0.8 is the last update they'll receive.
|
| 158 |
|
| 159 |
= 0.7.2 =
|
|
|
|
| 160 |
* Remove overzealous cap check.
|
| 161 |
|
| 162 |
= 0.7.1 =
|
|
|
|
| 163 |
* Fix some unfortunate errors I missed before tagging 0.7.
|
| 164 |
|
| 165 |
= 0.7 =
|
|
|
|
| 166 |
* Significant code refactoring.
|
| 167 |
* Added custom capability to give site admins the ability to add author slug access to other roles.
|
| 168 |
* Improvements/optimizations to code logic.
|
|
@@ -171,56 +224,69 @@ I swear I tested this! :(
|
|
| 171 |
* Got rid of wp_die() statement on duplicate author slugs in favor of WP's built-in duplicate author slug method.
|
| 172 |
|
| 173 |
= 0.6.1 =
|
|
|
|
| 174 |
* Added Dutch translation - props Juliette Reinders Folmer.
|
| 175 |
* Don't hard code the languages folder path.
|
| 176 |
* Improve class check/initialization.
|
| 177 |
|
| 178 |
= 0.6 =
|
|
|
|
| 179 |
* Some code cleanup.
|
| 180 |
* More security hardening.
|
| 181 |
* 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/).
|
| 182 |
* Flush rewrite rules only when necessary instead of every page load.
|
| 183 |
|
| 184 |
= 0.5 =
|
|
|
|
| 185 |
* Added 'Author Slug' column to Users > Authors & Users (Users > Users in 3.0) page (props Yonat Sharon for the jumpstart).
|
| 186 |
* Ended support for the WP 2.8 branch. Most likely still works, but I will not support it.
|
| 187 |
* Various bug fixes.
|
| 188 |
|
| 189 |
= 0.4 =
|
|
|
|
| 190 |
* Added ability to change the Author Base.
|
| 191 |
* Updated documentation.
|
| 192 |
* Added some extra security via WP esc_* functions.
|
| 193 |
* Added Belorussian translation, props Marcis G.
|
| 194 |
|
| 195 |
= 0.3.1 =
|
|
|
|
| 196 |
* Added Hebrew Translation, props Yonat Sharon.
|
| 197 |
|
| 198 |
= 0.3 =
|
|
|
|
| 199 |
* Now localization friendly.
|
| 200 |
|
| 201 |
= 0.2.1 =
|
|
|
|
| 202 |
* Fixed a bug that prevented updating a user if the author slug did not change.
|
| 203 |
|
| 204 |
= 0.2 =
|
|
|
|
| 205 |
* Added a check to avoid duplicate slugs.
|
| 206 |
* Properly sanitize slug before comparison and database insertion.
|
| 207 |
* Updated plugin URI.
|
| 208 |
|
| 209 |
= 0.1.4 =
|
| 210 |
-
*
|
|
|
|
| 211 |
* Update link to plugin homepage.
|
| 212 |
|
| 213 |
= 0.1.3 =
|
| 214 |
-
*
|
|
|
|
| 215 |
|
| 216 |
= 0.1.2 =
|
|
|
|
| 217 |
* Fix version number issues.
|
| 218 |
|
| 219 |
= 0.1.1 =
|
|
|
|
| 220 |
* Remove extra debug functions left behind.
|
| 221 |
* Add screenshot.
|
| 222 |
|
| 223 |
= 0.1 =
|
|
|
|
| 224 |
* Initial release.
|
| 225 |
|
| 226 |
== Upgrade Notice ==
|
| 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.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 |
|
| 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).
|
| 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
|
| 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.
|
| 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.
|
| 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 ==
|
