-
Notifications
You must be signed in to change notification settings - Fork 0
/
author-layout-1.php
390 lines (324 loc) · 17.3 KB
/
author-layout-1.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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
<?php
/**
* The author template
*
*/
get_header();
$author = get_user_by( 'slug', get_query_var( 'author_name' ) );
$email = $author->user_email;
$site = $author->user_url;
$size = 100;
global $wp_query,$post,$wpdb, $current_user,$query_string;
wp_get_current_user();
$wpdb->myo_ip = $wpdb->prefix . 'epicred';
$ph_follows = $wpdb->prefix . "ph_follows";
// grab the queries we want for the new tabbed display, being:-
$fid = $current_user->ID;
$aid = $author->ID;
$q1 = "SELECT epicred_id FROM $wpdb->myo_ip JOIN $wpdb->posts ON $wpdb->myo_ip.epicred_id = $wpdb->posts.ID WHERE epicred_ip = $aid AND $wpdb->posts.post_status = 'publish'";
$upvoted = $wpdb->get_results($q1, OBJECT);
$cu = count($upvoted);
// #2 submitted
$q2 = "SELECT ID FROM $wpdb->posts WHERE $wpdb->posts.post_author = $aid AND $wpdb->posts.post_type = 'post' AND $wpdb->posts.post_status = 'publish'";
$submitted = $wpdb->get_results($q2, OBJECT);
$cs = count($submitted);
// #3 'made' (UX to be added - suggest a maker - how to handle since not just twitter login...)
// #4 collections (UX to be added)
$q4 = "SELECT ID FROM $wpdb->posts WHERE $wpdb->posts.post_author = $aid AND $wpdb->posts.post_type = 'collections' AND $wpdb->posts.post_status = 'publish'";
$collected = $wpdb->get_results($q4, OBJECT);
$cl = count($collected);
#} discussions
if(of_get_option('ph_enable_discussions') == 1){
$q7 = "SELECT ID FROM $wpdb->posts WHERE $wpdb->posts.post_author = $aid AND $wpdb->posts.post_type = 'discussions' AND $wpdb->posts.post_status = 'publish'";
$discussed = $wpdb->get_results($q7, OBJECT);
$cd = count($discussed);
}
// #5 followers (UX to be added)
$q5 = "SELECT follower FROM $ph_follows WHERE followed = $aid";
$followers = $wpdb->get_results($q5, OBJECT);
$cfr = count($followers);
// #6 following (UX to be added)
$q6 = "SELECT followed FROM $ph_follows WHERE follower = $aid";
$followed = $wpdb->get_results($q6, OBJECT);
$cfd = count($followed);
global $sub_menu_ph62;
if($sub_menu_ph62){
$pheaderclass = 'extra-margin-top';
}else{
$pheaderclass = 'no-extra-margin';
}
?>
<style>
.ph-list-thumbnail {
float: left;
width: 200px;
margin-right: 10px;
}
</style>
<header class="page-header <?php echo $pheaderclass;?>">
<div class="container">
<div class="page-header--avatar">
<!-- <a class="user-image--badge v-maker v-big" href="#">M</a>-->
<?php echo get_avatar( $aid ); ?>
</div>
<div class="page-header--info" data-component="Emoji">
<h1 class="page-header--title"><?php echo $author->nickname;?><span class="page-header--id">#<?php echo $aid; ?></span></h1>
<h2 class="page-header--subtitle"><?php echo $author->description; ?></h2>
<div class="page-header--links">
<?php
$tw = get_user_meta( $aid, 'twitter', true );
if($tw){
?>
<a class="page-header--links--link" target="_blank" href="http://twitter.com/<?php echo $tw; ?>">@<?php echo $tw; ?></a>
<?php }?>
<a class="page-header--links--link" target="_blank" href="<?php echo $site;?>"><?php echo $site;?></a>
</div>
</div>
<div class="page-header--buttons">
<?php
if($fid != $aid){
$inDB = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $ph_follows WHERE follower = %d AND followed = %d", array($fid, $aid)) );
if($inDB){ ?>
<a class="button v-red ph-follow" data-crud = "0" data-follower="<?php echo $fid;?>" data-follow="<?php echo $aid;?>" href="#"><?php _e("Unfollow","ph_theme");?></a>
<?php }else{ ?>
<a class="button v-green ph-follow" data-crud = "1" data-follower="<?php echo $fid;?>" data-follow="<?php echo $aid;?>" href="#"><?php _e("Follow","ph_theme");?></a>
<?php } }?>
</div>
<?php ?>
<nav class="page-header--navigation">
<ul>
<li class="page-header--navigation--tab m-active" id = 'ah-upvoted'>
<a href="#"><strong><?php echo $cu; ?></strong> <?php _e('Upvoted','pluginhunt');?></a>
</li>
<li class="page-header--navigation--tab" id = 'ah-submitted'>
<a href="#"><strong><?php echo $cs; ?></strong><?php _e('Submitted','pluginhunt');?></a>
</li>
<!-- MAKER to come in the future
<li class="page-header--navigation--tab" id = 'ah-made'>
<a href="#"><strong>3</strong> Made</a>
</li>
-->
<li class="page-header--navigation--tab" id = 'ah-collections'>
<a href="#"><strong><?php echo $cl; ?></strong><?php _e('Collections','pluginhunt');?></a>
</li>
<?php if(of_get_option('ph_enable_discussions') == 1){ ?>
<li class="page-header--navigation--tab" id = 'ah-discussions'>
<a href="#"><strong><?php echo $cd; ?></strong><?php _e('Discussions','pluginhunt');?></a>
</li>
<?php } ?>
<li class="page-header--navigation--tab" id = 'ah-followers'>
<a href="#"><strong><?php echo $cfr; ?></strong><?php _e('Followers','pluginhunt');?></a>
</li>
<li class="page-header--navigation--tab" id = 'ah-following'>
<a href="#"><strong><?php echo $cfd; ?></strong><?php _e('Following','pluginhunt');?></a>
</li>
</ul>
</nav>
</div>
</header>
<div class='container ph-tab-container ph-layout-1'>
<div class='ph-tabbed active' id ='ah-upvoted-tab'>
<?php global $post; ?>
<?php foreach ($upvoted as $ID): ?>
<?php
$post = get_post($ID->epicred_id);
$postvote = get_post_meta($post->ID, 'epicredvote' ,true);
wpeddit_post_ranking($post->ID);
if($postvote == NULL){
$postvote = 0;
}
$fid = $current_user->ID;
pluginhunt_GetRankings($post->ID, $fid);
?>
<div class = 'row hunt-row <?php echo $blob;?>' style = 'margin-bottom:20px'>
<?php pluginhunt_outputVoting($post); ?>
<?php pluginhunt_FeaturedImage($post); ?>
<div class='post-meta-hunt'>
<?php pluginhunt_ExternalLink($post); ?>
<?php pluginhunt_CollectionOutput($post->ID); ?>
<?php pluginhunt_AuthorMeta($post); ?>
<?php pluginhunt_commentList($post); ?>
</div>
<?php pluginhunt_PostContent($post); ?>
</div>
<div style="clear:both"></div>
<div class="arrow fa fa-caret-up fa-2x <?php echo $c;?> arrow-up-<?php echo $post->ID;?>" data-red-current = <?php echo $al;?> data-red-like = "<?php echo $redclassd; ?>" data-red-id = "<?php echo $post->ID;?>" role="button" aria-label="upvote" tabindex="0"></div>
<div class="score score-<?php echo $post->ID;?>" data-red-current = <?php echo $al;?>><?php echo $postvote; ?></div>
</ul>
</div>
<?php
$plugina = get_post_meta($post->ID,'pluginauthor', true);
if($plugina ==''){
$pname = get_the_author_meta('user_nicename');
$auth = 'yes';
}else{
$pname = $plugina;
$auth = 'no';
}
$profileUrl = '#'; if (isset($post->ID)) $profileUrl = get_author_posts_url($post->post_author);
$url = home_url();
if(wp_is_mobile()){
$mob = '-mob';
}
$out = get_post_meta($post->ID, 'outbound', true);
$n = parse_url($out);
?>
<?php if ( has_post_thumbnail() ) { //#WHFIX 24/03/2015: added data-attr to end ?>
<div class = 'reddit-post<?php echo $mob; ?> pull-left' id='reddit-post-<?php echo $post->ID;?>' data-ph-url="<?php echo get_permalink( $post->ID ); ?>" data-slug='<?php echo $post->post_name; ?>' data-id='<?php echo $post->ID; ?>' data-url = '<?php echo $url; ?>' data-auth = '<?php echo $auth; ?>' data-rajax = '<?php echo $post->ID; ?>' data-rups = '<?php echo $postvote;?>' data-pname='<?php echo $pname;?>' data-profurl="<?php echo $profileUrl; ?>" data-red-current = <?php echo $al;?> data-red-like = "<?php echo $redclassd; ?>">
<?php the_post_thumbnail('small'); ?>
<?php }else{ //#WHFIX 24/03/2015: added data-attr to end ?>
<div class = 'reddit-post<?php echo $mob; ?> pull-left' id='reddit-post-<?php echo $post->ID;?>' data-ph-url="<?php echo get_permalink( $post->ID ); ?>" data-slug='<?php echo $post->post_name; ?>' data-id='<?php echo $post->ID; ?>' data-url = '<?php echo $url; ?>' data-auth = '<?php echo $auth; ?>' data-rajax = '<?php echo $post->ID; ?>' data-rups = '<?php echo $postvote;?>' data-pname='<?php echo $pname;?>' data-profurl="<?php echo $profileUrl; ?>" data-red-current = <?php echo $al;?> data-red-like = "<?php echo $redclassd; ?>">
<?php } ?>
<div class='post-meta-hunt'>
<!-- external URL button -->
<div class='ph-external ph-action'>
<span class="post-item--action v-icon"><a href="<?php echo esc_url($out); ?>" target="_blank" data-reactid=".3.0.0:$1.0.2.0.$31121.0.0.3.0.0"><span data-reactid=".3.0.0:$1.0.2.0.$31121.0.0.3.0.0.0"><svg width="16" height="14" viewBox="0 0 16 14" xmlns="http://www.w3.org/2000/svg"><g fill="#BBB" fill-rule="evenodd"><path d="M0 3h16v2H0z"></path><rect width="16" height="2" rx="2"></rect><rect y="12" width="16" height="2" rx="2"></rect><rect width="2" height="14" rx="2"></rect><rect x="14" width="2" height="14" rx="2"></rect><path d="M9.355 6.355C9.16 6.16 9.215 6 9.49 6h3.26c.138 0 .25.115.25.25v3.26c0 .27-.152.338-.355.135l-3.29-3.29z"></path></g></svg></span></a></span>
</div>
<?php if(!ph_in_user_collection($post->ID)) { ?>
<div class='ph-collect ph-action' data-pid ='<?php echo $post->ID;?>'>
<span class="collect-button--icon" data-pid ='<?php echo $post->ID;?>'>
<svg width="15" height="14" viewBox="0 0 15 14" xmlns="http://www.w3.org/2000/svg">
<path d="M13 10V8.99c0-.54-.448-.99-1-.99-.556 0-1 .444-1 .99V10H9.99c-.54 0-.99.448-.99 1 0 .556.444 1 .99 1H11v1.01c0 .54.448.99 1 .99.556 0 1-.444 1-.99V12h1.01c.54 0 .99-.448.99-1 0-.556-.444-1-.99-1H13zM0 1c0-.552.447-1 .998-1h11.004c.55 0 .998.444.998 1 0 .552-.447 1-.998 1H.998C.448 2 0 1.556 0 1zm0 5c0-.552.447-1 .998-1h11.004c.55 0 .998.444.998 1 0 .552-.447 1-.998 1H.998C.448 7 0 6.556 0 6zm0 5c0-.552.453-1 .997-1h6.006c.55 0 .997.444.997 1 0 .552-.453 1-.997 1H.997C.447 12 0 11.556 0 11z" fill="#C8C0B1" fill-rule="evenodd"></path>
</svg>
<?php }else{ ?>
<div class='ph-collect in ph-action' data-pid ='<?php echo $post->ID;?>'>
<span class="collect-button--icon in" data-pid ='<?php echo $post->ID;?>'>
<svg width="17" height="14" viewBox="0 0 17 14" xmlns="http://www.w3.org/2000/svg">
<path d="M11.036 10.864L9.62 9.45c-.392-.394-1.022-.39-1.413 0-.393.393-.39 1.023 0 1.414l2.122 2.12c.193.198.45.295.703.295.256 0 .51-.1.706-.295l4.246-4.246c.385-.385.39-1.02-.002-1.413-.393-.393-1.022-.39-1.412-.002l-3.537 3.538zM0 1c0-.552.447-1 1-1h11c.553 0 1 .444 1 1 0 .552-.447 1-1 1H1c-.553 0-1-.444-1-1zm0 5c0-.552.447-1 1-1h11c.553 0 1 .444 1 1 0 .552-.447 1-1 1H1c-.553 0-1-.444-1-1zm0 5c0-.552.447-1 1-1h4.5c.552 0 1 .444 1 1 0 .552-.447 1-1 1H1c-.552 0-1-.444-1-1z" fill="#DC5425" fill-rule="evenodd"></path>
</svg>
<?php } ?>
</span>
</div>
<div class='author-ava'>
<?php
if($plugina == ''){ ?>
<span class='author-tool' data-toggle="tooltip" data-placement="left" title="<?php echo get_the_author_meta('user_nicename'); ?>"> <?php echo get_avatar( get_the_author_meta( 'ID' ), 40 ); ?></span>
<?php }else{
$pluginava = get_post_meta($post->ID,'pluginavatar',true);
?>
<span class='author-tool' data-toggle="tooltip" data-placement="left" title="<?php echo $plugina; ?>"><img class='img-rounded' src="<?php echo $pluginava;?>" height = "40px" width="40px"/></span>
<?php } ?>
</div>
<div class='comment-icon'>
<span><svg width="19" height="17" viewBox="0 0 19 17" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient x1="50%" y1="0%" x2="50%" y2="100%" id="b"><stop stop-color="#CCC" offset="0%"></stop><stop stop-color="#BABABA" offset="100%"></stop></linearGradient><filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="a"><feOffset dy="1" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset><feGaussianBlur stdDeviation=".5" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur><feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.070000001 0" in="shadowBlurOuter1" result="shadowMatrixOuter1"></feColorMatrix><feMerge><feMergeNode in="shadowMatrixOuter1"></feMergeNode><feMergeNode in="SourceGraphic"></feMergeNode></feMerge></filter></defs><path d="M1.753 18.06C.66 16.996 0 15.623 0 14.125 0 10.742 3.358 8 7.5 8c4.142 0 7.5 2.742 7.5 6.125s-3.358 6.125-7.5 6.125c-1.03 0-2.01-.17-2.904-.476-1.46.845-4.318 1.962-4.318 1.962s.955-2.298 1.475-3.676z" transform="translate(2 -7)" filter="url(#a)" stroke="url(#b)" fill="#FFF" fill-rule="evenodd"></path></svg></span>
<span class='hunt-comm-count'><?php $comments = get_comments('post_id=' . $post->ID); echo count($comments); ?></span>
</div>
</div>
<?php if($post->post_type == 'post'){
if($out ==''){?>
<a class='title title-<?php echo $post->ID;?>' href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
<?php }else if(wp_is_mobile()){?>
<a class='title title-<?php echo $post->ID;?>' href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
<?php }else{ ?>
<a class='title title-<?php echo $post->ID;?>' href="<?php echo esc_url($out); ?>" title="<?php the_title_attribute(); ?>" target="_blank" rel="nofollow"><?php the_title(); ?></a>
<?php }
}else{ ?>
<a class='title title-<?php echo $post->ID;?>'href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" target="_blank"><?php the_title(); ?></a>
<?php } ?>
<span class='description'>
<?php
// $content = $post->post_content;
//echo wp_trim_words($content,30,'...');
the_excerpt();
?>
</span>
</div>
<div style="clear:both"></div>
</div>
>>>>>>> remotes/origin/Diego
<?php endforeach; ?>
</div>
<div class='ph-tabbed' id ='ah-submitted-tab'>
<?php global $post, $blob; ?>
<?php foreach ($submitted as $ID): ?>
<?php
$post = get_post($ID->ID);
?>
<div class = 'row hunt-row <?php echo $blob;?>' style = 'margin-bottom:20px'>
<?php pluginhunt_outputVoting($post); ?>
<?php pluginhunt_FeaturedImage($post); ?>
<div class='post-meta-hunt'>
<?php pluginhunt_ExternalLink($post); ?>
<?php pluginhunt_CollectionOutput($post->ID); ?>
<?php pluginhunt_AuthorMeta($post); ?>
<?php pluginhunt_commentList($post); ?>
</div>
<?php pluginhunt_PostContent($post); ?>
</div>
<div style="clear:both"></div>
</div>
<?php endforeach; ?>
</div>
<div class='ph-tabbed' id='ah-collections-tab'>
<?php
foreach($collected as $c){
$post = get_post($c->ID);
get_template_part( 'content', 'collections' );
}
?>
</div>
<?php if(of_get_option('ph_enable_discussions') == 1){ ?>
<div class='ph-tabbed' id='ah-discussions-tab'>
<?php
foreach($discussed as $d){
$post = get_post($d->ID);
get_template_part( 'content', 'discussions' );
}
?>
</div>
<?php } ?>
<div class='ph-tabbed' id ='ah-followers-tab'>
<?php
$fw = 0;
foreach($followers as $f){
if($fw==0){
echo "<div class='row author-row'>";
}
echo "<div class='col-md-4 author-list'>";
echo "<span class='person'>";
echo '<a href="';
echo get_author_posts_url( $f->follower );
echo '">';
echo get_avatar( $f->follower, 40 );
echo "<div class='title'>";
echo get_author_name( $f->follower );
echo "</div></a></span>";
$fw++;
echo "</div>";
if($fw == 3){
$fw=0;
echo "</div>";
}
}
?>
</div>
</div>
<div class='ph-tabbed' id ='ah-following-tab'>
<?php
$fr = 0;
foreach($followed as $g){
if($fr==0){
echo "<div class='row author-row'>";
}
echo "<div class='col-md-4 author-list'>";
echo "<span class='person'>";
echo '<a href="';
echo get_author_posts_url( $g->followed );
echo '">';
echo get_avatar( $g->followed, 40 );
echo "<div class='title'>";
echo get_author_name( $g->followed );
echo "</div></span>";
$fr++;
echo "</div>";
if($fr == 3){
$fr=0;
echo "</div>";
}
}
echo "</div>";
?>
</div>
</div>
<?php wp_reset_query(); ?>
<?php get_footer(); ?>