| 1 |
<?php |
| 2 |
|
| 3 |
use LearnPress\Models\UserModel; |
| 4 |
|
| 5 |
$currencies = learn_press_currencies(); |
| 6 |
|
| 7 |
foreach ( $currencies as $code => $name ) { |
| 8 |
$currency_symbol = learn_press_get_currency_symbol( $code ); |
| 9 |
$currencies[ $code ] = sprintf( '%s (%s)', $name, $currency_symbol ); |
| 10 |
} |
| 11 |
|
| 12 |
$settings = LP_Settings::instance(); |
| 13 |
$userModel = UserModel::find( get_current_user_id(), true ); |
| 14 |
$username = $userModel->get_slug_link(); |
| 15 |
$settings_slug = $settings->get( 'profile_endpoints.settings', 'settings' ); |
| 16 |
$profile_slug = 'profile'; |
| 17 |
|
| 18 |
if ( learn_press_get_page_id( 'profile' ) ) { |
| 19 |
$profile_post = get_post( learn_press_get_page_id( 'profile' ) ); |
| 20 |
|
| 21 |
if ( $profile_post ) { |
| 22 |
$profile_slug = $profile_post->post_name; |
| 23 |
} |
| 24 |
} |
| 25 |
|
| 26 |
//$profile_url = site_url() . '/' . $profile_slug . '/' . $username; |
| 27 |
$profile_url = home_url( $profile_slug . '/' . $username ); |
| 28 |
|
| 29 |
return apply_filters( |
| 30 |
'lp/settings/permalinks', |
| 31 |
array_merge( |
| 32 |
apply_filters( |
| 33 |
'learn-press/course-settings-fields/single', |
| 34 |
[ |
| 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', |
| 92 |
array( |
| 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 |
),*/ |
| 158 |
), |
| 159 |
$this |
| 160 |
), |
| 161 |
apply_filters( |
| 162 |
'learn-press/profile-settings-fields/settings-tab', |
| 163 |
array( |
| 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 |
) |
| 209 |
) |
| 210 |
) |
| 211 |
); |
| 212 |
|