PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.8
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.8
4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 All 139 releases
← All changes | inc/admin/settings/class-lp-settings-profile.php +3 -203 4.1.74.4.8 View file →
@@ -7,8 +7,10 @@
7 7 * @package LearnPress/Admin/Classes/Settings
8 8 * @version 1.0
9 9 */
10 10
11 +use LearnPress\Helpers\Config;
12 +
11 13 defined( 'ABSPATH' ) || exit;
12 14
13 15 if ( class_exists( 'LP_Settings_Profile', false ) ) {
14 16 return new LP_Settings_Profile();
@@ -32,211 +34,9 @@
32 34 *
33 35 * @return array
34 36 */
35 37 public function get_settings( $section = null, $tab = null ) {
36 - $settings = LP_Settings::instance();
37 - $user = wp_get_current_user();
38 - $username = $user->user_login;
39 - $settings_slug = $settings->get( 'profile_endpoints.settings', 'settings' );
40 - $profile_slug = 'profile';
41 -
42 - if ( learn_press_get_page_id( 'profile' ) ) {
43 - $profile_post = get_post( learn_press_get_page_id( 'profile' ) );
44 -
45 - if ( $profile_post ) {
46 - $profile_slug = $profile_post->post_name;
47 - }
48 - }
49 -
50 - $profile_url = site_url() . '/' . $profile_slug . '/' . $username;
51 -
52 - $settings = apply_filters(
53 - 'learn-press/profile-settings-fields',
54 - array_merge(
55 - apply_filters(
56 - 'learn-press/profile-settings-fields/general',
57 - array(
58 - array(
59 - 'title' => esc_html__( 'General', 'learnpress' ),
60 - 'type' => 'title',
61 - 'id' => 'lp_profile_general',
62 - ),
63 - array(
64 - 'title' => esc_html__( 'Avatar Dimensions', 'learnpress' ),
65 - 'id' => 'avatar_dimensions',
66 - 'default' => array( 250, 250, 'yes' ),
67 - 'type' => 'image-dimensions',
68 - ),
69 - array(
70 - 'title' => esc_html__( 'Enable login form', 'learnpress' ),
71 - 'id' => 'enable_login_profile',
72 - 'default' => 'no',
73 - 'type' => 'checkbox',
74 - 'desc' => esc_html__( 'Enable login from profile if the user is not logged in.', 'learnpress' ),
75 - ),
76 - array(
77 - 'title' => esc_html__( 'Enable register form', 'learnpress' ),
78 - 'id' => 'enable_register_profile',
79 - 'default' => 'no',
80 - 'type' => 'checkbox',
81 - 'desc' => esc_html__( 'Enable register from profile if the user is not logged in.', 'learnpress' ),
82 - ),
83 - array(
84 - 'title' => esc_html__( 'Enable default fields', 'learnpress' ),
85 - 'id' => 'enable_register_first_name',
86 - 'default' => 'no',
87 - 'type' => 'checkbox',
88 - 'checkboxgroup' => 'start',
89 - 'desc' => esc_html__( 'First name', 'learnpress' ),
90 - ),
91 - array(
92 - 'id' => 'enable_register_last_name',
93 - 'default' => 'no',
94 - 'type' => 'checkbox',
95 - 'checkboxgroup' => '',
96 - 'desc' => esc_html__( 'Last name', 'learnpress' ),
97 - ),
98 - array(
99 - 'id' => 'enable_register_display_name',
100 - 'default' => 'no',
101 - 'type' => 'checkbox',
102 - 'checkboxgroup' => 'end',
103 - 'desc' => esc_html__( 'Display name', 'learnpress' ),
104 - ),
105 - array(
106 - 'title' => esc_html__( 'Custom register fields', 'learnpress' ),
107 - 'id' => 'register_profile_fields',
108 - 'default' => array(),
109 - 'type' => 'custom-fields',
110 - 'options' => array(
111 - 'name' => array(
112 - 'title' => esc_html__( 'Name', 'learnpress' ),
113 - 'type' => 'text',
114 - 'desc_tip' => esc_html__( 'Display field name.', 'learnpress' ),
115 - 'placeholder' => esc_html__( 'Display name', 'learnpress' ),
116 - ),
117 - 'type' => array(
118 - 'title' => esc_html__( 'Type', 'learnpress' ),
119 - 'type' => 'select',
120 - 'options' => array(
121 - 'text' => esc_html__( 'Text', 'learnpress' ),
122 - 'textarea' => esc_html__( 'Textarea', 'learnpress' ),
123 - 'checkbox' => esc_html__( 'Checkbox', 'learnpress' ),
124 - 'url' => esc_html__( 'URL', 'learnpress' ),
125 - 'number' => esc_html__( 'Number', 'learnpress' ),
126 - ),
127 - ),
128 - 'required' => array(
129 - 'title' => esc_html__( 'Required?', 'learnpress' ),
130 - 'type' => 'checkbox',
131 - ),
132 - ),
133 - 'desc' => esc_html__( 'Custom fields for form register.', 'learnpress' ),
134 - ),
135 - array(
136 - 'type' => 'sectionend',
137 - 'id' => 'lp_profile_general',
138 - ),
139 - )
140 - ),
141 - apply_filters(
142 - 'learn-press/profile-settings-fields/sub-tabs',
143 - array(
144 - array(
145 - 'title' => esc_html__( 'Permalinks', 'learnpress' ),
146 - 'type' => 'title',
147 - 'id' => 'lp_profile_permalinks',
148 - ),
149 - array(
150 - 'title' => esc_html__( 'Courses', 'learnpress' ),
151 - 'id' => 'profile_endpoints[courses]',
152 - 'type' => 'text',
153 - 'default' => 'courses',
154 - 'placeholder' => 'courses',
155 - 'desc' => sprintf( 'e.g. %s', "{$profile_url}/<code>" . $settings->get( 'profile_endpoints.courses', 'courses' ) . '</code>' ),
156 - ),
157 - array(
158 - 'title' => esc_html__( 'Quizzes', 'learnpress' ),
159 - 'id' => 'profile_endpoints[quizzes]',
160 - 'type' => 'text',
161 - 'default' => 'quizzes',
162 - 'placeholder' => 'quizzes',
163 - 'desc' => sprintf( 'e.g. %s', "{$profile_url}/<code>" . $settings->get( 'profile_endpoints.quizzes', 'quizzes' ) . '</code>' ),
164 - ),
165 - array(
166 - 'title' => esc_html__( 'Orders', 'learnpress' ),
167 - 'id' => 'profile_endpoints[orders]',
168 - 'type' => 'text',
169 - 'default' => 'orders',
170 - 'placeholder' => 'orders',
171 - 'desc' => sprintf( 'e.g. %s', "{$profile_url}/<code>" . $settings->get( 'profile_endpoints.orders', 'orders' ) . '</code>' ),
172 - ),
173 - array(
174 - 'title' => esc_html__( 'Order details', 'learnpress' ),
175 - 'id' => 'profile_endpoints[order-details]',
176 - 'type' => 'text',
177 - 'default' => 'order-details',
178 - 'placeholder' => 'order-details',
179 - 'desc' => sprintf( 'e.g. %s', "{$profile_url}/<code>" . $settings->get( 'profile_endpoints.order-details', 'order-details' ) . '</code>/123' ),
180 - ),
181 - ),
182 - $this
183 - ),
184 - apply_filters(
185 - 'learn-press/profile-settings-fields/settings-tab',
186 - array(
187 - array(
188 - 'title' => esc_html__( 'Settings', 'learnpress' ),
189 - 'id' => 'profile_endpoints[settings]',
190 - 'type' => 'text',
191 - 'default' => 'settings',
192 - 'placeholder' => 'settings',
193 - 'desc' => sprintf( 'e.g. %s', "{$profile_url}/<code>{$settings_slug}</code>" ),
194 - ),
195 - array(
196 - 'title' => __( 'Basic Information <small>Settings</small>', 'learnpress' ),
197 - 'id' => 'profile_endpoints[settings-basic-information]',
198 - 'type' => 'text',
199 - 'default' => 'basic-information',
200 - 'placeholder' => 'basic-information',
201 - 'desc' => sprintf( 'e.g. %s', "{$profile_url}/{$settings_slug}/<code>" . $settings->get( 'profile_endpoints.settings-basic-information', 'basic-information' ) . '</code>' ),
202 - ),
203 - array(
204 - 'title' => __( 'Avatar <small>Settings</small>', 'learnpress' ),
205 - 'id' => 'profile_endpoints[settings-avatar]',
206 - 'type' => 'text',
207 - 'default' => 'avatar',
208 - 'placeholder' => 'avatar',
209 - 'desc' => sprintf( 'e.g. %s', "{$profile_url}/{$settings_slug}/<code>" . $settings->get( 'profile_endpoints.settings-avatar', 'avatar' ) . '</code>' ),
210 - ),
211 - array(
212 - 'title' => __( 'Change Password <small>Settings</small>', 'learnpress' ),
213 - 'id' => 'profile_endpoints[settings-change-password]',
214 - 'type' => 'text',
215 - 'default' => 'change-password',
216 - 'placeholder' => 'change-password',
217 - 'desc' => sprintf( 'e.g. %s', "{$profile_url}/{$settings_slug}/<code>" . $settings->get( 'profile_endpoints.settings-change-password', 'change-password' ) . '</code>' ),
218 - ),
219 - array(
220 - 'title' => __( 'Privacy <small>Settings</small>', 'learnpress' ),
221 - 'id' => 'profile_endpoints[settings-privacy]',
222 - 'type' => 'text',
223 - 'default' => 'privacy',
224 - 'placeholder' => 'privacy',
225 - 'desc' => sprintf( 'e.g. %s', "{$profile_url}/{$settings_slug}/<code>" . $settings->get( 'profile_endpoints.settings-privacy', 'privacy' ) . '</code>' ),
226 - ),
227 - array(
228 - 'type' => 'sectionend',
229 - 'id' => 'lp_profile_permalinks',
230 - ),
231 - )
232 - )
233 - )
234 - );
235 -
236 - $settings = apply_filters( 'learn-press/settings/profile', $settings );
237 -
238 - return $settings;
38 + return Config::instance()->get( 'profile', 'settings' );
239 39 }
240 40 }
241 41
242 42 return new LP_Settings_Profile();