Q&A Plugin - Show questions on Buddypress member profile page?

I'm trying to show the questions 'panel' on a Buddypress member profile page.

I've copied the code in the div 'qa-page-wrapper' from the file 'archive-question.php' and pasted it into my Buddypress profile template ('/members/single/home.php').

The problem is I get the message 'No questions found'.

I clearly need to tell this block of code where to get its data from, but I can't work out how. I've searched high and low through all the plugin files, but I'm not a developer so I'm struggling a bit.

Any pointers?

  • mattbailey
    • Design Lord, Child of Thor

    Well I'm not sure if this is the best way to do it, but I've solved it by creating a new WP_Query on my Buddypress profile template ('/members/single/home.php') and slightly modifying the 'while' loop.

    Here's the modified code that I've pasted from 'archive-question.php' into '/members/single/home.php' in case it's useful to others:

    <div id="qa-page-wrapper">
    				<?php the_qa_error_notice(); ?>
    				<?php the_qa_menu(); ?>
    					$question_list_args = array( 'post_type' => 'question' );
    					$question_list_loop = new WP_Query( $question_list_args );
    				<?php //if ( !have_posts() ) : ?>
    				<!--<p><?php //$question_ptype = get_post_type_object( 'question' ); echo $question_ptype->labels->not_found; ?></p>-->
    				<?php //else: ?>
    				<div id="question-list">
    				<?php //while ( have_posts() ) : the_post(); ?>
    				<?php while ( $question_list_loop->have_posts() ) : $question_list_loop->the_post(); ?>
    					<div class="question">
    						<div class="question-stats">
    							<?php the_question_score(); ?>
    							<?php the_question_status(); ?>
    						<div class="question-summary">
    							<h3><?php the_question_link(); ?></h3>
    							<?php the_question_tags( '<div class="question-tags">', ' ', '</div>' ); ?>
    							<div class="question-started">
    								<?php the_qa_time( get_the_ID() ); ?>
    								<?php the_qa_user_link( $post->post_author ); ?>
    				<?php endwhile; ?>
    				<?php the_qa_pagination(); ?>
    				<?php //endif; ?>
  • DavidM
    • DEV MAN’s Mascot

    Hi mattbailey,

    Thanks for posting that back here, I really do think others will find this tremendously useful as there have been a number of mentions of Q&A features for BuddyPress. I'm giving you some rep points for sharing such a useful snippet here!


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.