/
author.php
257 lines (237 loc) · 13.2 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
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
<?php
/**
* The Template for displaying a user profile
*
* @package WordPress
* @subpackage FreelanceEngine
* @since FreelanceEngine 1.0
*/
global $wp_query, $ae_post_factory, $post, $user_ID;
$post_object = $ae_post_factory->get(PROFILE);
$author_id = get_query_var( 'author' );
$author_name = get_the_author_meta('display_name', $author_id);
$author_available = get_user_meta($author_id, 'user_available', true);
// get user profile id
$profile_id = get_user_meta($author_id, 'user_profile_id', true);
// get post profile
$profile = get_post($profile_id);
$convert = '';
if( $profile && !is_wp_error($profile) ){
$convert = $post_object->convert( $profile );
}
// try to check and add profile up current user dont have profile
if(!$convert && ( fre_share_role() || ae_user_role($author_id) == FREELANCER) ) {
$profile_post = get_posts(array('post_type' => PROFILE,'author' => $author_id));
if(!empty($profile_post)) {
$profile_post = $profile_post[0];
$convert = $post_object->convert( $profile_post );
$profile_id = $convert->ID;
update_user_meta($author_id, 'user_profile_id', $profile_id);
}else {
$convert = $post_object->insert( array( 'post_status' => 'publish' ,
'post_author' => $author_id ,
'post_title' => $author_name ,
'post_content' => '')
);
$convert = $post_object->convert( get_post($convert->ID) );
$profile_id = $convert->ID;
}
}
// count author review number
$count_review = fre_count_reviews($author_id);
// $count_project = fre_count_user_posts_by_type($user_ID, PROJECT, 'publish');
get_header();
$next_post = false;
if($convert) {
$next_post = ae_get_adjacent_post($convert->ID, false, '', true, 'skill');
}
?>
<section class="breadcrumb-wrapper">
<div class="breadcrumb-single-site">
<div class="container">
<div class="row">
<div class="col-md-6 col-xs-8">
<ol class="breadcrumb">
<li><a href="<?php echo home_url(); ?>"><?php _e("Home", ET_DOMAIN); ?></a></li>
<li class="active"><?php printf(__("Profile of %s", ET_DOMAIN), $author_name); ?></li>
</ol>
</div>
<?php /* if($next_post) { ?>
<div class="col-md-6 col-xs-4">
<a title="<?php the_author_meta('display_name', $next_post->post_author) ?>" href="<?php echo get_author_posts_url($next_post->post_author); ?>" class="prj-next-link"><?php _e('Next Profile', ET_DOMAIN);?> <i class="fa fa-angle-double-right"></i></a>
</div>
<?php }*/ ?>
</div>
</div>
</div>
</section>
<div class="single-profile-wrapper">
<div class="container">
<div class="row">
<div class="col-md-8">
<div class="tab-content-single-profile">
<!-- Title -->
<div class="row title-tab-profile">
<div class="col-md-12">
<h2><?php printf(__('ABOUT %s', ET_DOMAIN), strtoupper($author_name) ); ?></h2>
</div>
</div>
<!-- Title / End -->
<!-- Content project -->
<div class="single-profile-content">
<div class="single-profile-top">
<ul class="single-profile">
<li class="img-avatar"><span class="avatar-profile"><?php echo get_avatar($author_id, 70); ?></span></li>
<li class="info-profile">
<span class="name-profile"><?php echo $author_name; ?></span>
<?php if($convert) { ?>
<span class="position-profile"><?php echo $convert->et_professional_title; ?></span>
<?php } ?>
<span class="number-review-profile"><?php if($count_review < 2) printf(__('%d review', ET_DOMAIN), $count_review ); else printf(__('%d reviews', ET_DOMAIN), $count_review );?></span>
</li>
</ul>
<?php if($convert && (fre_share_role() || ae_user_role($author_id) == FREELANCER ) ){ ?>
<div class="list-skill-profile">
<ul>
<?php if(isset($convert->tax_input['skill']) && $convert->tax_input['skill']){
foreach ($convert->tax_input['skill'] as $tax){ ?>
<li><span class="skill-name-profile"><?php echo $tax->name; ?></span></li>
<?php }
} ?>
</ul>
</div>
<?php } ?>
<div class="clearfix"></div>
</div>
<div class="single-profile-bottom">
<?php if($convert) { ?>
<!-- overview -->
<div class="profile-overview">
<h4 class="title-single-profile"><?php _e('Overview', ET_DOMAIN);?></h4>
<p><?php echo $convert->post_content; ?></p>
<?php
if(function_exists('et_the_field')) {
et_render_custom_meta($convert);
et_render_custom_taxonomy($convert);
}
?>
</div>
<!--// overview -->
<?php }
if(fre_share_role() || ae_user_role($author_id) != FREELANCER ){
get_template_part('template/work', 'history');
}
if( fre_share_role() || ae_user_role($author_id) == FREELANCER ){
get_template_part('template/bid', 'history');
$bid_posts = $wp_query->found_posts;
?>
<div class="portfolio-container">
<?php
query_posts( array(
// 'post_parent' => $convert->ID,
'post_status' => 'publish',
'post_type' => PORTFOLIO,
'author' => $author_id )
);
if(have_posts()):
get_template_part('template/portfolios', 'filter' );
// list portfolio
get_template_part( 'list', 'portfolios' );
else :
endif;
//wp_reset_postdata();
wp_reset_query();
?>
</div>
<?php }
?>
</div>
</div>
<!-- Content project / End -->
<div class="clearfix"></div>
</div>
</div>
<div class="col-md-4">
<!-- Title -->
<div class="row title-tab-profile">
<div class="col-md-12">
<h2><?php _e('INFO', ET_DOMAIN);?></h2>
</div>
</div>
<?php if( ae_user_role($author_id) == FREELANCER ){
?>
<!-- Title / End -->
<!-- Content project -->
<div class="single-profile-content">
<?php if($author_available == 'on' || $author_available == '' ){ ?>
<div class="contact-link">
<a href="#" data-toggle="modal" class="invite-freelancer btn-sumary <?php if ( is_user_logged_in() ) { echo 'invite-open';}else{ echo 'login-btn';} ?>" data-user="<?php echo $convert->post_author ?>">
<?php _e("Invite me to join", ET_DOMAIN) ?>
</a>
<?php /*
<span><?php _e("Or", ET_DOMAIN); ?></span>
<a href="#" class="<?php if ( is_user_logged_in() ) {echo 'contact-me';} else{ echo 'login-btn';} ?> fre-contact" data-user="<?php echo $convert->post_author ?>" data-user="<?php echo $convert->post_author ?>">
<?php _e("Contact me", ET_DOMAIN) ?>
</a>
*/
?>
</div>
<?php } else {
echo '<h3 style="padding: 20px 25px;margin:0;">'.$author_name .'</h3>';
}
$rating = Fre_Review::freelancer_rating_score($author_id);
?>
<ul class="list-detail-info">
<li>
<i class="fa fa-dollar"></i>
<span class="text"><?php _e('Hourly Rate:',ET_DOMAIN);?></span>
<span class="text-right"><?php echo $convert->hourly_rate_price; ?></span>
</li>
<li>
<i class="fa fa-star"></i>
<span class="text"><?php _e('Rating:',ET_DOMAIN);?></span>
<div class="rate-it" data-score="<?php echo $rating['rating_score']; ?>"></div>
</li>
<li>
<i class="fa fa-pagelines"></i>
<span class="text"><?php _e('Experience:',ET_DOMAIN);?></span>
<span class="text-right"><?php echo $convert->experience; ?></span>
</li>
<li>
<i class="fa fa-briefcase"></i>
<span class="text"><?php _e('Projects worked:',ET_DOMAIN);?></span>
<span class="text-right"><?php echo $bid_posts; ?></span>
</li>
<li>
<i class="fa fa-money"></i>
<span class="text"><?php _e('Total earned:',ET_DOMAIN);?></span>
<span class="text-right"><?php echo fre_price_format(fre_count_total_user_earned($author_id)); ?></span>
</li>
<li>
<i class="fa fa-map-marker"></i>
<span class="text"><?php _e('Country:',ET_DOMAIN);?></span>
<span class="text-right">
<?php
if($convert->tax_input['country']){
echo $convert->tax_input['country']['0']->name;
} ?>
</span>
</li>
</ul>
</div>
<?php }else{ ?>
<div class="info-company-wrapper">
<div class="row">
<div class="col-md-12">
<?php fre_display_user_info( $author_id ); ?>
</div>
</div>
</div>
<?php } ?>
<!-- Content project / End -->
</div>
</div>
</div>
</div>
<?php
get_footer();