Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/wp-content/plugins/co-authors-plus/co-authors-plus.php b/wp-content/plugins/co-authors-plus/co-authors-plus.php
- index e08ecca..ed9b88f 100644
- --- a/wp-content/plugins/co-authors-plus/co-authors-plus.php
- +++ b/wp-content/plugins/co-authors-plus/co-authors-plus.php
- @@ -34,6 +34,11 @@ require_once( dirname( __FILE__ ) . '/php/class-coauthors-template-filters.php'
- if ( defined('WP_CLI') && WP_CLI )
- require_once( dirname( __FILE__ ) . '/php/class-wp-cli.php' );
- +function sanitize_slug($s)
- +{
- + return strtolower(urlencode(sanitize_text_field($s)));
- +}
- +
- class coauthors_plus {
- // Name for the taxonomy we're using to store relationships
- @@ -690,7 +695,7 @@ class coauthors_plus {
- // This action happens when a post is saved while editing a post
- if( isset( $_REQUEST['coauthors-nonce'] ) && isset( $_POST['coauthors'] ) && is_array( $_POST['coauthors'] ) ) {
- - $author = sanitize_text_field( $_POST['coauthors'][0] );
- + $author = sanitize_slug( $_POST['coauthors'][0] );
- if ( $author ) {
- $author_data = $this->get_coauthor_by( 'user_nicename', $author );
- // If it's a guest author and has a linked account, store that information in post_author
- @@ -733,7 +738,7 @@ class coauthors_plus {
- check_admin_referer( 'coauthors-edit', 'coauthors-nonce' );
- $coauthors = (array) $_POST['coauthors'];
- - $coauthors = array_map( 'sanitize_text_field', $coauthors );
- + $coauthors = array_map( 'sanitize_slug', $coauthors );
- $this->add_coauthors( $post_id, $coauthors );
- }
- } else {
- @@ -974,7 +979,7 @@ class coauthors_plus {
- die();
- $search = sanitize_text_field( strtolower( $_REQUEST['q'] ) );
- - $ignore = array_map( 'sanitize_text_field', explode( ',', $_REQUEST['existing_authors'] ) );
- + $ignore = array_map( 'sanitize_slug', explode( ',', $_REQUEST['existing_authors'] ) );
- $authors = $this->search_authors( $search, $ignore );
- diff --git a/wp-content/plugins/co-authors-plus/js/co-authors-plus.js b/wp-content/plugins/co-authors-plus/js/co-authors-plus.js
- index 2b2034c..3dbeeb1 100644
- --- a/wp-content/plugins/co-authors-plus/js/co-authors-plus.js
- +++ b/wp-content/plugins/co-authors-plus/js/co-authors-plus.js
- @@ -305,7 +305,7 @@ jQuery(document).ready(function () {
- 'type': 'hidden',
- 'id': 'coauthors_hidden_input',
- 'name': 'coauthors[]',
- - 'value': unescape(author.nicename)
- + 'value': decodeURIComponent(author.nicename)
- })
- ;
- @@ -530,4 +530,4 @@ jQuery(document).ready(function () {
- if( typeof(console) === 'undefined' ) {
- var console = {}
- console.log = console.error = function() {};
- -}
- \ No newline at end of file
- +}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement