| 1 |
<?php |
| 2 |
$currencies = learn_press_currencies(); |
| 3 |
|
| 4 |
foreach ( $currencies as $code => $name ) { |
| 5 |
$currency_symbol = learn_press_get_currency_symbol( $code ); |
| 6 |
$currencies[ $code ] = sprintf( '%s (%s)', $name, $currency_symbol ); |
| 7 |
} |
| 8 |
|
| 9 |
$settings = LP_Settings::instance(); |
| 10 |
$user = wp_get_current_user(); |
| 11 |
$username = $user->user_login; |
| 12 |
$settings_slug = $settings->get( 'profile_endpoints.settings', 'settings' ); |
| 13 |
$profile_slug = 'profile'; |
| 14 |
|
| 15 |
if ( learn_press_get_page_id( 'profile' ) ) { |
| 16 |
$profile_post = get_post( learn_press_get_page_id( 'profile' ) ); |
| 17 |
|
| 18 |
if ( $profile_post ) { |
| 19 |
$profile_slug = $profile_post->post_name; |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
$profile_url = site_url() . '/' . $profile_slug . '/' . $username; |
| 24 |
|
| 25 |
return apply_filters( 'lp/settings/permalinks', array_merge( |
| 26 |
apply_filters( |
| 27 |
'learn-press/course-settings-fields/single', |
| 28 |
[ |
| 29 |
[ |
| 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( |
| 79 |
array( |
| 80 |
'title' => esc_html__( 'Permalinks Profile', 'learnpress' ), |
| 81 |
'type' => 'title', |
| 82 |
'id' => 'lp_profile_permalinks', |
| 83 |
), |
| 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 |
), |
| 116 |
), |
| 117 |
$this |
| 118 |
), |
| 119 |
apply_filters( |
| 120 |
'learn-press/profile-settings-fields/settings-tab', |
| 121 |
array( |
| 122 |
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 |
), |
| 166 |
) |
| 167 |
) |
| 168 |
) ); |
| 169 |
|