PluginProbe ʕ •ᴥ•ʔ
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress / 3.1
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress v3.1
4.16.19 4.16.18 4.16.17 4.16.16 trunk 1.0 1.0.1 1.0.2 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5a 1.1.6 1.1.7 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.4 1.4.1 1.4.2 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.7 1.7.1 1.7.2 1.8 1.8.1 1.8.10 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.1.9 2.2.10 2.2.11 2.2.12 2.2.13 2.2.14 2.2.15 2.2.16 2.2.2 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 3.0 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 4.0.0 4.0.1 4.0.2 4.0.3 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.10.0 4.10.1 4.10.2 4.10.3 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.13.3 4.13.4 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.15.0 4.15.1 4.15.10 4.15.11 4.15.12 4.15.13 4.15.14 4.15.15 4.15.16 4.15.17 4.15.18 4.15.19 4.15.2 4.15.20 4.15.20.1 4.15.21 4.15.22 4.15.23 4.15.24 4.15.25 4.15.3 4.15.4 4.15.5 4.15.6 4.15.7 4.15.8 4.15.9 4.16.0 4.16.1 4.16.10 4.16.11 4.16.12 4.16.13 4.16.14 4.16.15 4.16.2 4.16.3 4.16.4 4.16.5 4.16.6 4.16.7 4.16.8 4.16.9 4.2.0 4.3.0 4.3.1 4.3.2 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.5.3 4.5.4 4.5.5 4.6.0 4.7.0 4.8.0 4.9.0
wp-user-avatar / src / Themes / DragDrop / MemberDirectory / DefaultTemplate.php
wp-user-avatar / src / Themes / DragDrop / MemberDirectory Last commit date
DefaultTemplate.php 5 years ago Gerbera.php 5 years ago
DefaultTemplate.php
402 lines
1 <?php
2
3 namespace ProfilePress\Core\Themes\DragDrop\MemberDirectory;
4
5 use ProfilePress\Core\Admin\SettingsPages\DragDropBuilder\DragDropBuilder;
6 use ProfilePress\Core\Classes\ExtensionManager as EM;
7 use ProfilePress\Core\ShortcodeParser\Builder\FrontendProfileBuilder;
8 use ProfilePress\Core\Themes\DragDrop\AbstractMemberDirectoryTheme;
9 use ProfilePress\Core\Admin\SettingsPages\DragDropBuilder\Fields;
10
11 class DefaultTemplate extends AbstractMemberDirectoryTheme
12 {
13 public static function default_field_listing()
14 {
15 Fields\Init::init();
16 $standard_fields = DragDropBuilder::get_instance()->standard_fields();
17
18 return [
19 $standard_fields['profile-display-name'],
20 $standard_fields['profile-bio'],
21 ];
22 }
23
24 public function default_metabox_settings()
25 {
26 $data = parent::default_metabox_settings();
27 $data['ppress_md_default_profile_picture'] = 'true';
28 $data['ppress_md_default_cover_image'] = 'true';
29 $data['ppress_md_default_social_icons'] = 'true';
30 $data['ppress_md_default_text_color'] = '#999999';
31 $data['ppress_md_default_display_name_color'] = '#444444';
32 $data['ppress_md_default_avatar_border_color'] = '#ffffff';
33 $data['ppress_md_default_background_color'] = '#ffffff';
34 $data['ppress_md_default_border_color'] = '#dddddd';
35
36 return $data;
37 }
38
39 public function appearance_settings($settings)
40 {
41 $settings = parent::appearance_settings($settings);
42
43 $settings[] = [
44 'id' => 'ppress_md_default_profile_picture',
45 'type' => 'checkbox',
46 'label' => esc_html__('Enable Profile Picture', 'wp-user-avatar'),
47 'priority' => 15
48 ];
49
50 $settings[] = [
51 'id' => 'ppress_md_default_cover_image',
52 'type' => 'checkbox',
53 'label' => esc_html__('Enable Cover Image', 'wp-user-avatar'),
54 'priority' => 20
55 ];
56
57
58 if (EM::is_enabled(EM::CUSTOM_FIELDS)) {
59 $settings[] = [
60 'id' => 'ppress_md_default_social_icons',
61 'type' => 'checkbox',
62 'label' => esc_html__('Enable Social Connect Icons', 'wp-user-avatar'),
63 'priority' => 30
64 ];
65 } else {
66 $upgrade_url = 'https://profilepress.net/pricing/?utm_source=wp_dashboard&utm_medium=upgrade&utm_campaign=md_social_connect_icons';
67 $settings[] = [
68 'id' => 'ppress_md_default_social_icons_upsell',
69 'label' => '',
70 'type' => 'custom',
71 'content' => sprintf(
72 esc_html__('%sUpgrade to ProfilePress premium%s if you don\'t have the custom field addon to display social profile icons of users.', 'wp-user-avatar'),
73 '<a href="' . $upgrade_url . '" target="_blank">', '</a>'
74 ),
75 ];
76 }
77
78 return $settings;
79 }
80
81 public function metabox_settings($settings, $form_type, $DragDropBuilderInstance)
82 {
83 $appearance_settings = $settings['appearance'];
84
85 unset($settings['appearance']);
86
87 $new_settings['appearance'] = $appearance_settings;
88
89 $new_settings = array_merge($new_settings, parent::metabox_settings($settings, $form_type, $DragDropBuilderInstance));
90
91 return array_merge($new_settings, $settings);
92 }
93
94 public function color_settings($settings)
95 {
96 $settings2 = array_merge(parent::color_settings($settings), [
97 [
98 'id' => 'ppress_md_default_background_color',
99 'type' => 'color',
100 'label' => esc_html__('Card Background', 'wp-user-avatar')
101 ],
102 [
103 'id' => 'ppress_md_default_border_color',
104 'type' => 'color',
105 'label' => esc_html__('Card Border', 'wp-user-avatar')
106 ],
107 [
108 'id' => 'ppress_md_default_text_color',
109 'type' => 'color',
110 'label' => esc_html__('Card Text', 'wp-user-avatar')
111 ],
112 [
113 'id' => 'ppress_md_default_display_name_color',
114 'type' => 'color',
115 'label' => esc_html__('Display Name', 'wp-user-avatar')
116 ],
117 [
118 'id' => 'ppress_md_default_avatar_border_color',
119 'type' => 'color',
120 'label' => esc_html__('Profile Picture Border', 'wp-user-avatar')
121 ]
122 ]);
123
124 return array_merge($settings, $settings2);
125 }
126
127 public function form_wrapper_class()
128 {
129 return 'ppress-md-default';
130 }
131
132 /**
133 * @return false|string|void
134 */
135 public function directory_structure()
136 {
137 $wp_user_query = $this->wp_user_query();
138
139 $profile_picture_enabled = $this->get_meta('ppress_md_default_profile_picture') == 'true';
140
141 $cover_image_enabled = $this->get_meta('ppress_md_default_cover_image') == 'true';
142
143 $social_icons_enabled = $this->get_meta('ppress_md_default_social_icons') == 'true';
144
145 ?>
146 <div class="ppmd-members-wrap<?= ! $profile_picture_enabled ? ' ppmd-no-photo' : ''; ?><?= ! $cover_image_enabled ? ' ppmd-no-cover' : ''; ?>">
147
148 <div class="ppmd-member-gutter"></div>
149
150 <?php
151 /** @var \WP_User $user */
152 foreach ($wp_user_query['users'] as $user) : new FrontendProfileBuilder($user);
153
154 $profile_url = ppress_get_frontend_profile_url($user->ID);
155
156 $cover_image = ppress_get_cover_image_url($user->ID);
157 // important we parse immediately because FrontendProfileBuilder resets for every user.
158 $display_name = do_shortcode('[profile-display-name]', true);
159
160 $social_profile_icons = $this->social_profile_icons();
161 ?>
162
163 <div class="ppmd-member-wrap">
164 <?php if ($cover_image_enabled) : ?>
165 <div class="ppmd-member-cover">
166 <div class="ppress-md-member-cover-e">
167 <a href="<?= $profile_url ?>" title="<?= $display_name ?>">
168 <?php if ( ! empty($cover_image)) : ?>
169 <?= sprintf('<img src="%s" alt="%s">', $cover_image, esc_attr($display_name)); ?>
170 <?php endif; ?>
171 </a>
172 </div>
173 </div>
174 <?php endif; ?>
175
176 <?php if ($profile_picture_enabled) : ?>
177 <div class="ppmd-member-photo">
178 <a href="<?= $profile_url ?>" title="<?= $display_name ?>">
179 [pp-user-avatar user="<?= $user->ID ?>" size=40]
180 </a>
181 </div>
182 <?php endif; ?>
183
184 <div class="ppmd-member-card">
185 <?php echo $this->directory_listing($user->ID)->forge()->output(); ?>
186
187 <?php if ($social_icons_enabled && $social_profile_icons !== false) : ?>
188 <div class="ppress-md-member-meta-main">
189 <div class="ppress-md-member-meta">
190 <div class="ppress-md-member-connect">
191 <?php $this->social_profile_icons() ?>
192 </div>
193 </div>
194 </div>
195 <?php endif; ?>
196 </div>
197 </div>
198 <?php endforeach; ?>
199 </div>
200 <?php
201 }
202
203 public function form_css()
204 {
205 $form_id = $this->form_id;
206 $form_type = $this->form_type;
207
208 $card_text_color = $this->get_meta('ppress_md_default_text_color');
209 $card_display_name_color = $this->get_meta('ppress_md_default_display_name_color');
210 $card_avatar_border_color = $this->get_meta('ppress_md_default_avatar_border_color');
211 $card_bg_color = $this->get_meta('ppress_md_default_background_color');
212 $card_border_color = $this->get_meta('ppress_md_default_border_color');
213 $card_social_profile_border_color = $card_border_color == '#dddddd' ? '#e5e5e5' : $card_border_color;
214
215 return parent::form_css() . <<<CSS
216 #pp-$form_type-$form_id.ppress-md-default * {
217 -webkit-box-sizing: border-box;
218 -moz-box-sizing: border-box;
219 box-sizing: border-box;
220 -webkit-font-smoothing: antialiased !important;
221 -moz-osx-font-smoothing: grayscale !important;
222 }
223
224 #pp-$form_type-$form_id.ppress-md-default a {
225 text-decoration: none !important;
226 border-bottom: none !important;
227 box-shadow: none !important;
228 border-bottom: 0 !important;
229 }
230
231 #pp-$form_type-$form_id.ppress-md-default .ppmd-members-wrap {
232 width: 100%;
233 margin: 0 0 10px 0;
234 padding: 0;
235 }
236
237 /* (32% x 3) + (2%) = ~100 */
238 #pp-$form_type-$form_id.ppress-md-default .ppmd-member-gutter {
239 width: 2%;
240 }
241
242 #pp-$form_type-$form_id.ppress-md-default .ppmd-member-wrap {
243 background: $card_bg_color;
244 text-align: center;
245 margin-bottom: 40px;
246 border: 1px solid $card_border_color;
247 width: 32%;
248 }
249
250 #pp-$form_type-$form_id.ppress-md-default.pp-member-directory.ppressui960 .ppmd-member-wrap,
251 #pp-$form_type-$form_id.ppress-md-default.pp-member-directory.ppressui800 .ppmd-member-wrap
252 {
253 width: 48%;
254 }
255
256 #pp-$form_type-$form_id.ppress-md-default.pp-member-directory.ppressui960 .ppmd-member-gutter,
257 #pp-$form_type-$form_id.ppress-md-default.pp-member-directory.ppressui800 .ppmd-member-gutter {
258 width: 4%;
259 }
260
261 #pp-$form_type-$form_id.ppress-md-default.pp-member-directory.ppressui500 .ppmd-member-gutter,
262 #pp-$form_type-$form_id.ppress-md-default.pp-member-directory.ppressui340 .ppmd-member-gutter {
263 width: 0;
264 }
265
266 #pp-$form_type-$form_id.ppress-md-default.pp-member-directory.ppressui500 .ppmd-member-wrap,
267 #pp-$form_type-$form_id.ppress-md-default.pp-member-directory.ppressui340 .ppmd-member-wrap {
268 width: 100%;
269 }
270
271 #pp-$form_type-$form_id.ppress-md-default.pp-member-directory.ppressui960 .ppmd-member-wrap {
272 width: 48%;
273 }
274
275 #pp-$form_type-$form_id.ppress-md-default.pp-member-directory.ppressui960 .ppmd-member-gutter {
276 width: 4%;
277 }
278
279 #pp-$form_type-$form_id.ppress-md-default .ppmd-member-cover {
280 height: 170px;
281 background-color: #eee;
282 box-sizing: border-box;
283 position: relative;
284 }
285
286 #pp-$form_type-$form_id.ppress-md-default .ppress-md-profile-item-wrap {
287 margin: 0 0 5px;
288 font-size: 14px;
289 padding: 10px 15px 0;
290 line-height: 16px;
291 }
292
293 #pp-$form_type-$form_id.ppress-md-default .ppress-md-profile-item-wrap:nth-child(2) {
294 padding-top: 0;
295 padding-bottom: 0;
296 }
297
298 #pp-$form_type-$form_id.ppress-md-default .ppress-md-profile-item-wrap.profile-display-name a {
299 line-height: 26px;
300 color: $card_display_name_color;
301 font-weight: 700;
302 font-size: 16px;
303 }
304
305 #pp-$form_type-$form_id.ppress-md-default .ppress-md-profile-item-title {
306 font-weight: bold;
307 display: block;
308 }
309
310 #pp-$form_type-$form_id.ppress-md-default .ppress-md-member-cover-e {
311 text-align: center;
312 box-sizing: border-box;
313 }
314
315 #pp-$form_type-$form_id.ppress-md-default .ppmd-member-photo {
316 padding: 0 0 20px 0;
317 text-align: center;
318 }
319
320 #pp-$form_type-$form_id.ppress-md-default .ppmd-no-cover .ppmd-member-photo {
321 padding-top: 30px;
322 }
323
324 #pp-$form_type-$form_id.ppress-md-default .ppmd-member-photo a {
325 text-decoration: none;
326 box-shadow: none !important;
327 display: inline !important;
328 }
329
330 #pp-$form_type-$form_id.ppress-md-default .ppmd-member-photo a img {
331 display: inline;
332 border: 5px solid $card_avatar_border_color;
333 background: $card_avatar_border_color;
334 border-radius: 100%;
335 width: 90px;
336 height: 90px;
337 position: relative;
338 top: -35px;
339 margin-bottom: -45px;
340 float: none;
341 }
342
343 #pp-$form_type-$form_id.ppress-md-default .ppmd-no-cover .ppmd-member-photo a img {
344 top: auto;
345 margin-bottom: 0;
346 width: 140px;
347 height: 140px;
348 }
349
350 #pp-$form_type-$form_id.ppress-md-default .ppmd-member-card {
351 padding: 0;
352 padding-bottom: 15px;
353 color: $card_text_color;
354 }
355
356 #pp-$form_type-$form_id.ppress-md-default .ppmd-no-photo .ppmd-member-card {
357 padding-top: 15px;
358 }
359
360 #pp-$form_type-$form_id.ppress-md-default .ppmd-no-cover .ppmd-member-card {
361 padding-bottom: 30px;
362 }
363
364 #pp-$form_type-$form_id.ppress-md-default .ppress-md-member-cover-e img {
365 width: 100%;
366 height: 170px;
367 box-shadow: none;
368 overflow: hidden;
369 -moz-border-radius: 0;
370 -webkit-border-radius: 0;
371 border-radius: 0;
372 margin: 0;
373 padding: 0;
374 }
375
376 #pp-$form_type-$form_id.ppress-md-default .ppmd-member-name {
377 margin: 0 0 4px 0;
378 justify-content: center;
379 }
380
381 #pp-$form_type-$form_id.ppress-md-default .ppress-md-member-meta {
382 margin: 20px 15px 0 15px;
383 padding: 15px 0 0;
384 border-top: 1px solid $card_social_profile_border_color;
385 }
386
387 #pp-$form_type-$form_id.ppress-md-default .ppress-md-member-connect a {
388 display: inline-block;
389 width: 40px;
390 line-height: 40px;
391 height: 40px;
392 opacity: 0.85;
393 margin: 0 1px;
394 transition: 0.25s;
395 }
396
397 #pp-$form_type-$form_id.ppress-md-default .ppress-pf-profile-connect {
398 padding-bottom: 0;
399 }
400 CSS;
401 }
402 }