profile_customize.php
10.4 KB
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
<?php if ( ! defined( 'ABSPATH' ) ) {
exit;
}
global $post_id;
$use_custom_settings = ! isset( $post_id ) ? false : get_post_meta( $post_id, '_um_profile_use_custom_settings', true );
$profile_role_array = array();
foreach ( UM()->roles()->get_roles() as $key => $value ) {
$_um_profile_role = UM()->query()->get_meta_value( '_um_profile_role', $key );
if ( ! empty( $_um_profile_role ) ) {
$profile_role_array[] = $_um_profile_role;
}
}
$profile_secondary_btn = ! isset( $post_id ) ? UM()->options()->get( 'profile_secondary_btn' ) : get_post_meta( $post_id, '_um_profile_secondary_btn', true );
$profile_cover_enabled = ! isset( $post_id ) ? true : get_post_meta( $post_id, '_um_profile_cover_enabled', true );
$profile_disable_photo_upload = ! isset( $post_id ) ? UM()->options()->get( 'disable_profile_photo_upload' ) : get_post_meta( $post_id, '_um_profile_disable_photo_upload', true );
$profile_photo_required = ! isset( $post_id ) ? false : get_post_meta( $post_id, '_um_profile_photo_required', true );
$profile_show_name = ! isset( $post_id ) ? true : get_post_meta( $post_id, '_um_profile_show_name', true );
$profile_show_social_links = ! isset( $post_id ) ? UM()->options()->get( 'profile_show_social_links' ) : get_post_meta( $post_id, '_um_profile_show_social_links', true );
$profile_show_bio = ! isset( $post_id ) ? true : get_post_meta( $post_id, '_um_profile_show_bio', true );
?>
<div class="um-admin-metabox">
<?php
UM()->admin_forms(
array(
'class' => 'um-form-profile-customize um-top-label',
'prefix_id' => 'form',
'fields' => array(
array(
'id' => '_um_profile_use_custom_settings',
'type' => 'select',
'label' => __( 'Apply custom settings to this form', 'ultimate-member' ),
'tooltip' => __( 'Switch to yes if you want to customize this form settings, styling & appearance', 'ultimate-member' ),
'value' => $use_custom_settings,
'options' => array(
0 => __( 'No', 'ultimate-member' ),
1 => __( 'Yes', 'ultimate-member' ),
),
),
array(
'id' => '_um_profile_role',
'type' => 'select',
'multi' => true,
'label' => __( 'Make this profile form role-specific', 'ultimate-member' ),
'tooltip' => __( 'Please note if you make a profile form specific to a role then you must make sure that every other role is assigned a profile form', 'ultimate-member' ),
'value' => $profile_role_array,
'options' => UM()->roles()->get_roles(),
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
),
array(
'id' => '_um_profile_template',
'type' => 'select',
'label' => __( 'Template', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_template', null, UM()->options()->get( 'profile_template' ) ),
'options' => UM()->shortcodes()->get_templates( 'profile' ),
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
),
array(
'id' => '_um_profile_max_width',
'type' => 'text',
'label' => __( 'Max. Width (px)', 'ultimate-member' ),
'tooltip' => __( 'The maximum width of shortcode in pixels e.g. 600px', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_max_width', null, UM()->options()->get( 'profile_max_width' ) ),
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
),
array(
'id' => '_um_profile_area_max_width',
'type' => 'text',
'label' => __( 'Profile Area Max. Width (px)', 'ultimate-member' ),
'tooltip' => __( 'The maximum width of the profile area inside profile (below profile header)', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_area_max_width', null, UM()->options()->get( 'profile_area_max_width' ) ),
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
),
array(
'id' => '_um_profile_icons',
'type' => 'select',
'label' => __( 'Field Icons', 'ultimate-member' ),
'tooltip' => __( 'Whether to show field icons and where to show them relative to the field', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_icons', null, UM()->options()->get( 'profile_icons' ) ),
'options' => array(
'field' => __( 'Show inside text field', 'ultimate-member' ),
'label' => __( 'Show with label', 'ultimate-member' ),
'off' => __( 'Turn off', 'ultimate-member' ),
),
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
),
array(
'id' => '_um_profile_primary_btn_word',
'type' => 'text',
'label' => __( 'Primary Button Text', 'ultimate-member' ),
'tooltip' => __( 'Customize the button text', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_primary_btn_word', null, UM()->options()->get( 'profile_primary_btn_word' ) ),
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
),
array(
'id' => '_um_profile_secondary_btn',
'type' => 'select',
'label' => __( 'Show Secondary Button', 'ultimate-member' ),
'value' => $profile_secondary_btn,
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
'options' => array(
0 => __( 'No', 'ultimate-member' ),
1 => __( 'Yes', 'ultimate-member' ),
),
),
array(
'id' => '_um_profile_secondary_btn_word',
'type' => 'text',
'label' => __( 'Secondary Button Text', 'ultimate-member' ),
'tooltip' => __( 'Customize the button text', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_secondary_btn_word', null, UM()->options()->get( 'profile_secondary_btn_word' ) ),
'conditional' => array( '_um_profile_secondary_btn', '=', 1 ),
),
array(
'id' => '_um_profile_cover_enabled',
'type' => 'select',
'label' => __( 'Enable Cover Photos', 'ultimate-member' ),
'value' => $profile_cover_enabled,
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
'options' => array(
0 => __( 'No', 'ultimate-member' ),
1 => __( 'Yes', 'ultimate-member' ),
),
),
array(
'id' => '_um_profile_coversize',
'type' => 'select',
'label' => __( 'Cover Photo Size', 'ultimate-member' ),
'tooltip' => __( 'Set the profile photo size in pixels here', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_coversize', null, UM()->options()->get( 'profile_coversize' ) ),
'options' => UM()->files()->get_profile_photo_size( 'cover_thumb_sizes' ),
'conditional' => array( '_um_profile_cover_enabled', '=', 1 ),
),
array(
'id' => '_um_profile_cover_ratio',
'type' => 'select',
'label' => __( 'Cover photo ratio', 'ultimate-member' ),
'tooltip' => __( 'The shortcode is centered by default unless you specify otherwise here', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_cover_ratio', null, UM()->options()->get( 'profile_cover_ratio' ) ),
'options' => array(
'1.6:1' => '1.6:1',
'2.7:1' => '2.7:1',
'2.2:1' => '2.2:1',
'3.2:1' => '3.2:1',
),
'conditional' => array( '_um_profile_cover_enabled', '=', 1 ),
),
array(
'id' => '_um_profile_disable_photo_upload',
'type' => 'select',
'label' => __( 'Disable Profile Photo Upload', 'ultimate-member' ),
'tooltip' => __( 'Switch on/off the profile photo uploader', 'ultimate-member' ),
'value' => $profile_disable_photo_upload,
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
'options' => array(
0 => __( 'No', 'ultimate-member' ),
1 => __( 'Yes', 'ultimate-member' ),
),
),
array(
'id' => '_um_profile_photosize',
'type' => 'select',
'label' => __( 'Profile Photo Size', 'ultimate-member' ),
'tooltip' => __( 'Set the profile photo size in pixels here', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_photosize', null, UM()->options()->get( 'profile_photosize' ) ),
'options' => UM()->files()->get_profile_photo_size( 'photo_thumb_sizes' ),
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
),
array(
'id' => '_um_profile_photo_required',
'type' => 'select',
'label' => __( 'Make Profile Photo Required', 'ultimate-member' ),
'tooltip' => __( 'Require user to update a profile photo when updating their profile', 'ultimate-member' ),
'value' => $profile_photo_required,
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
'options' => array(
0 => __( 'No', 'ultimate-member' ),
1 => __( 'Yes', 'ultimate-member' ),
),
),
array(
'id' => '_um_profile_show_name',
'type' => 'select',
'label' => __( 'Show display name in profile header?', 'ultimate-member' ),
'value' => $profile_show_name,
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
'options' => array(
0 => __( 'No', 'ultimate-member' ),
1 => __( 'Yes', 'ultimate-member' ),
),
),
array(
'id' => '_um_profile_show_social_links',
'type' => 'select',
'label' => __( 'Show social links in profile header?', 'ultimate-member' ),
'value' => $profile_show_social_links,
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
'options' => array(
0 => __( 'No', 'ultimate-member' ),
1 => __( 'Yes', 'ultimate-member' ),
),
),
array(
'id' => '_um_profile_show_bio',
'type' => 'select',
'label' => __( 'Show user description in profile header?', 'ultimate-member' ),
'value' => $profile_show_bio,
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
'options' => array(
0 => __( 'No', 'ultimate-member' ),
1 => __( 'Yes', 'ultimate-member' ),
),
),
),
)
)->render_form();
?>
<div class="um-admin-clear"></div>
</div>