-
Notifications
You must be signed in to change notification settings - Fork 0
/
archive-discussions-desktop.php
214 lines (163 loc) · 6.85 KB
/
archive-discussions-desktop.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
<?php
/**
* The main template file.
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* For example, it puts together the home page when no home.php file exists.
*
* Learn more: http://codex.wordpress.org/Template_Hierarchy
* Lets enhance this and move the epic_reddit_index($agrs) function into this file.
*/
get_header();
?>
<div class='ph-layout-2'>
<div class='post-wrapper container'>
<div class='col-md-2 discuss-sidebar'>
<?php dynamic_sidebar('ph-discussions-sidebar'); ?>
</div>
<div class='col-md-10'>
<a id="ph-log-social-new" href="#animatedModal" style="display:none">.</a>
<div class='options discuss-switch'><span class='active popular d-s'><?php _e('popular','pluginhunt'); ?></span><span class='newest d-s hide'><?php _e('newest','pluginhunt'); ?></span></div>
<div class='maincontent'>
<?php
global $wp_query,$post,$wpdb, $current_user,$query_string;
wp_get_current_user();
$wpdb->myo_ip = $wpdb->prefix . 'epicred';
#} check that our paged variable is being passed
?>
<?php if(is_user_logged_in()){ ?>
<div class='simple-submit-prompt'>
<p>Join the discussion by submitting a topic <span class='submit-topic-prompt'>New Topic</span></p>
</div>
<div class='simple-loading'>
<i class="fa fa-circle-o-notch fa-spin fa-3x fa-fw"></i>
</div>
<div class='simple-submit'>
<div class='submit-close'>x</div>
<h3><?php _e("Submit a discussion topic","pluginhunt"); ?></h3>
<input type="text" value="" placeholder="<?php _e('Title','pluginhunt');?>" id="discuss-title" name="discuss-title"/>
<textarea id="discuss-content" name="discuss-content" placeholder="<?php _e('Content','pluginhunt');?>"></textarea>
<input type="hidden" id="nonce" value="<?php echo wp_create_nonce('eh_security_key_1517'); ?>"/>
<?php wp_dropdown_categories( 'show_count=0&hierarchical=1&taxonomy=discussion_category&hide_empty=0&id=discussioncatslim&name=discussioncat' ); ?>
<br/>
<div class='submit-discuss'><?php _e("Submit","pluginhunt"); ?></div>
</div>
<?php } ?>
<table class='table'>
<thead class='discuss-header'>
<th>Vote</th>
<th>Topic</th>
<th>Category</th>
<th>Votes</th>
<th class='meta'>Replies</th>
<th class='meta'>Views</th>
</thead>
<tbody class='discuss-body'>
<?php
// Start the loop.
while ( have_posts() ) : the_post();
setup_postdata($post);
$day = get_the_date('j');
$date = get_the_date('l');
?>
<?php
$postvote = get_post_meta($post->ID, 'epicredvote' ,true);
wpeddit_post_ranking($post->ID);
if($postvote == NULL){
$postvote = 0;
}
$fid = $current_user->ID;
$query = "SELECT epicred_option FROM $wpdb->myo_ip WHERE epicred_ip = $fid AND epicred_id = $post->ID";
$al = $wpdb->get_var($query);
$c = "none";
if($al == NULL){
$al = 0;
$redclassu = 'up';
$redscore = "unvoted";
$c = "none";
}else if($al==1){
$redclassu = 'upmod';
$redclassd = 'down';
$redscore = 'likes';
$voted = 'yesvote';
$c = 'blue';
}else{
$redclassu = 'upmod';
$redclassd = 'down';
$redscore = 'likes';
}
?>
<tr>
<td class='first-col-discuss'><?php echo ph_output_voting($post->ID); ?></td> <!-- voting -->
<td>
<div class = 'row hunt-row'>
<?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();
$out = get_post_meta($post->ID, 'outbound', true);
$n = parse_url($out);
?>
<div class = 'reddit-post 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; ?>">
<div class='ph-content-detail'>
<div class='author-ava hide'>
<?php
if($plugina == ''){ ?>
<span class='author-tool' data-toggle="tooltip" data-placement="left" title="<?php echo get_the_author_meta('user_nicename'); ?>"> <?php
$args = array( 'class' => 'img-rounded');
echo get_avatar($post->post_author, 40, $args); ?></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>
<?php
//trim the title to 37 characters...
$title = get_the_title($post->ID);
if(strlen($title)>37){
// $title = substr( $title, 0, 37) . "...";
} ?>
<?php // if ( wp_is_mobile() ) { echo "<a href='". get_permalink( $post->ID ) ."'>"; } ?>
<div class='post-info'>
<span class='title'><?php echo $title; ?></span>
<?php // if ( wp_is_mobile() ) { echo '</a>'; } ?>
</div> <!-- post info -->
</div> <!-- ph content detail -->
</div> <!-- reddit-post -->
</div> <!-- hunt-row -->
</td>
<td class='meta'><?php $terms = wp_get_post_terms($post->ID, 'discussion_category');
foreach($terms as $term){
echo "<div class='dt'><div class='dtl' style='background:" . phtoColor($term->term_id) . ";'></div><div class='dtn'>" . $term->name . "</div></div>";
}
?></td> <!-- category -->
<td><?php echo ph_upvotes($post->ID); ?></td> <!-- users -->
<td class='meta'><?php $comments = get_comments('post_id=' . $post->ID); echo count($comments); ?></td> <!-- replies -->
<td class='meta'><?php echo phgetPostViews($post->ID); ?></td> <!-- views -->
</tr>
<?php endwhile; ?>
</div>
</div>
</tbody>
</table>
</div> <!-- end of col-md-8 -->
<?php
if (function_exists("ph_wp_bs_pagination"))
{
//wp_bs_pagination($the_query->max_num_pages);
ph_wp_bs_pagination();
}
?>
<?php wp_reset_query(); ?>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
<?php get_footer(); ?>