Skip to content

Commit

Permalink
[#198] Replace urlencode/urldecode with rawurlencode/rawurldecode
Browse files Browse the repository at this point in the history
  • Loading branch information
sanketio committed Jan 30, 2018
1 parent cc36104 commit 9806b14
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions co-authors-plus.php
Expand Up @@ -767,8 +767,8 @@ function coauthors_set_post_author_field( $data, $postarr ) {
// This action happens when a post is saved while editing a post
if ( isset( $_REQUEST['coauthors-nonce'] ) && isset( $_POST['coauthors'] ) && is_array( $_POST['coauthors'] ) ) {

// urlencode() is for encoding coauthor name with special characters to compare names when getting coauthor.
$author = urlencode( sanitize_text_field( $_POST['coauthors'][0] ) );
// rawurlencode() is for encoding coauthor name with special characters to compare names when getting coauthor.
$author = rawurlencode( sanitize_text_field( $_POST['coauthors'][0] ) );

if ( $author ) {
$author_data = $this->get_coauthor_by( 'user_nicename', $author );
Expand Down Expand Up @@ -1137,7 +1137,7 @@ public function ajax_suggest() {
if( empty( $authors ) ) echo apply_filters( 'coauthors_no_matching_authors_message', 'Sorry, no matching authors found.');

foreach ( $authors as $author ) {
echo esc_html( $author->ID . ' | ' . $author->user_login . ' | ' . $author->display_name . ' | ' . $author->user_email . ' | ' . urldecode( $author->user_nicename ) ) . "\n";
echo esc_html( $author->ID . ' | ' . $author->user_login . ' | ' . $author->display_name . ' | ' . $author->user_email . ' | ' . rawurldecode( $author->user_nicename ) ) . "\n";
}

die();
Expand Down

0 comments on commit 9806b14

Please sign in to comment.