dawfawf
asked 11 years ago

Me again. Could you tell me how to create a site like this? http://designwall.com/experts/

3 Answers
DominicStaff
answered 11 years ago

Hi Dawfawf !
Glad that you are interested in that Expert page of ours. In DW Question & Answer plugin, we already support a function in which displays all the users with the most answers in a period of time:

 dwqa_user_most_answer( $number = 10, $from = false, $to = false );

The code is located in dw-question-answer/inc/actions.php line 1077.
To illustrate, if I want to have a list of 10 users with the most answers in the last 7 days, I will create a new page with the following code:

 <?php
/**
 * Template Name: Experts List
 */
get_header();

$users = dwqa_user_most_answer(10, strtotime('-7 days'));
foreach ($users as $user) {
$user_info = get_userdata( $user['post_author'] );
echo $user_info->display_name.'<br />';
}

get_footer(); ?>

Then log in to Dashboard > Pages > Add New.
Name the page title “Experts List” (for example).
In Page Attributes, select Page template = Experts List and it’s done
Hope this helps! Please try and let us know the results 🙂

harsh deshmukh
replied 11 years ago

Hi Dominic,

I tried it out..and pasted the code in themes activity folder.

But I am getting some weird result.

Please suggest where to paste the code. I think function is not being called properly.

http://harsh031.0fees.net/experts/

Regards
Harsh

harsh deshmukh
answered 11 years ago

Hi Dominic, I put the code in themes activity directory.. Things are working fine but I am just getting the expert name by using above code. Here I would like to fetch some more info like experts profile info and more. Note: Right now I want to fetch author_id and want to show respected information corresponding to that author:
<?php
/**
* Template Name: Experts List
*/
get_header(); $users = dwqa_user_most_answer(10, strtotime(‘-7 days’));
foreach ($users as $user) {
$user_info = get_userdata( $user[‘post_author’] );
$get_id=$user[‘post_author’]
echo $get_id.'<br/>’;
echo $user_info->display_name.'<br />’; } get_footer(); ?>   I used above code but still I am not able to fetch the user id info.   Can you please help suggest. ========================================================== One more help:
I am using below member-header.php function to show the single member profile.
<?php /**
* BuddyPress – Users Header
*
* @package BuddyPress
* @subpackage bp-default
*/ ?> <?php do_action( ‘bp_before_member_header’ ); ?> <div id=”item-header-avatar”>
<a href=”<?php bp_displayed_user_link(); ?>”> <?php bp_displayed_user_avatar( ‘type=full’ ); ?> </a>
</div><!– #item-header-avatar –> <div id=”item-header-content”> <h2>
<a href=”<?php bp_displayed_user_link(); ?>”><?php bp_displayed_user_fullname(); ?></a>
</h2> <?php if ( bp_is_active( ‘activity’ ) && bp_activity_do_mentions() ) : ?>
<span class=”user-nicename”>@<?php if(function_exists(‘bp_displayed_user_mentionname’)) { bp_displayed_user_mentionname(); } else { bp_displayed_user_username(); } ?></span>
<?php endif; ?> <span class=”activity”><?php bp_last_activity( bp_displayed_user_id() ); ?></span>
<div>
<?php
$user_id = bp_displayed_user_id();
$question_count = dwqa_user_question_count( $user_id );
$answer_count = dwqa_user_answer_count( $user_id );
$comment_count = dwqa_user_comment_count( $user_id );
echo “Question $question_count Answeres $answer_count Comments $comment_count”; ?>
</div> <?php do_action( ‘bp_before_member_header_meta’ ); ?> <div id=”item-meta”> <?php if ( bp_is_active( ‘activity’ ) ) : ?> <div id=”latest-update”> <?php bp_activity_latest_update( bp_displayed_user_id() ); ?> </div> <?php endif; ?> <div id=”item-buttons”> <?php do_action( ‘bp_member_header_actions’ ); ?> </div><!– #item-buttons –> <?php
/***
* If you’d like to show specific profile fields here use:
* bp_member_profile_data( ‘field=About Me’ ); — Pass the name of the field
*/
bp_member_profile_data( ‘field=About You’ );
do_action( ‘bp_profile_header_meta’ ); ?> </div><!– #item-meta –> </div><!– #item-header-content –> <?php do_action( ‘bp_after_member_header’ ); ?> <?php do_action( ‘template_notices’ ); ?>   ========================================================== But I want  only below things to be displayed.(ie. author info as we can see in the snap shot)
https://www.dropbox.com/s/fb75rkyjmcdjvg5/Expert.JPG  
To get the expert page I want to sink  below scripts in EXPERTS LIST Template: <?php /**
* BuddyPress – Users Header
*
* @package BuddyPress
* @subpackage bp-default
*/ ?> <?php do_action( ‘bp_before_member_header’ ); ?> <div id=”item-header-avatar”>
<a href=”<?php bp_displayed_user_link(); ?>”> <?php bp_displayed_user_avatar( ‘type=full’ ); ?> </a>
</div><!– #item-header-avatar –> <div id=”item-header-content”> <h2>
<a href=”<?php bp_displayed_user_link(); ?>”><?php bp_displayed_user_fullname(); ?></a>
</h2> <?php if ( bp_is_active( ‘activity’ ) && bp_activity_do_mentions() ) : ?>
<span class=”user-nicename”>@<?php if(function_exists(‘bp_displayed_user_mentionname’)) { bp_displayed_user_mentionname(); } else { bp_displayed_user_username(); } ?></span>
<?php endif; ?> <span class=”activity”><?php bp_last_activity( bp_displayed_user_id() ); ?></span>
<div>
<?php 
$user_id = bp_displayed_user_id();
$question_count = dwqa_user_question_count( $user_id );
$answer_count = dwqa_user_answer_count( $user_id );
$comment_count = dwqa_user_comment_count( $user_id );
echo “Question $question_count Answeres $answer_count Comments $comment_count”; ?>
</div> ==========================================================
Please help suggest how we can achieve above. Please suggest.  
 
Thanks & Regards, Harsh

harsh deshmukh
replied 11 years ago

Please find required ink and the member profile page script as below:

https://www.dropbox.com/s/t4jx7bsw7ro57yz/member-header.txt

http://harsh031.0fees.net/author/harsh-deshmukh/profile/

Regards,
Harsh

Kirby Tokin
answered 11 years ago

Anyone?

Powered by DW Question & Answer Pro