kenco
asked 7 years ago

Hi, i use the userpro plugin and i want to show all questions of the user on his profile page.
Can you help me please?

kenco
replied 7 years ago

Has anyone a solution for this?

1 Answers
DominicStaff
answered 7 years ago

 At the moment, the Q&A plugin just compatible with the Buddypress theme. In this case, you can send me your plugin, we will install on our demo and check it.
You can send me via email: [email protected]

kenco
replied 7 years ago

Hi, i had already send it to you.
I have tried to do that in this way:

first i have enter the shortcode [dwqa-list-questions] in the profile page where is possible to edit the wordpress page from dashboard, than i added the following code to function.php from my theme:

add_filter( ‘dwqa_prepare_archive_posts’, ‘dwqa_refilter_question’ );
function dwqa_refilter_question( $args = null ) {
if ( isset( $args ) ){
}
// change 0 to page id you had place other archive page contain shortcode [dwqa-list-questions]
if ( is_page( 0) ) {
$question_args = array(
‘post_type’ => ‘dwqa-questions’,
‘posts_per_page’ => 5, //Number of Questions
‘post_type’ => ‘dwqa-questions’, //Get the questions only
‘post_author’ => get_current_user_id(), // the ID of user
‘post_status’ => ‘publish’
);
// this will return array with 5 answer’s ids
$questions = get_posts( $question_args );
$question_lists = array();

foreach( $questions as $question_id ) {
$question_lists[] = get_post_meta( $question_id, ‘_question’, true );
}
$args[‘post__in’] = $question_lists;
}
return $args;
}

i have tried in serveral ways to filter the question, but i dont know how i can get the user id.
I want only to display the questions of a user under his profile card in his profile page.
Maybe is there a other way to do that? a similar question was already ask to you:

https://www.designwall.com/question/listing-all-of-user-questions/

I

Powered by DW Question & Answer Pro