Created
February 6, 2015 21:58
-
-
Save anonymous/85a6909a5a1a8b4c7a67 to your computer and use it in GitHub Desktop.
user-question.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php ?><?php get_header( 'question' ); ?> | |
<div id="qa-page-wrapper"> | |
<div id="qa-content-wrapper"> | |
<?php do_action( 'qa_before_content', 'edit-question' ); ?> | |
<div class="qa-user-head"> | |
<div id="qa-user-box"> | |
<?php | |
global $bp; //BuddyPress active | |
$userdata = (isset($bp) ) ? $userdata = $bp->displayed_user->userdata : get_queried_object(); | |
//var_dump($userdata); | |
?> | |
<?php echo get_avatar( $userdata->ID, 128 ); ?> | |
</div> | |
<div id="qa-user-details"> | |
<h3 class="qa-user-name"><?php echo $userdata->display_name; ?></h3> | |
<p><?php _e( 'Member for ', QA_TEXTDOMAIN ); ?> | |
<?php echo human_time_diff( strtotime( $userdata->user_registered ) ); ?></p> | |
<?php the_qa_user_rep( $userdata->ID ); ?> <p><?php _e( ' Reputation Points', QA_TEXTDOMAIN ); ?></p> | |
</div> | |
</div> | |
<?php | |
$question_query = new WP_Query( array( | |
'author' => $userdata->ID, | |
'post_type' => 'question', | |
'posts_per_page' => 10, | |
'update_post_term_cache' => false | |
) ); | |
$answer_query = new WP_Query( array( | |
'author' => $userdata->ID, | |
'post_type' => 'answer', | |
'posts_per_page' => 10, | |
'update_post_term_cache' => false | |
) ); | |
$fav_query = new WP_Query( array( | |
'post_type' => 'question', | |
'meta_key' => '_fav', | |
'meta_value' => $userdata->ID, | |
'posts_per_page' => 10, | |
) ); | |
?> | |
<div id="qa-user-tabs-wrapper"> | |
<ul id="qa-user-tabs"> | |
<li><a href="#qa-user-answers"> | |
<span id="user-answers-total"><?php echo number_format_i18n( $answer_query->found_posts ); | |
echo _n( ' Answer Given', ' Answers Given', $answer_query->found_posts, QA_TEXTDOMAIN ); ?></span> | |
</a></li> | |
<li><a href="#qa-user-questions"> | |
<span id="user-questions-total"><?php echo number_format_i18n( $question_query->found_posts ); | |
echo _n( ' Question Submitted', ' Questions Submitted', $question_query->found_posts, QA_TEXTDOMAIN ); ?></span> | |
</a></li> | |
</ul> | |
<div id="qa-user-questions"> | |
<div id="question-list"> | |
<?php while ( $question_query->have_posts() ) : $question_query->the_post(); ?> | |
<?php do_action( 'qa_before_question_loop' ); ?> | |
<div class="question"> | |
<?php do_action( 'qa_before_question' ); ?> | |
<div class="question-summary"> | |
<?php do_action( 'qa_before_question_summary' ); ?> | |
<h3><?php the_question_link(); ?></h3> | |
<?php the_question_category( '<div class="question-category">', ' - ', '</div>' ); ?> | |
<?php the_question_tags( '<div class="question-tags">', ' ', '</div>' ); ?> | |
<?php if (function_exists('wpfp_link')) { wpfp_link(); } ?> | |
<?php do_action( 'qa_after_question_summary' ); ?> | |
</div> | |
<?php do_action( 'qa_after_question' ); ?> | |
</div> | |
<?php do_action( 'qa_after_question_loop' ); ?> | |
<?php endwhile; ?> | |
</div><!--#question-list--> | |
</div><!--#qa-user-questions--> | |
<div id="qa-user-answers"> | |
<ul> | |
<?php | |
while ( $answer_query->have_posts() ) : $answer_query->the_post(); | |
list( $up, $down ) = qa_get_votes( get_the_ID() ); | |
echo '<li>'; | |
echo "<div class='answer-score'>"; | |
echo number_format_i18n( $up - $down ); | |
echo "</div> "; | |
the_answer_link( get_the_ID() ); | |
echo '</li>'; | |
endwhile; | |
?> | |
</ul> | |
</div><!--#qa-user-answers--> | |
</div><!--#qa-user-tabs-wrapper--> | |
<?php do_action( 'qa_after_content', 'edit-question' ); ?> | |
</div> | |
</div><!--#qa-page-wrapper--> | |
<?php | |
global $qa_general_settings; | |
if ( isset( $qa_general_settings["page_layout"] ) && $qa_general_settings["page_layout"] !='content' ) | |
get_sidebar( 'question' ); | |
?> | |
<?php get_footer( 'question' ); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment