-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathauthor.php
152 lines (146 loc) · 4.52 KB
/
author.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<?php
/**
* Author Page
* by Philip M. Hofer (Frumph)
* http://frumph.net/
*
* Content for the author page.
*
* The table 'user-info' is only visible to admins.
* For table 'user-contacts' can you find possible contact methods
* in profile-options.php function add_new_contactmethods.
*/
remove_action( 'init', 'the_neverending_home_page_init', 10 );
get_header();
if(get_query_var('author_name') ) {
$curauth = get_user_by('slug', get_query_var('author_name'));
} else {
$curauth = get_userdata(get_query_var('author'));
} if (empty($curauth)) { ?>
<h2><?php _e( 'No such author.', 'easel' ); ?></h2>
<?php } else { ?>
<div <?php post_class(); ?>>
<div class="post-head"></div>
<div class="post-content">
<div class="entry">
<div class="userpage-avatar">
<?php echo str_replace('photo', 'photo instant nocorner itxtalt', get_avatar($curauth->user_email, 64, easel_random_default_avatar($curauth->user_email), esc_attr($curauth->display_name, 1))); ?>
</div>
<div class="userpage-info">
<div class="userpage-bio">
<?php
if($curauth->display_name)
$authorname = $curauth->display_name;
elseif($curauth->user_nickname)
$authorname = $curauth->nickname;
elseif($curauth->user_nicename)
$authorname = $curauth->user_nicename;
else
$authorname = $curauth->user_login;
?>
<h2><?php echo $authorname; ?></h2>
<?php if (current_user_can('manage_options')) { ?>
<table class="user-info">
<tr>
<td class="user-info-name">
<?php _e( 'Registered on', 'easel' ); ?>
</td>
<td class="user-info-value">
<?php echo date_i18n(get_option('date_format'), strtotime($curauth->user_registered)); ?>
</td>
</tr>
<tr>
<td class="user-info-name">
<?php _e( 'Posts #', 'easel' ); ?>
</td>
<td class="user-info-value">
<?php $author_id = get_the_author_meta('ID'); echo count_user_posts( $author_id ); ?>
</td>
</tr>
</table>
<?php } ?>
<br />
<table class="user-contacts">
<?php if (current_user_can('manage_options')) { ?>
<tr>
<td class="user-contacts-serv">
<?php _e( 'Email', 'easel' ); ?>
</td>
<td class="user-contacts-url">
<a href="mailto://<?php echo $curauth->user_email; ?>" target="_blank"><?php echo $curauth->user_email; ?></a>
</td>
</tr>
<?php }
if (!empty($curauth->user_url)) { ?>
<tr>
<td class="user-contacts-serv">
<?php _e( 'Website', 'easel' ); ?>
</td>
<td class="user-contacts-url">
<a href="<?php echo $curauth->user_url; ?>" target="_blank"><?php echo $curauth->user_url; ?></a>
</td>
</tr>
<?php }
if (!empty($curauth->twitter)) { ?>
<tr>
<td class="user-contacts-serv">
<?php _e( 'Twitter', 'easel' ); ?>
</td>
<td class="user-contacts-url">
<a href="<?php echo $curauth->twitter; ?>" target="_blank"><?php echo $curauth->twitter; ?></a>
</td>
</tr>
<?php }
if (!empty($curauth->facebook)) { ?>
<tr>
<td class="user-contacts-serv">
<?php _e( 'Facebook', 'easel' ); ?>
</td>
<td class="user-contacts-url">
<a href="<?php echo $curauth->facebook; ?>" target="_blank"><?php echo $curauth->facebook; ?></a>
</td>
</tr>
<?php }
if (!empty($curauth->googleplus)) { ?>
<tr>
<td class="user-contacts-serv">
<?php _e( 'Google+', 'easel' ); ?>
</td>
<td class="user-contacts-url">
<a href="<?php echo $curauth->googleplus; ?>" target="_blank" rel="me"><?php echo $curauth->googleplus; ?></a>
</td>
</tr>
<?php } ?>
</table>
</div>
<?php if (!empty($curauth->description)) { ?>
<div class="userpage-desc">
<?php echo $curauth->description; ?>
</div>
<?php } ?>
</div>
<div class="clear"></div>
<?php if (have_posts()) { ?>
<div class="userpage-posts">
<h3><?php _e( 'Posts by', 'easel' ); ?> <?php echo $authorname; ?> ¬</h3>
<br />
<table class="author-posts">
<?php while (have_posts()) : the_post(); ?>
<tr>
<td class="author-archive-date" align="right">
<?php the_time('M j, Y') ?>
</td>
<td class="author-archive-title">
<a href="<?php the_permalink(); ?>"><?php the_title() ?></a>
</td>
</tr>
<?php endwhile; ?>
</table>
</div>
<?php } ?>
</div>
</div>
<div class="post-foot"></div>
</div>
<?php }
get_footer();