Mantas Giriūnas
asked 8 years ago


I have a problem with displayed URL when I list user’s (author’s) questions. It gives me URL like this: 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


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.

1 Answers
answered 8 years ago

I will answer your issue in the following question:

Powered by DW Question & Answer Pro