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 | config/settings/permalink.php +183 -140 4.2.04.4.8 View file →
@@ -1,5 +1,8 @@
1 1 <?php
2 +
3 +use LearnPress\Models\UserModel;
4 +
2 5 $currencies = learn_press_currencies();
3 6
4 7 foreach ( $currencies as $code => $name ) {
5 8 $currency_symbol = learn_press_get_currency_symbol( $code );
@@ -6,10 +9,10 @@
6 9 $currencies[ $code ] = sprintf( '%s (%s)', $name, $currency_symbol );
7 10 }
8 11
9 12 $settings = LP_Settings::instance();
10 -$user = wp_get_current_user();
11 -$username = $user->user_login;
13 +$userModel = UserModel::find( get_current_user_id(), true );
14 +$username = $userModel->get_slug_link();
12 15 $settings_slug = $settings->get( 'profile_endpoints.settings', 'settings' );
13 16 $profile_slug = 'profile';
14 17
15 18 if ( learn_press_get_page_id( 'profile' ) ) {
@@ -19,150 +22,190 @@
19 22 $profile_slug = $profile_post->post_name;
20 23 }
21 24 }
22 25
23 -$profile_url = site_url() . '/' . $profile_slug . '/' . $username;
26 +//$profile_url = site_url() . '/' . $profile_slug . '/' . $username;
27 +$profile_url = home_url( $profile_slug . '/' . $username );
24 28
25 -return apply_filters( 'lp/settings/permalinks', array_merge(
26 - apply_filters(
27 - 'learn-press/course-settings-fields/single',
28 - [
29 +return apply_filters(
30 + 'lp/settings/permalinks',
31 + array_merge(
32 + apply_filters(
33 + 'learn-press/course-settings-fields/single',
29 34 [
30 - 'title' => esc_html__( 'Permalinks Course', 'learnpress' ),
31 - 'type' => 'title',
32 - ],
33 - [
34 - 'title' => esc_html__( 'Course', 'learnpress' ),
35 - 'type' => 'course-permalink',
36 - 'default' => '',
37 - 'id' => 'course_base',
38 - ],
39 - [
40 - 'title' => esc_html__( 'Lesson', 'learnpress' ),
41 - 'type' => 'text',
42 - 'id' => 'lesson_slug',
43 - 'desc' => sprintf( 'e.g. %s/course/sample-course/<code>lessons</code>/sample-lesson/', home_url() ),
44 - 'default' => 'lessons',
45 - 'placeholder' => 'lesson',
46 - ],
47 - [
48 - 'title' => esc_html__( 'Quiz', 'learnpress' ),
49 - 'type' => 'text',
50 - 'id' => 'quiz_slug',
51 - 'desc' => sprintf( 'e.g. %s/course/sample-course/<code>quizzes</code>/sample-quiz/', home_url() ),
52 - 'default' => 'quizzes',
53 - 'placeholder' => 'quizzes',
54 - ],
55 - [
56 - 'title' => esc_html__( 'Category base', 'learnpress' ),
57 - 'id' => 'course_category_base',
58 - 'default' => 'course-category',
59 - 'type' => 'text',
60 - 'placeholder' => 'course-category',
61 - 'desc' => sprintf( 'e.g. %s/course/%s/sample-category/', home_url(), '<code>course-category</code>' ),
62 - ],
63 - [
64 - 'title' => esc_html__( 'Tag base', 'learnpress' ),
65 - 'id' => 'course_tag_base',
66 - 'default' => 'course-tag',
67 - 'type' => 'text',
68 - 'placeholder' => 'course-tag',
69 - 'desc' => sprintf( 'e.g. %s/course/%s/sample-tag/', home_url(), '<code>course-tag</code>' ),
70 - ],
71 - [
72 - 'type' => 'sectionend',
73 - ],
74 - ]
75 - ),
76 - apply_filters(
77 - 'learn-press/profile-settings-fields/sub-tabs',
78 - array(
35 + [
36 + 'title' => esc_html__( 'Permalinks Course', 'learnpress' ),
37 + 'type' => 'title',
38 + ],
39 + [
40 + 'title' => esc_html__( 'Course', 'learnpress' ),
41 + 'type' => 'course-permalink',
42 + 'default' => '',
43 + 'id' => 'course_base',
44 + ],
45 + [
46 + 'title' => esc_html__( 'Lesson', 'learnpress' ),
47 + 'type' => 'text',
48 + 'id' => 'lesson_slug',
49 + 'desc' => sprintf( 'e.g. %s/course/sample-course/<code>lessons</code>/sample-lesson/', home_url() ),
50 + 'default' => 'lessons',
51 + 'placeholder' => 'lesson',
52 + ],
53 + [
54 + 'title' => esc_html__( 'Quiz', 'learnpress' ),
55 + 'type' => 'text',
56 + 'id' => 'quiz_slug',
57 + 'desc' => sprintf( 'e.g. %s/course/sample-course/<code>quizzes</code>/sample-quiz/', home_url() ),
58 + 'default' => 'quizzes',
59 + 'placeholder' => 'quizzes',
60 + ],
61 + [
62 + 'title' => esc_html__( 'Category base', 'learnpress' ),
63 + 'id' => 'course_category_base',
64 + 'default' => 'course-category',
65 + 'type' => 'text',
66 + 'placeholder' => 'course-category',
67 + 'desc' => sprintf( 'e.g. %s/course/%s/sample-category/', home_url(), '<code>course-category</code>' ),
68 + ],
69 + [
70 + 'title' => esc_html__( 'Tag base', 'learnpress' ),
71 + 'id' => 'course_tag_base',
72 + 'default' => 'course-tag',
73 + 'type' => 'text',
74 + 'placeholder' => 'course-tag',
75 + 'desc' => sprintf( 'e.g. %s/course/%s/sample-tag/', home_url(), '<code>course-tag</code>' ),
76 + ],
77 + [
78 + 'title' => esc_html__( 'Course Builder', 'learnpress' ),
79 + 'id' => 'course_builder',
80 + 'default' => 'course-builder',
81 + 'type' => 'text',
82 + 'placeholder' => 'course-builder',
83 + 'desc' => sprintf( 'e.g. %s/%s/', home_url(), '<code>course-builder</code>' ),
84 + ],
85 + [
86 + 'type' => 'sectionend',
87 + ],
88 + ]
89 + ),
90 + apply_filters(
91 + 'learn-press/profile-settings-fields/sub-tabs',
79 92 array(
80 - 'title' => esc_html__( 'Permalinks Profile', 'learnpress' ),
81 - 'type' => 'title',
82 - 'id' => 'lp_profile_permalinks',
93 + array(
94 + 'title' => esc_html__( 'Permalinks Profile', 'learnpress' ),
95 + 'type' => 'title',
96 + 'id' => 'lp_profile_permalinks',
97 + ),
98 + array(
99 + 'title' => esc_html__( 'Courses', 'learnpress' ),
100 + 'id' => 'profile_endpoints[courses]',
101 + 'type' => 'text',
102 + 'default' => 'courses',
103 + 'placeholder' => 'courses',
104 + 'desc' => sprintf(
105 + '%s. E.g: %s',
106 + __( 'Courses created by user', 'learnpress' ),
107 + "{$profile_url}/<code>" . $settings->get( 'profile_endpoints.courses', 'courses' ) . '</code>'
108 + ),
109 + ),
110 + array(
111 + 'title' => esc_html__( 'My Courses', 'learnpress' ),
112 + 'id' => 'profile_endpoints[my-courses]',
113 + 'type' => 'text',
114 + 'default' => 'my-courses',
115 + 'placeholder' => 'my-courses',
116 + 'desc' => sprintf(
117 + '%s. E.g: %s',
118 + __( 'Courses enrolled by user', 'learnpress' ),
119 + "{$profile_url}/<code>" . $settings->get( 'profile_endpoints.my-courses', 'my-courses' ) . '</code>'
120 + ),
121 + ),
122 + array(
123 + 'title' => esc_html__( 'Quizzes', 'learnpress' ),
124 + 'id' => 'profile_endpoints[quizzes]',
125 + 'type' => 'text',
126 + 'default' => 'quizzes',
127 + 'placeholder' => 'quizzes',
128 + 'desc' => sprintf( 'e.g. %s', "{$profile_url}/<code>" . $settings->get( 'profile_endpoints.quizzes', 'quizzes' ) . '</code>' ),
129 + ),
130 + array(
131 + 'title' => esc_html__( 'Orders', 'learnpress' ),
132 + 'id' => 'profile_endpoints[orders]',
133 + 'type' => 'text',
134 + 'default' => 'orders',
135 + 'placeholder' => 'orders',
136 + 'desc' => sprintf( 'e.g. %s', "{$profile_url}/<code>" . $settings->get( 'profile_endpoints.orders', 'orders' ) . '</code>' ),
137 + ),
138 + array(
139 + 'title' => esc_html__( 'Order details', 'learnpress' ),
140 + 'id' => 'profile_endpoints[order-details]',
141 + 'type' => 'text',
142 + 'default' => 'order-details',
143 + 'placeholder' => 'order-details',
144 + 'desc' => sprintf( 'e.g. %s', "{$profile_url}/<code>" . $settings->get( 'profile_endpoints.order-details', 'order-details' ) . '</code>/123' ),
145 + ),
146 + /*array(
147 + 'title' => esc_html__( 'Users pretty slug', 'learnpress' ),
148 + 'id' => 'lp_generate_user_slug_row',
149 + 'type' => 'html',
150 + 'default' => sprintf(
151 + '<button class="button" type="submit" name="lp_generate_user_slug" value="yes">%s</button>
152 + <p>%s<br>%s</p>',
153 + esc_html__( 'Generate users slug', 'learnpress' ),
154 + esc_html__( 'Generate public user slugs for existing users on old sites. Existing pretty slugs will be kept unchanged.', 'learnpress' ),
155 + esc_html__( 'This slug replaces the default username in profile and instructor links to uniquely identify users.', 'learnpress' )
156 + ),
157 + ),*/
83 158 ),
84 - array(
85 - 'title' => esc_html__( 'Courses', 'learnpress' ),
86 - 'id' => 'profile_endpoints[courses]',
87 - 'type' => 'text',
88 - 'default' => 'courses',
89 - 'placeholder' => 'courses',
90 - 'desc' => sprintf( 'e.g. %s', "{$profile_url}/<code>" . $settings->get( 'profile_endpoints.courses', 'courses' ) . '</code>' ),
91 - ),
92 - array(
93 - 'title' => esc_html__( 'Quizzes', 'learnpress' ),
94 - 'id' => 'profile_endpoints[quizzes]',
95 - 'type' => 'text',
96 - 'default' => 'quizzes',
97 - 'placeholder' => 'quizzes',
98 - 'desc' => sprintf( 'e.g. %s', "{$profile_url}/<code>" . $settings->get( 'profile_endpoints.quizzes', 'quizzes' ) . '</code>' ),
99 - ),
100 - array(
101 - 'title' => esc_html__( 'Orders', 'learnpress' ),
102 - 'id' => 'profile_endpoints[orders]',
103 - 'type' => 'text',
104 - 'default' => 'orders',
105 - 'placeholder' => 'orders',
106 - 'desc' => sprintf( 'e.g. %s', "{$profile_url}/<code>" . $settings->get( 'profile_endpoints.orders', 'orders' ) . '</code>' ),
107 - ),
108 - array(
109 - 'title' => esc_html__( 'Order details', 'learnpress' ),
110 - 'id' => 'profile_endpoints[order-details]',
111 - 'type' => 'text',
112 - 'default' => 'order-details',
113 - 'placeholder' => 'order-details',
114 - 'desc' => sprintf( 'e.g. %s', "{$profile_url}/<code>" . $settings->get( 'profile_endpoints.order-details', 'order-details' ) . '</code>/123' ),
115 - ),
159 + $this
116 160 ),
117 - $this
118 - ),
119 - apply_filters(
120 - 'learn-press/profile-settings-fields/settings-tab',
121 - array(
161 + apply_filters(
162 + 'learn-press/profile-settings-fields/settings-tab',
122 163 array(
123 - 'title' => esc_html__( 'Settings', 'learnpress' ),
124 - 'id' => 'profile_endpoints[settings]',
125 - 'type' => 'text',
126 - 'default' => 'settings',
127 - 'placeholder' => 'settings',
128 - 'desc' => sprintf( 'e.g. %s', "{$profile_url}/<code>{$settings_slug}</code>" ),
129 - ),
130 - array(
131 - 'title' => __( 'Basic Information <small>Settings</small>', 'learnpress' ),
132 - 'id' => 'profile_endpoints[settings-basic-information]',
133 - 'type' => 'text',
134 - 'default' => 'basic-information',
135 - 'placeholder' => 'basic-information',
136 - 'desc' => sprintf( 'e.g. %s', "{$profile_url}/{$settings_slug}/<code>" . $settings->get( 'profile_endpoints.settings-basic-information', 'basic-information' ) . '</code>' ),
137 - ),
138 - array(
139 - 'title' => __( 'Avatar <small>Settings</small>', 'learnpress' ),
140 - 'id' => 'profile_endpoints[settings-avatar]',
141 - 'type' => 'text',
142 - 'default' => 'avatar',
143 - 'placeholder' => 'avatar',
144 - 'desc' => sprintf( 'e.g. %s', "{$profile_url}/{$settings_slug}/<code>" . $settings->get( 'profile_endpoints.settings-avatar', 'avatar' ) . '</code>' ),
145 - ),
146 - array(
147 - 'title' => __( 'Change Password <small>Settings</small>', 'learnpress' ),
148 - 'id' => 'profile_endpoints[settings-change-password]',
149 - 'type' => 'text',
150 - 'default' => 'change-password',
151 - 'placeholder' => 'change-password',
152 - 'desc' => sprintf( 'e.g. %s', "{$profile_url}/{$settings_slug}/<code>" . $settings->get( 'profile_endpoints.settings-change-password', 'change-password' ) . '</code>' ),
153 - ),
154 - array(
155 - 'title' => __( 'Privacy <small>Settings</small>', 'learnpress' ),
156 - 'id' => 'profile_endpoints[settings-privacy]',
157 - 'type' => 'text',
158 - 'default' => 'privacy',
159 - 'placeholder' => 'privacy',
160 - 'desc' => sprintf( 'e.g. %s', "{$profile_url}/{$settings_slug}/<code>" . $settings->get( 'profile_endpoints.settings-privacy', 'privacy' ) . '</code>' ),
161 - ),
162 - array(
163 - 'type' => 'sectionend',
164 - 'id' => 'lp_profile_permalinks',
165 - ),
164 + array(
165 + 'title' => esc_html__( 'Settings', 'learnpress' ),
166 + 'id' => 'profile_endpoints[settings]',
167 + 'type' => 'text',
168 + 'default' => 'settings',
169 + 'placeholder' => 'settings',
170 + 'desc' => sprintf( 'e.g. %s', "{$profile_url}/<code>{$settings_slug}</code>" ),
171 + ),
172 + array(
173 + 'title' => __( 'Basic Information <small>Settings</small>', 'learnpress' ),
174 + 'id' => 'profile_endpoints[settings-basic-information]',
175 + 'type' => 'text',
176 + 'default' => 'basic-information',
177 + 'placeholder' => 'basic-information',
178 + 'desc' => sprintf( 'e.g. %s', "{$profile_url}/{$settings_slug}/<code>" . $settings->get( 'profile_endpoints.settings-basic-information', 'basic-information' ) . '</code>' ),
179 + ),
180 + array(
181 + 'title' => __( 'Avatar <small>Settings</small>', 'learnpress' ),
182 + 'id' => 'profile_endpoints[settings-avatar]',
183 + 'type' => 'text',
184 + 'default' => 'avatar',
185 + 'placeholder' => 'avatar',
186 + 'desc' => sprintf( 'e.g. %s', "{$profile_url}/{$settings_slug}/<code>" . $settings->get( 'profile_endpoints.settings-avatar', 'avatar' ) . '</code>' ),
187 + ),
188 + array(
189 + 'title' => __( 'Change Password <small>Settings</small>', 'learnpress' ),
190 + 'id' => 'profile_endpoints[settings-change-password]',
191 + 'type' => 'text',
192 + 'default' => 'change-password',
193 + 'placeholder' => 'change-password',
194 + 'desc' => sprintf( 'e.g. %s', "{$profile_url}/{$settings_slug}/<code>" . $settings->get( 'profile_endpoints.settings-change-password', 'change-password' ) . '</code>' ),
195 + ),
196 + array(
197 + 'title' => __( 'Privacy <small>Settings</small>', 'learnpress' ),
198 + 'id' => 'profile_endpoints[settings-privacy]',
199 + 'type' => 'text',
200 + 'default' => 'privacy',
201 + 'placeholder' => 'privacy',
202 + 'desc' => sprintf( 'e.g. %s', "{$profile_url}/{$settings_slug}/<code>" . $settings->get( 'profile_endpoints.settings-privacy', 'privacy' ) . '</code>' ),
203 + ),
204 + array(
205 + 'type' => 'sectionend',
206 + 'id' => 'lp_profile_permalinks',
207 + ),
208 + )
166 209 )
167 210 )
168 -) );
211 +);