Me again. Could you tell me how to create a site like this? http://designwall.com/experts/
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 🙂
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
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
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
Anyone?
Hi everyone,
Here is the template file that is used for DesignWall:
https://gist.github.com/bighug/9064756.
All you need to do is copy this file to your theme folder, edit the code to make it compatible with your theme style.
Hope this helps!
Hi BigHub,
Thanks for your support.
Dear @BigHug thanks for sharing the code! Its great. However it would be awesome and a big favor to all if you could also share the css code. As its a lot of work getting the css to work on each template.
Thank you once again and waiting in anticipation!
Cheers!
Please login or Register to submit your answer