| 1 |
<?php |
| 2 |
$currencies = learn_press_currencies(); |
| 3 |
foreach ( $currencies as $code => $name ) { |
| 4 |
$currency_symbol = learn_press_get_currency_symbol( $code ); |
| 5 |
$currencies[ $code ] = sprintf( '%s (%s)', $name, $currency_symbol ); |
| 6 |
} |
| 7 |
|
| 8 |
$settings = LP_Settings::instance(); |
| 9 |
$user = wp_get_current_user(); |
| 10 |
$username = $user->user_login; |
| 11 |
$settings_slug = $settings->get( 'profile_endpoints.settings', 'settings' ); |
| 12 |
$profile_slug = 'profile'; |
| 13 |
|
| 14 |
if ( learn_press_get_page_id( 'profile' ) ) { |
| 15 |
$profile_post = get_post( learn_press_get_page_id( 'profile' ) ); |
| 16 |
|
| 17 |
if ( $profile_post ) { |
| 18 |
$profile_slug = $profile_post->post_name; |
| 19 |
} |
| 20 |
} |
| 21 |
|
| 22 |
$profile_url = site_url() . '/' . $profile_slug . '/' . $username; |
| 23 |
|
| 24 |
return apply_filters( |
| 25 |
'lp/settings/profile', |
| 26 |
apply_filters( |
| 27 |
'learn-press/profile-settings-fields/general', |
| 28 |
array( |
| 29 |
array( |
| 30 |
'title' => esc_html__( 'General', 'learnpress' ), |
| 31 |
'type' => 'title', |
| 32 |
'id' => 'lp_profile_general', |
| 33 |
), |
| 34 |
array( |
| 35 |
'title' => esc_html__( 'Avatar Dimensions', 'learnpress' ), |
| 36 |
'id' => 'avatar_dimensions', |
| 37 |
'default' => array( 250, 250, 'yes' ), |
| 38 |
'type' => 'image-dimensions', |
| 39 |
), |
| 40 |
array( |
| 41 |
'title' => esc_html__( 'Enable login form', 'learnpress' ), |
| 42 |
'id' => 'enable_login_profile', |
| 43 |
'default' => 'no', |
| 44 |
'type' => 'checkbox', |
| 45 |
'desc' => esc_html__( 'If the user is not logged in, enable login from profile.', 'learnpress' ), |
| 46 |
), |
| 47 |
array( |
| 48 |
'title' => esc_html__( 'Enable register form', 'learnpress' ), |
| 49 |
'id' => 'enable_register_profile', |
| 50 |
'default' => 'no', |
| 51 |
'type' => 'checkbox', |
| 52 |
'desc' => esc_html__( 'If the user is not logged in, enable register from profile.', 'learnpress' ), |
| 53 |
), |
| 54 |
array( |
| 55 |
'title' => esc_html__( 'Enable default fields', 'learnpress' ), |
| 56 |
'id' => 'enable_register_first_name', |
| 57 |
'default' => 'no', |
| 58 |
'type' => 'checkbox', |
| 59 |
'checkboxgroup' => 'start', |
| 60 |
'desc' => esc_html__( 'First name', 'learnpress' ), |
| 61 |
), |
| 62 |
array( |
| 63 |
'id' => 'enable_register_last_name', |
| 64 |
'default' => 'no', |
| 65 |
'type' => 'checkbox', |
| 66 |
'checkboxgroup' => '', |
| 67 |
'desc' => esc_html__( 'Last name', 'learnpress' ), |
| 68 |
), |
| 69 |
array( |
| 70 |
'id' => 'enable_register_display_name', |
| 71 |
'default' => 'no', |
| 72 |
'type' => 'checkbox', |
| 73 |
'checkboxgroup' => 'end', |
| 74 |
'desc' => esc_html__( 'Display name', 'learnpress' ), |
| 75 |
), |
| 76 |
array( |
| 77 |
'title' => esc_html__( 'Custom register fields', 'learnpress' ), |
| 78 |
'id' => 'register_profile_fields', |
| 79 |
'default' => array(), |
| 80 |
'type' => 'custom-fields', |
| 81 |
'options' => array( |
| 82 |
'name' => array( |
| 83 |
'title' => esc_html__( 'Name', 'learnpress' ), |
| 84 |
'type' => 'text', |
| 85 |
'desc_tip' => esc_html__( 'Display field name.', 'learnpress' ), |
| 86 |
'placeholder' => esc_html__( 'Display name', 'learnpress' ), |
| 87 |
), |
| 88 |
'type' => array( |
| 89 |
'title' => esc_html__( 'Type', 'learnpress' ), |
| 90 |
'type' => 'select', |
| 91 |
'options' => array( |
| 92 |
'text' => esc_html__( 'Text', 'learnpress' ), |
| 93 |
'textarea' => esc_html__( 'Textarea', 'learnpress' ), |
| 94 |
'checkbox' => esc_html__( 'Checkbox', 'learnpress' ), |
| 95 |
'url' => esc_html__( 'URL', 'learnpress' ), |
| 96 |
'number' => esc_html__( 'Number', 'learnpress' ), |
| 97 |
), |
| 98 |
), |
| 99 |
'required' => array( |
| 100 |
'title' => esc_html__( 'Required?', 'learnpress' ), |
| 101 |
'type' => 'checkbox', |
| 102 |
), |
| 103 |
), |
| 104 |
'desc' => esc_html__( 'Custom fields to the registration form.', 'learnpress' ), |
| 105 |
), |
| 106 |
array( |
| 107 |
'type' => 'sectionend', |
| 108 |
'id' => 'lp_profile_general', |
| 109 |
), |
| 110 |
) |
| 111 |
) |
| 112 |
); |
| 113 |
|