emails
8 years ago
global
9 years ago
single-give-form
9 years ago
email-login-form.php
8 years ago
give-rtl.css
8 years ago
give-rtl.min.css
8 years ago
give.css
8 years ago
give.min.css
8 years ago
history-donations.php
8 years ago
payment-processing.php
9 years ago
shortcode-goal.php
8 years ago
shortcode-login.php
8 years ago
shortcode-profile-editor.php
8 years ago
shortcode-receipt.php
8 years ago
shortcode-register.php
9 years ago
single-give-form.php
9 years ago
shortcode-profile-editor.php
189 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Profile Editor |
| 4 | * |
| 5 | * This template is used to display the profile editor with [give_profile_editor] |
| 6 | * |
| 7 | * @copyright Copyright (c) 2016, WordImpress |
| 8 | * @license https://opensource.org/licenses/gpl-license GNU Public License |
| 9 | */ |
| 10 | $current_user = wp_get_current_user(); |
| 11 | |
| 12 | if ( is_user_logged_in() ): |
| 13 | $user_id = get_current_user_id(); |
| 14 | $first_name = get_user_meta( $user_id, 'first_name', true ); |
| 15 | $last_name = get_user_meta( $user_id, 'last_name', true ); |
| 16 | $display_name = $current_user->display_name; |
| 17 | $address = give_get_donor_address( $user_id, array( 'address_type' => 'personal' ) ); |
| 18 | |
| 19 | if ( isset( $_GET['updated'] ) && $_GET['updated'] == true && ! give_get_errors() ): ?> |
| 20 | <p class="give_success"> |
| 21 | <strong><?php esc_html_e( 'Success:', 'give' ); ?></strong> <?php esc_html_e( 'Your profile has been updated.', 'give' ); ?> |
| 22 | </p> |
| 23 | <?php endif; ?> |
| 24 | |
| 25 | <?php Give()->notices->render_frontend_notices( 0 ); ?> |
| 26 | |
| 27 | <?php |
| 28 | /** |
| 29 | * Fires in the profile editor shortcode, before the form. |
| 30 | * |
| 31 | * Allows you to add new elements before the form. |
| 32 | * |
| 33 | * @since 1.0 |
| 34 | */ |
| 35 | do_action( 'give_profile_editor_before' ); |
| 36 | ?> |
| 37 | |
| 38 | <form id="give_profile_editor_form" class="give-form" action="<?php echo give_get_current_page_url(); ?>" method="post"> |
| 39 | |
| 40 | <fieldset> |
| 41 | <legend id="give_profile_name_label"><?php _e( 'Profile', 'give' ); ?></legend> |
| 42 | |
| 43 | <h3 id="give_personal_information_label" class="give-section-break"><?php _e( 'Change your Name', 'give' ); ?></h3> |
| 44 | |
| 45 | <p id="give_profile_first_name_wrap" class="form-row form-row-first form-row-responsive"> |
| 46 | <label for="give_first_name"> |
| 47 | <?php _e( 'First Name', 'give' ); ?> |
| 48 | <span class="give-required-indicator ">*</span> |
| 49 | </label> |
| 50 | <input name="give_first_name" id="give_first_name" class="text give-input" type="text" value="<?php echo esc_attr( $first_name ); ?>"/> |
| 51 | </p> |
| 52 | |
| 53 | <p id="give_profile_last_name_wrap" class="form-row form-row-last form-row-responsive"> |
| 54 | <label for="give_last_name"><?php _e( 'Last Name', 'give' ); ?></label> |
| 55 | <input name="give_last_name" id="give_last_name" class="text give-input" type="text" value="<?php echo esc_attr( $last_name ); ?>"/> |
| 56 | </p> |
| 57 | |
| 58 | <p id="give_profile_display_name_wrap" class="form-row form-row-first form-row-responsive"> |
| 59 | <label for="give_display_name"><?php _e( 'Display Name', 'give' ); ?></label> |
| 60 | <select name="give_display_name" id="give_display_name" class="select give-select"> |
| 61 | <?php if ( ! empty( $current_user->first_name ) ): ?> |
| 62 | <option <?php selected( $display_name, $current_user->first_name ); ?> value="<?php echo esc_attr( $current_user->first_name ); ?>"><?php echo esc_html( $current_user->first_name ); ?></option> |
| 63 | <?php endif; ?> |
| 64 | <option <?php selected( $display_name, $current_user->user_nicename ); ?> value="<?php echo esc_attr( $current_user->user_nicename ); ?>"><?php echo esc_html( $current_user->user_nicename ); ?></option> |
| 65 | <?php if ( ! empty( $current_user->last_name ) ): ?> |
| 66 | <option <?php selected( $display_name, $current_user->last_name ); ?> value="<?php echo esc_attr( $current_user->last_name ); ?>"><?php echo esc_html( $current_user->last_name ); ?></option> |
| 67 | <?php endif; ?> |
| 68 | <?php if ( ! empty( $current_user->first_name ) && ! empty( $current_user->last_name ) ): ?> |
| 69 | <option <?php selected( $display_name, $current_user->first_name . ' ' . $current_user->last_name ); ?> value="<?php echo esc_attr( $current_user->first_name . ' ' . $current_user->last_name ); ?>"><?php echo esc_html( $current_user->first_name . ' ' . $current_user->last_name ); ?></option> |
| 70 | <option <?php selected( $display_name, $current_user->last_name . ' ' . $current_user->first_name ); ?> value="<?php echo esc_attr( $current_user->last_name . ' ' . $current_user->first_name ); ?>"><?php echo esc_html( $current_user->last_name . ' ' . $current_user->first_name ); ?></option> |
| 71 | <?php endif; ?> |
| 72 | </select> |
| 73 | <?php |
| 74 | /** |
| 75 | * Fires in the profile editor shortcode, to the name section. |
| 76 | * |
| 77 | * Allows you to add new elements to the name section. |
| 78 | * |
| 79 | * @since 1.0 |
| 80 | */ |
| 81 | do_action( 'give_profile_editor_name' ); |
| 82 | ?> |
| 83 | </p> |
| 84 | |
| 85 | <?php |
| 86 | /** |
| 87 | * Fires in the profile editor shortcode, after the name field. |
| 88 | * |
| 89 | * Allows you to add new fields after the name field. |
| 90 | * |
| 91 | * @since 1.0 |
| 92 | */ |
| 93 | do_action( 'give_profile_editor_after_name' ); |
| 94 | ?> |
| 95 | |
| 96 | <p class="form-row form-row-last form-row-responsive"> |
| 97 | <label for="give_email"> |
| 98 | <?php _e( 'Email Address', 'give' ); ?> |
| 99 | <span class="give-required-indicator ">*</span> |
| 100 | </label> |
| 101 | <input name="give_email" id="give_email" class="text give-input required" type="email" value="<?php echo esc_attr( $current_user->user_email ); ?>" required aria-required="true"/> |
| 102 | <?php |
| 103 | /** |
| 104 | * Fires in the profile editor shortcode, to the email section. |
| 105 | * |
| 106 | * Allows you to add new elements to the email section. |
| 107 | * |
| 108 | * @since 1.0 |
| 109 | */ |
| 110 | do_action( 'give_profile_editor_email' ); |
| 111 | ?> |
| 112 | </p> |
| 113 | |
| 114 | <?php |
| 115 | /** |
| 116 | * Fires in the profile editor shortcode, after the email field. |
| 117 | * |
| 118 | * Allows you to add new fields after the email field. |
| 119 | * |
| 120 | * @since 1.0 |
| 121 | */ |
| 122 | do_action( 'give_profile_editor_after_email' ); |
| 123 | ?> |
| 124 | |
| 125 | <h3 id="give_profile_password_label" class="give-section-break"><?php _e( 'Change your Password', 'give' ); ?></h3> |
| 126 | |
| 127 | <div id="give_profile_password_wrap" class="give-clearfix"> |
| 128 | <p id="give_profile_password_wrap_1" class="form-row form-row-first form-row-responsive"> |
| 129 | <label for="give_new_user_pass1"><?php _e( 'New Password', 'give' ); ?></label> |
| 130 | <input name="give_new_user_pass1" id="give_new_user_pass1" class="password give-input" type="password"/> |
| 131 | </p> |
| 132 | |
| 133 | <p id="give_profile_password_wrap_2" class="form-row form-row-last form-row-responsive"> |
| 134 | <label for="give_new_user_pass2"><?php _e( 'Re-enter Password', 'give' ); ?></label> |
| 135 | <input name="give_new_user_pass2" id="give_new_user_pass2" class="password give-input" type="password"/> |
| 136 | <?php |
| 137 | /** |
| 138 | * Fires in the profile editor shortcode, to the password section. |
| 139 | * |
| 140 | * Allows you to add new elements to the password section. |
| 141 | * |
| 142 | * @since 1.0 |
| 143 | */ |
| 144 | do_action( 'give_profile_editor_password' ); |
| 145 | ?> |
| 146 | </p> |
| 147 | </div> |
| 148 | |
| 149 | <p class="give_password_change_notice"><?php _e( 'Please note after changing your password, you must log back in.', 'give' ); ?></p> |
| 150 | |
| 151 | <?php |
| 152 | /** |
| 153 | * Fires in the profile editor shortcode, after the password field. |
| 154 | * |
| 155 | * Allows you to add new fields after the password field. |
| 156 | * |
| 157 | * @since 1.0 |
| 158 | */ |
| 159 | do_action( 'give_profile_editor_after_password' ); |
| 160 | ?> |
| 161 | |
| 162 | <p id="give_profile_submit_wrap"> |
| 163 | <input type="hidden" name="give_profile_editor_nonce" value="<?php echo wp_create_nonce( 'give-profile-editor-nonce' ); ?>"/> |
| 164 | <input type="hidden" name="give_action" value="edit_user_profile"/> |
| 165 | <input type="hidden" name="give_redirect" value="<?php echo esc_url( give_get_current_page_url() ); ?>"/> |
| 166 | <input name="give_profile_editor_submit" id="give_profile_editor_submit" type="submit" class="give_submit" value="<?php _e( 'Save Changes', 'give' ); ?>"/> |
| 167 | </p> |
| 168 | |
| 169 | </fieldset> |
| 170 | |
| 171 | </form><!-- #give_profile_editor_form --> |
| 172 | |
| 173 | <?php |
| 174 | /** |
| 175 | * Fires in the profile editor shortcode, after the form. |
| 176 | * |
| 177 | * Allows you to add new elements after the form. |
| 178 | * |
| 179 | * @since 1.0 |
| 180 | */ |
| 181 | do_action( 'give_profile_editor_after' ); |
| 182 | ?> |
| 183 | |
| 184 | <?php |
| 185 | else: |
| 186 | _e( 'You need to login to edit your profile.', 'give' ); |
| 187 | echo give_login_form(); |
| 188 | endif; |
| 189 |