-
Notifications
You must be signed in to change notification settings - Fork 0
/
leaderbord.php
39 lines (34 loc) · 1.27 KB
/
leaderbord.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php /* Template Name: Leaderbord */ ?>
<?php get_header(); ?>
<?php
$args = array(
'meta_key' => 'experience',
'order' => 'ASC',
);
$blogusers = get_users( $args ); ?>
<div class="leaderbord">
<div class="row-title"> Leaderboard</div>
<ul><?php foreach ( $blogusers as $user ) { ?>
<li>
<a href="<?php echo '/author/' . $user->data->user_login; ?>">
<div class="row-group">
<?php
echo get_avatar( $user->ID );
$userdata = get_userdata( $user->ID );
?>
<?php echo '<div class="user-name">' . esc_html( $userdata->first_name ) . '</div>' ?> </div>
<div class="row-group">
<?php echo '<div class="row-score">lvl ' . get_user_meta( $user->ID, 'experience_level', true ) . '</div>' ?>
<?php
if ( get_user_meta( $user->ID, 'experience', true ) ) {
echo '<div class="row-xp">' . get_user_meta( $user->ID, 'experience', true ) . '</div>';
} else {
echo '<div class="row-xp">0</div>';
} ?>
</div>
</a>
</li>
<?php } ?>
</ul>
</div>
<?php get_footer(); ?>