Hi,
I have a problem with displayed URL when I list user’s (author’s) questions. It gives me URL like this: http://example.com/?user=John which displays actual username (it brings user_login variable) and I want it to use nickname instead or ID variable (for security purposes).
This is a part of code I believe is responsible for it:
at wp-contentpluginsdw-question-answerincUser.php
function dwqa_get_author_link( $user_id = false ) {
if ( ! $user_id ) {
return false;
}
global $dwqa_general_settings;
$user = get_user_by( 'id', $user_id );
$question_link = isset( $dwqa_general_settings['pages']['archive-question'] ) ? get_permalink( $dwqa_general_settings['pages']['archive-question'] ) : false;
if ( $question_link ) {
return add_query_arg( array( 'user' => urlencode( $user->user_login ) ), $question_link );
} else {
return get_the_author_link( $user_id );
}
}
Tried to change:
return add_query_arg( array( 'user' => urlencode( $user->user_login ) ), $question_link
to
return add_query_arg( array( 'user' => urlencode( $user->nickname ) ), $question_link
It does change URL the way I want to, however it does not filter author/user questions anymore. I tried to use ‘ID’ or ‘user_nicename’ or ‘display_user’ variables for change, but when I access modified URL it doesn’t trigger any filtering in order to list author questions.
I sent and notified our technical team about this problem. We will check it now.
We have checked about this issue and see that it do not support to filter by nickname. Currently, the plugin only support to display the username.
We will discuss about this issue in the next version.
Thank you, I would look forward to see such feature. And just out of curiosity, may I ask which part of code is responsible for filtering by nickname?
Currently, you can not edit in the core of plugin. We will check and discuss it. Maybe, we will create a new function to make it. We will let you know when it supports in the plugin.
Please login or Register to submit your answer