adnanbcn
asked 6 years ago

Hi, my site already have a user profile page (“mystie.com/usuario/username/”) with your plugin i need to make the other one “mystie.com/user/username/” so there are 2 user pages that’s a big problem for me.
How can a redirect your plugin user profile page to my user page (“mystic.com/usuario/username/”)  don’t worry about user content, i can get all user Q&A in my author page. (don’t worry plugin updates, because every time i need to update i can remember the changes).
 
Thanks
i try make some change in “wp-content/plugins/dw-question-answer-pro/inc/User.php” but not make it work.

1 Answers
DominicStaff
answered 6 years ago

In this case, you can use the following code in the functions.php file: 

add_filter('dwqa_get_author_link', 'custom_dwqa_author_link', 20, 3 );
function custom_dwqa_author_link($url, $user_id, $user){
//=> custom to
$user_page_id = 0; //enter your user page
$page_user_profile_url = get_permalink($user_page_id);
if ( $page_user_profile_url ) {
return trailingslashit($page_user_profile_url). $user->user_login;
}
return $url;
}
adnanbcn
replied 6 years ago

Work perfect 🙂 Thanks man 🙂 just a last thing your code giveme (mystie.com/usuario/username) with out last (/) so my server config “301 Moved Permanently” to (mystie.com/usuario/username/) it,s posible to get with last / this way i save a 301 Moved Permanently.

Thanks again

(here in forum anybody get Q&A post out of plugin?)

Dominic Staff
replied 6 years ago

You can use the following code:

add_filter(‘dwqa_get_author_link’, ‘custom_dwqa_author_link’, 20, 3 );
function custom_dwqa_author_link($url, $user_id, $user){
//=> custom to
$user_page_id = 0; //enter your user page
$page_user_profile_url = get_permalink($user_page_id);
if ( $page_user_profile_url ) {
return trailingslashit($page_user_profile_url). $user->user_login.’/’;
}
return $url;
}

Powered by DW Question & Answer Pro