-
Notifications
You must be signed in to change notification settings - Fork 0
/
author.php
172 lines (149 loc) · 7.25 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<?php
/**
* The template for displaying Author Archive pages
*
* Used to display archive-type pages for posts by an author.
*
* @link http://codex.wordpress.org/Template_Hierarchy
*
* @package WordPress
* @subpackage Tufts Great Diseases
* @since Tufts Great Diseases 1.0
*/
?>
<?php get_header(); ?>
<?php
// Author object
$user_obj = get_queried_object();
// If we are looking at our own page, check if we've uploaded a picture
if( $user_obj->ID == get_current_user_id() ){
if( class_exists('Simple_Local_Avatars') ){
$local_avatar = new Simple_Local_Avatars();
if( isset( $_POST['delete_avatar'] ) ){
$local_avatar->avatar_delete( $user_obj->ID );
}else{
$local_avatar->edit_user_profile_update( $user_obj->ID );
}
}
}
?>
<div class="content-sidebar-wrapper">
<?php get_sidebar(); ?>
<div id="content-wrapper">
<div id="breadcrumb">
<?php if(class_exists('bcn_breadcrumb_trail'))
{
//Make new breadcrumb object
$breadcrumb_trail = new bcn_breadcrumb_trail;
//Setup our options
//Set the home_title to Blog
$breadcrumb_trail->opt['home_title'] = "Home";
$breadcrumb_trail->opt['separator'] = " » ";
//Set the current item to be surrounded by a span element, start with the prefix
$breadcrumb_trail->opt['current_item_prefix'] = '';
//Set the suffix to close the span tag
$breadcrumb_trail->opt['current_item_suffix'] = '';
//Fill the breadcrumb trail
$breadcrumb_trail->fill();
//Display the trail
$breadcrumb_trail->display();
}
?>
</div>
<div id="breadcrumbdivider"> </div>
<div id="author-meta">
<div id="author-avatar">
<?php echo get_avatar( $user_obj->ID, '200' ); ?>
<?php
if( $user_obj->ID == get_current_user_id() ){
echo '<br />';
echo '<button id="gd-upload-profile-pic">Upload a Picture</button><button id="gd-remove-profile-pic">Remove Picture</button>';
echo '<form id="gd-avatar-upload" method="post" enctype="multipart/form-data">';
echo '<input type="file" name="simple-local-avatar" id="simple-local-avatar" style="display: none;"/>';
//echo '<input type="submit">';
echo wp_nonce_field( 'simple_local_avatar_nonce', '_simple_local_avatar_nonce', false, false );
echo '</form>';
}
?>
</div>
<h1><?php printf( __( '%s', 'twentytwelve' ), get_the_author_meta('display_name', $user_obj->ID) ); ?></h1>
<?php
// get the team the user belongs to ...
if( class_exists( 'CTXPS_Queries' ) ){
$groups = CTXPS_Queries::get_groups( $user_obj->ID );
$usr_group = new stdClass();
if( count( $groups ) > 0 ){
$usr_group = $groups[0];
}
$team_page_id = get_option('gd_team_page_id');
$team_page_permalink = get_permalink( $team_page_id );
echo '<h1>Team: <a href="' . $team_page_permalink . '?team_id=' . $usr_group->ID . '">' . $usr_group->group_title . '</a></h1>';
// Display team role
$roles = get_option( 'gd-team-roles' );
$user_role = (int) get_user_meta( $user_obj->ID, 'gd-team-role', true);
if( is_array( $roles ) && isset( $roles[$user_role] ) ){
echo '<h1>Role: ' . $roles[$user_role] . '</h1>';
}
}
?>
</div>
<?php //Display the posts of the user ?>
<div id="post-content-author-<?php echo $user_obj->ID ?>" class="post-content-author">
<?php
// Limit the number of posts to make the page look nicer...
?>
<?php if ( have_posts() ) : ?>
<h1>Posts by <?php echo get_the_author_meta('display_name', $user_obj->ID) ?>:</h1>
<?php while ( have_posts() ) : the_post(); ?>
<div id="post-<?php the_ID() ?>" class="author-post">
<!-- post meta -->
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<br />
<small style="font-weight:normal;">Posted on <?php the_date(); ?> by <?php the_author_posts_link(); ?> | Categories: <?php the_category(', ') ; ?>
<?php the_tags( ' ' . __( '| Tagged: ' ) . ' ', ', ', ''); ?>
|
<?php if( class_exists('smartpost') ) : ?>
<?php
// Check if the permalink structure is with slashes, or the default structure with /?p=123
$permalink_url = get_permalink( $post->ID );
if( $_GET['edit_mode'] ){
$link_txt = "View mode";
}else{
$link_txt = "Edit";
if( strpos( $permalink_url, '?') ){
$permalink_url .= '&edit_mode=true';
}else{
$permalink_url .= '?edit_mode=true';
}
}
?>
<span class="editlink"><a href="<?php echo $permalink_url ?>"><?php echo $link_txt ?></a></span>
<?php else: ?>
<?php edit_post_link(__('Edit'),'<span class="editlink">','</span>'); ?>
<?php endif; ?>
</small>
</h3>
<!-- article content -->
<div class="content">
<div id="post-thumb-<?php the_ID() ?>" class="post-thumb">
<a href="<?php the_permalink() ?>">
<?php the_post_thumbnail( array(100, 100) ); ?>
</a>
</div>
<?php the_excerpt(); ?>
</div>
<div class="clear"></div>
</div><!-- end post-<?php the_ID() ?>-->
<?php endwhile; ?>
<?php else: ?>
<h1><?php echo get_the_author_meta('display_name', $user_obj->ID) ?> has not posted anything to this site yet!</h1>
<h1>Check back later!</h1>
<?php endif; ?>
</div><!-- end .post-content-author -->
<div id="post-meta">
<div id="breadcrumbdivider"> </div>
</div>
<div class="clear"></div>
</div><!-- end #content-wrapper -->
<?php get_footer(); ?>
</div><!-- end .content-sidebar-wrapper -->