| 1 | | <?php |
| 2 | | |
| 3 | | if ( !defined( 'BP_SETTINGS_SLUG' ) ) |
| 4 | | define( 'BP_SETTINGS_SLUG', 'settings' ); |
| 5 | | |
| 6 | | function bp_core_add_settings_nav() { |
| 7 | | global $bp; |
| 8 | | |
| 9 | | /* Set up settings as a sudo-component for identification and nav selection */ |
| 10 | | $bp->settings->id = 'settings'; |
| 11 | | $bp->settings->slug = BP_SETTINGS_SLUG; |
| 12 | | |
| 13 | | /* Register this in the active components array */ |
| 14 | | $bp->active_components[$bp->settings->slug] = $bp->settings->id; |
| 15 | | |
| 16 | | /* Add the settings navigation item */ |
| 17 | | bp_core_new_nav_item( array( 'name' => __('Settings', 'buddypress'), 'slug' => $bp->settings->slug, 'position' => 100, 'show_for_displayed_user' => false, 'screen_function' => 'bp_core_screen_general_settings', 'default_subnav_slug' => 'general' ) ); |
| 18 | | |
| 19 | | $settings_link = $bp->loggedin_user->domain . $bp->settings->slug . '/'; |
| 20 | | |
| 21 | | bp_core_new_subnav_item( array( 'name' => __( 'General', 'buddypress' ), 'slug' => 'general', 'parent_url' => $settings_link, 'parent_slug' => $bp->settings->slug, 'screen_function' => 'bp_core_screen_general_settings', 'position' => 10, 'user_has_access' => bp_is_my_profile() ) ); |
| 22 | | bp_core_new_subnav_item( array( 'name' => __( 'Notifications', 'buddypress' ), 'slug' => 'notifications', 'parent_url' => $settings_link, 'parent_slug' => $bp->settings->slug, 'screen_function' => 'bp_core_screen_notification_settings', 'position' => 20, 'user_has_access' => bp_is_my_profile() ) ); |
| 23 | | |
| 24 | | if ( !is_site_admin() && !(int) $bp->site_options['bp-disable-account-deletion'] ) |
| 25 | | bp_core_new_subnav_item( array( 'name' => __( 'Delete Account', 'buddypress' ), 'slug' => 'delete-account', 'parent_url' => $settings_link, 'parent_slug' => $bp->settings->slug, 'screen_function' => 'bp_core_screen_delete_account', 'position' => 90, 'user_has_access' => bp_is_my_profile() ) ); |
| 26 | | } |
| 27 | | add_action( 'wp', 'bp_core_add_settings_nav', 2 ); |
| 28 | | add_action( 'admin_menu', 'bp_core_add_settings_nav', 2 ); |
| 29 | | |
| 30 | | /**** GENERAL SETTINGS ****/ |
| 31 | | |
| 32 | | function bp_core_screen_general_settings() { |
| 33 | | global $current_user, $bp_settings_updated, $pass_error; |
| 34 | | |
| 35 | | $bp_settings_updated = false; |
| 36 | | $pass_error = false; |
| 37 | | |
| 38 | | if ( isset($_POST['submit']) ) { |
| 39 | | check_admin_referer('bp_settings_general'); |
| 40 | | |
| 41 | | require_once( WPINC . '/registration.php' ); |
| 42 | | |
| 43 | | // Form has been submitted and nonce checks out, lets do it. |
| 44 | | |
| 45 | | if ( $_POST['email'] != '' ) |
| 46 | | $current_user->user_email = wp_specialchars( trim( $_POST['email'] ) ); |
| 47 | | |
| 48 | | if ( $_POST['pass1'] != '' && $_POST['pass2'] != '' ) { |
| 49 | | if ( $_POST['pass1'] == $_POST['pass2'] && !strpos( " " . $_POST['pass1'], "\\" ) ) |
| 50 | | $current_user->user_pass = $_POST['pass1']; |
| 51 | | else |
| 52 | | $pass_error = true; |
| 53 | | } else if ( empty( $_POST['pass1'] ) && !empty( $_POST['pass2'] ) || !empty( $_POST['pass1'] ) && empty( $_POST['pass2'] ) ) { |
| 54 | | $pass_error = true; |
| 55 | | } else { |
| 56 | | unset( $current_user->user_pass ); |
| 57 | | } |
| 58 | | |
| 59 | | if ( !$pass_error && wp_update_user( get_object_vars( $current_user ) ) ) |
| 60 | | $bp_settings_updated = true; |
| 61 | | } |
| 62 | | |
| 63 | | add_action( 'bp_template_title', 'bp_core_screen_general_settings_title' ); |
| 64 | | add_action( 'bp_template_content', 'bp_core_screen_general_settings_content' ); |
| 65 | | |
| 66 | | bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) ); |
| 67 | | } |
| 68 | | |
| 69 | | function bp_core_screen_general_settings_title() { |
| 70 | | _e( 'General Settings', 'buddypress' ); |
| 71 | | } |
| 72 | | |
| 73 | | function bp_core_screen_general_settings_content() { |
| 74 | | global $bp, $current_user, $bp_settings_updated, $pass_error; ?> |
| 75 | | |
| 76 | | <?php if ( $bp_settings_updated && !$pass_error ) { ?> |
| 77 | | <div id="message" class="updated fade"> |
| 78 | | <p><?php _e( 'Changes Saved.', 'buddypress' ) ?></p> |
| 79 | | </div> |
| 80 | | <?php } ?> |
| 81 | | |
| 82 | | <?php if ( $pass_error && !$bp_settings_updated ) { ?> |
| 83 | | <div id="message" class="error fade"> |
| 84 | | <p><?php _e( 'Your passwords did not match', 'buddypress' ) ?></p> |
| 85 | | </div> |
| 86 | | <?php } ?> |
| 87 | | |
| 88 | | <form action="<?php echo $bp->loggedin_user->domain . BP_SETTINGS_SLUG . '/general' ?>" method="post" class="standard-form" id="settings-form"> |
| 89 | | <label for="email"><?php _e( 'Account Email', 'buddypress' ) ?></label> |
| 90 | | <input type="text" name="email" id="email" value="<?php echo attribute_escape( $current_user->user_email ); ?>" class="settings-input" /> |
| 91 | | |
| 92 | | <label for="pass1"><?php _e( 'Change Password <span>(leave blank for no change)</span>', 'buddypress' ) ?></label> |
| 93 | | <input type="password" name="pass1" id="pass1" size="16" value="" class="settings-input small" /> <?php _e( 'New Password', 'buddypress' ) ?><br /> |
| 94 | | <input type="password" name="pass2" id="pass2" size="16" value="" class="settings-input small" /> <?php _e( 'Repeat New Password', 'buddypress' ) ?> |
| 95 | | |
| 96 | | <div class="submit"> |
| 97 | | <input type="submit" name="submit" value="<?php _e( 'Save Changes', 'buddypress' ) ?>" id="submit" class="auto" /> |
| 98 | | </div> |
| 99 | | |
| 100 | | <?php wp_nonce_field('bp_settings_general') ?> |
| 101 | | </form> |
| 102 | | <?php |
| 103 | | } |
| 104 | | |
| 105 | | /***** NOTIFICATION SETTINGS ******/ |
| 106 | | |
| 107 | | function bp_core_screen_notification_settings() { |
| 108 | | global $current_user, $bp_settings_updated; |
| 109 | | |
| 110 | | $bp_settings_updated = false; |
| 111 | | |
| 112 | | if ( $_POST['submit'] ) { |
| 113 | | check_admin_referer('bp_settings_notifications'); |
| 114 | | |
| 115 | | if ( $_POST['notifications'] ) { |
| 116 | | foreach ( (array)$_POST['notifications'] as $key => $value ) { |
| 117 | | update_usermeta( (int)$current_user->id, $key, $value ); |
| 118 | | } |
| 119 | | } |
| 120 | | |
| 121 | | $bp_settings_updated = true; |
| 122 | | } |
| 123 | | |
| 124 | | add_action( 'bp_template_title', 'bp_core_screen_notification_settings_title' ); |
| 125 | | add_action( 'bp_template_content', 'bp_core_screen_notification_settings_content' ); |
| 126 | | |
| 127 | | bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) ); |
| 128 | | } |
| 129 | | |
| 130 | | function bp_core_screen_notification_settings_title() { |
| 131 | | _e( 'Notification Settings', 'buddypress' ); |
| 132 | | } |
| 133 | | |
| 134 | | function bp_core_screen_notification_settings_content() { |
| 135 | | global $bp, $current_user, $bp_settings_updated; ?> |
| 136 | | |
| 137 | | <?php if ( $bp_settings_updated ) { ?> |
| 138 | | <div id="message" class="updated fade"> |
| 139 | | <p><?php _e( 'Changes Saved.', 'buddypress' ) ?></p> |
| 140 | | </div> |
| 141 | | <?php } ?> |
| 142 | | |
| 143 | | <form action="<?php echo $bp->loggedin_user->domain . BP_SETTINGS_SLUG . '/notifications' ?>" method="post" id="settings-form"> |
| 144 | | <h3><?php _e( 'Email Notifications', 'buddypress' ) ?></h3> |
| 145 | | <p><?php _e( 'Send a notification by email when:', 'buddypress' ) ?></p> |
| 146 | | |
| 147 | | <?php do_action( 'bp_notification_settings' ) ?> |
| 148 | | |
| 149 | | <div class="submit"> |
| 150 | | <input type="submit" name="submit" value="<?php _e( 'Save Changes', 'buddypress' ) ?>" id="submit" class="auto" /> |
| 151 | | </div> |
| 152 | | |
| 153 | | <?php wp_nonce_field('bp_settings_notifications') ?> |
| 154 | | |
| 155 | | </form> |
| 156 | | <?php |
| 157 | | } |
| 158 | | |
| 159 | | /**** DELETE ACCOUNT ****/ |
| 160 | | |
| 161 | | function bp_core_screen_delete_account() { |
| 162 | | if ( isset( $_POST['delete-account-understand'] ) ) { |
| 163 | | check_admin_referer( 'delete-account' ); |
| 164 | | |
| 165 | | // delete the users account |
| 166 | | if ( bp_core_delete_account() ) |
| 167 | | bp_core_redirect( site_url() ); |
| 168 | | } |
| 169 | | |
| 170 | | add_action( 'bp_template_title', 'bp_core_screen_delete_account_title' ); |
| 171 | | add_action( 'bp_template_content', 'bp_core_screen_delete_account_content' ); |
| 172 | | |
| 173 | | bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) ); |
| 174 | | } |
| 175 | | |
| 176 | | function bp_core_screen_delete_account_title() { |
| 177 | | _e( 'Delete Account', 'buddypress' ); |
| 178 | | } |
| 179 | | |
| 180 | | function bp_core_screen_delete_account_content() { |
| 181 | | global $bp, $current_user, $bp_settings_updated, $pass_error; ?> |
| 182 | | |
| 183 | | <form action="<?php echo $bp->loggedin_user->domain . BP_SETTINGS_SLUG . '/delete-account'; ?>" name="account-delete-form" id="account-delete-form" class="standard-form" method="post"> |
| 184 | | |
| 185 | | <div id="message" class="info"> |
| 186 | | <p><?php _e( 'WARNING: Deleting your account will completely remove ALL content associated with it. There is no way back, please be careful with this option.', 'buddypress' ); ?></p> |
| 187 | | </div> |
| 188 | | |
| 189 | | <input type="checkbox" name="delete-account-understand" id="delete-account-understand" value="1" onclick="if(this.checked) { document.getElementById('delete-account-button').disabled = ''; } else { document.getElementById('delete-account-button').disabled = 'disabled'; }" /> <?php _e( 'I understand the consequences of deleting my account.', 'buddypress' ); ?> |
| 190 | | |
| 191 | | <div class="submit"> |
| 192 | | <input type="submit" disabled="disabled" value="<?php _e( 'Delete My Account', 'buddypress' ) ?> →" id="delete-account-button" name="delete-account-button" /> |
| 193 | | </div> |
| 194 | | |
| 195 | | <?php wp_nonce_field('delete-account') ?> |
| 196 | | </form> |
| 197 | | <?php |
| 198 | | } |
| | 1 | <?php |
| | 2 | |
| | 3 | if ( !defined( 'BP_SETTINGS_SLUG' ) ) |
| | 4 | define( 'BP_SETTINGS_SLUG', 'settings' ); |
| | 5 | |
| | 6 | function bp_core_add_settings_nav() { |
| | 7 | global $bp; |
| | 8 | |
| | 9 | /* Set up settings as a sudo-component for identification and nav selection */ |
| | 10 | $bp->settings->id = 'settings'; |
| | 11 | $bp->settings->slug = BP_SETTINGS_SLUG; |
| | 12 | |
| | 13 | /* Register this in the active components array */ |
| | 14 | $bp->active_components[$bp->settings->slug] = $bp->settings->id; |
| | 15 | |
| | 16 | /* Add the settings navigation item */ |
| | 17 | bp_core_new_nav_item( array( 'name' => __('Settings', 'buddypress'), 'slug' => $bp->settings->slug, 'position' => 100, 'show_for_displayed_user' => false, 'screen_function' => 'bp_core_screen_general_settings', 'default_subnav_slug' => 'general' ) ); |
| | 18 | |
| | 19 | $settings_link = $bp->loggedin_user->domain . $bp->settings->slug . '/'; |
| | 20 | |
| | 21 | bp_core_new_subnav_item( array( 'name' => __( 'General', 'buddypress' ), 'slug' => 'general', 'parent_url' => $settings_link, 'parent_slug' => $bp->settings->slug, 'screen_function' => 'bp_core_screen_general_settings', 'position' => 10, 'user_has_access' => bp_is_my_profile() ) ); |
| | 22 | bp_core_new_subnav_item( array( 'name' => __( 'Notifications', 'buddypress' ), 'slug' => 'notifications', 'parent_url' => $settings_link, 'parent_slug' => $bp->settings->slug, 'screen_function' => 'bp_core_screen_notification_settings', 'position' => 20, 'user_has_access' => bp_is_my_profile() ) ); |
| | 23 | |
| | 24 | if ( !is_site_admin() && !(int) $bp->site_options['bp-disable-account-deletion'] ) |
| | 25 | bp_core_new_subnav_item( array( 'name' => __( 'Delete Account', 'buddypress' ), 'slug' => 'delete-account', 'parent_url' => $settings_link, 'parent_slug' => $bp->settings->slug, 'screen_function' => 'bp_core_screen_delete_account', 'position' => 90, 'user_has_access' => bp_is_my_profile() ) ); |
| | 26 | } |
| | 27 | add_action( 'wp', 'bp_core_add_settings_nav', 2 ); |
| | 28 | add_action( 'admin_menu', 'bp_core_add_settings_nav', 2 ); |
| | 29 | |
| | 30 | /**** GENERAL SETTINGS ****/ |
| | 31 | |
| | 32 | function bp_core_screen_general_settings() { |
| | 33 | global $current_user, $bp_settings_updated, $pass_error; |
| | 34 | |
| | 35 | $bp_settings_updated = false; |
| | 36 | $pass_error = false; |
| | 37 | $email_error = false; |
| | 38 | $pwd_error = false; |
| | 39 | |
| | 40 | if ( isset($_POST['submit']) ) { |
| | 41 | check_admin_referer('bp_settings_general'); |
| | 42 | |
| | 43 | require_once( WPINC . '/registration.php' ); |
| | 44 | |
| | 45 | // Form has been submitted and nonce checks out, lets do it. |
| | 46 | |
| | 47 | //we want to validate the user again for the current password when making a big change |
| | 48 | if ( !empty( $_POST['pwd'] ) && $_POST['pwd'] != '' && wp_check_password($_POST['pwd'], $current_user->user_pass, $current_user->ID) ) { |
| | 49 | |
| | 50 | //need to make sure changing an email address does not already exist |
| | 51 | if ( $_POST['email'] != '' ) { |
| | 52 | |
| | 53 | //what is missing from the profile page vs signup - lets double check the goodies |
| | 54 | $user_email = sanitize_email( wp_specialchars( trim( $_POST['email'] ) ) ); |
| | 55 | |
| | 56 | if ( !is_email( $user_email ) ) |
| | 57 | $email_error = true; |
| | 58 | |
| | 59 | $limited_email_domains = get_site_option( 'limited_email_domains', 'buddypress' ); |
| | 60 | |
| | 61 | if ( is_array( $limited_email_domains ) && empty( $limited_email_domains ) == false ) { |
| | 62 | $emaildomain = substr( $user_email, 1 + strpos( $user_email, '@' ) ); |
| | 63 | |
| | 64 | if ( in_array( $emaildomain, (array)$limited_email_domains ) == false ) |
| | 65 | $email_error = true; |
| | 66 | } |
| | 67 | |
| | 68 | if ( !$email_error && $current_user->user_email != $user_email ) { |
| | 69 | |
| | 70 | //we don't want email dups in the system |
| | 71 | if ( email_exists( $user_email ) ) |
| | 72 | $email_error = true; |
| | 73 | |
| | 74 | if (!$email_error) |
| | 75 | $current_user->user_email = $user_email; |
| | 76 | } |
| | 77 | } |
| | 78 | |
| | 79 | if ( $_POST['pass1'] != '' && $_POST['pass2'] != '' ) { |
| | 80 | |
| | 81 | if ( $_POST['pass1'] == $_POST['pass2'] && !strpos( " " . $_POST['pass1'], "\\" ) ) |
| | 82 | $current_user->user_pass = $_POST['pass1']; |
| | 83 | else |
| | 84 | $pass_error = true; |
| | 85 | |
| | 86 | } else if ( empty( $_POST['pass1'] ) && !empty( $_POST['pass2'] ) || !empty( $_POST['pass1'] ) && empty( $_POST['pass2'] ) ) { |
| | 87 | $pass_error = true; |
| | 88 | } else { |
| | 89 | unset( $current_user->user_pass ); |
| | 90 | } |
| | 91 | |
| | 92 | if ( !$email_error && !$pass_error && wp_update_user( get_object_vars( $current_user ) ) ) |
| | 93 | $bp_settings_updated = true; |
| | 94 | |
| | 95 | } else { |
| | 96 | $pwd_error = true; |
| | 97 | } |
| | 98 | |
| | 99 | } |
| | 100 | |
| | 101 | add_action( 'bp_template_title', 'bp_core_screen_general_settings_title' ); |
| | 102 | add_action( 'bp_template_content', 'bp_core_screen_general_settings_content' ); |
| | 103 | |
| | 104 | bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) ); |
| | 105 | } |
| | 106 | |
| | 107 | function bp_core_screen_general_settings_title() { |
| | 108 | _e( 'General Settings', 'buddypress' ); |
| | 109 | } |
| | 110 | |
| | 111 | function bp_core_screen_general_settings_content() { |
| | 112 | global $bp, $current_user, $bp_settings_updated, $pass_error, $pwd_error, $email_error; ?> |
| | 113 | |
| | 114 | <?php if ( $bp_settings_updated && !$pass_error ) { ?> |
| | 115 | <div id="message" class="updated fade"> |
| | 116 | <p><?php _e( 'Changes Saved.', 'buddypress' ) ?></p> |
| | 117 | </div> |
| | 118 | <?php } ?> |
| | 119 | |
| | 120 | <?php if ( $pass_error && !$bp_settings_updated ) { ?> |
| | 121 | <div id="message" class="error fade"> |
| | 122 | <p><?php _e( 'Your passwords did not match', 'buddypress' ) ?></p> |
| | 123 | </div> |
| | 124 | <?php } ?> |
| | 125 | |
| | 126 | <?php if ( $pwd_error && !$bp_settings_updated ) { ?> |
| | 127 | <div id="message" class="error fade"> |
| | 128 | <p><?php _e( 'Your password is incorrect', 'buddypress' ) ?></p> |
| | 129 | </div> |
| | 130 | <?php } ?> |
| | 131 | |
| | 132 | <?php |
| | 133 | if ( $email_error && !$bp_settings_updated ) { ?> |
| | 134 | <div id="message" class="error fade"> |
| | 135 | <p><?php _e( 'Sorry, that email address is already used or is invalid', 'buddypress' ) ?></p> |
| | 136 | </div> |
| | 137 | <?php } ?> |
| | 138 | |
| | 139 | |
| | 140 | <form action="<?php echo $bp->loggedin_user->domain . BP_SETTINGS_SLUG . '/general' ?>" method="post" class="standard-form" id="settings-form"> |
| | 141 | |
| | 142 | <label for="pwd"><?php _e( 'Current Password <span>(required to update email or change current password)</span>', 'buddypress' ) ?></label> |
| | 143 | <input type="password" name="pwd" id="pwd" size="16" value="" class="settings-input small" /> <?php _e( 'Current Password', 'buddypress' ) ?><br /> |
| | 144 | <a href="<?php echo site_url('wp-login.php?action=lostpassword', 'login') ?>" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a><br/> |
| | 145 | |
| | 146 | <label for="email"><?php _e( 'Account Email', 'buddypress' ) ?></label> |
| | 147 | <input type="text" name="email" id="email" value="<?php echo attribute_escape( $current_user->user_email ); ?>" class="settings-input" /> |
| | 148 | |
| | 149 | <label for="pass1"><?php _e( 'Change Password <span>(leave blank for no change)</span>', 'buddypress' ) ?></label> |
| | 150 | <input type="password" name="pass1" id="pass1" size="16" value="" class="settings-input small" /> <?php _e( 'New Password', 'buddypress' ) ?><br /> |
| | 151 | <input type="password" name="pass2" id="pass2" size="16" value="" class="settings-input small" /> <?php _e( 'Repeat New Password', 'buddypress' ) ?> |
| | 152 | |
| | 153 | <div class="submit"> |
| | 154 | <input type="submit" name="submit" value="<?php _e( 'Save Changes', 'buddypress' ) ?>" id="submit" class="auto" /> |
| | 155 | </div> |
| | 156 | |
| | 157 | <?php wp_nonce_field('bp_settings_general') ?> |
| | 158 | </form> |
| | 159 | <?php |
| | 160 | } |
| | 161 | |
| | 162 | /***** NOTIFICATION SETTINGS ******/ |
| | 163 | |
| | 164 | function bp_core_screen_notification_settings() { |
| | 165 | global $current_user, $bp_settings_updated; |
| | 166 | |
| | 167 | $bp_settings_updated = false; |
| | 168 | |
| | 169 | if ( $_POST['submit'] ) { |
| | 170 | check_admin_referer('bp_settings_notifications'); |
| | 171 | |
| | 172 | if ( $_POST['notifications'] ) { |
| | 173 | foreach ( (array)$_POST['notifications'] as $key => $value ) { |
| | 174 | update_usermeta( (int)$current_user->id, $key, $value ); |
| | 175 | } |
| | 176 | } |
| | 177 | |
| | 178 | $bp_settings_updated = true; |
| | 179 | } |
| | 180 | |
| | 181 | add_action( 'bp_template_title', 'bp_core_screen_notification_settings_title' ); |
| | 182 | add_action( 'bp_template_content', 'bp_core_screen_notification_settings_content' ); |
| | 183 | |
| | 184 | bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) ); |
| | 185 | } |
| | 186 | |
| | 187 | function bp_core_screen_notification_settings_title() { |
| | 188 | _e( 'Notification Settings', 'buddypress' ); |
| | 189 | } |
| | 190 | |
| | 191 | function bp_core_screen_notification_settings_content() { |
| | 192 | global $bp, $current_user, $bp_settings_updated; ?> |
| | 193 | |
| | 194 | <?php if ( $bp_settings_updated ) { ?> |
| | 195 | <div id="message" class="updated fade"> |
| | 196 | <p><?php _e( 'Changes Saved.', 'buddypress' ) ?></p> |
| | 197 | </div> |
| | 198 | <?php } ?> |
| | 199 | |
| | 200 | <form action="<?php echo $bp->loggedin_user->domain . BP_SETTINGS_SLUG . '/notifications' ?>" method="post" id="settings-form"> |
| | 201 | <h3><?php _e( 'Email Notifications', 'buddypress' ) ?></h3> |
| | 202 | <p><?php _e( 'Send a notification by email when:', 'buddypress' ) ?></p> |
| | 203 | |
| | 204 | <?php do_action( 'bp_notification_settings' ) ?> |
| | 205 | |
| | 206 | <div class="submit"> |
| | 207 | <input type="submit" name="submit" value="<?php _e( 'Save Changes', 'buddypress' ) ?>" id="submit" class="auto" /> |
| | 208 | </div> |
| | 209 | |
| | 210 | <?php wp_nonce_field('bp_settings_notifications') ?> |
| | 211 | |
| | 212 | </form> |
| | 213 | <?php |
| | 214 | } |
| | 215 | |
| | 216 | /**** DELETE ACCOUNT ****/ |
| | 217 | |
| | 218 | function bp_core_screen_delete_account() { |
| | 219 | if ( isset( $_POST['delete-account-understand'] ) ) { |
| | 220 | check_admin_referer( 'delete-account' ); |
| | 221 | |
| | 222 | // delete the users account |
| | 223 | if ( bp_core_delete_account() ) |
| | 224 | bp_core_redirect( site_url() ); |
| | 225 | } |
| | 226 | |
| | 227 | add_action( 'bp_template_title', 'bp_core_screen_delete_account_title' ); |
| | 228 | add_action( 'bp_template_content', 'bp_core_screen_delete_account_content' ); |
| | 229 | |
| | 230 | bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) ); |
| | 231 | } |
| | 232 | |
| | 233 | function bp_core_screen_delete_account_title() { |
| | 234 | _e( 'Delete Account', 'buddypress' ); |
| | 235 | } |
| | 236 | |
| | 237 | function bp_core_screen_delete_account_content() { |
| | 238 | global $bp, $current_user, $bp_settings_updated, $pass_error; ?> |
| | 239 | |
| | 240 | <form action="<?php echo $bp->loggedin_user->domain . BP_SETTINGS_SLUG . '/delete-account'; ?>" name="account-delete-form" id="account-delete-form" class="standard-form" method="post"> |
| | 241 | |
| | 242 | <div id="message" class="info"> |
| | 243 | <p><?php _e( 'WARNING: Deleting your account will completely remove ALL content associated with it. There is no way back, please be careful with this option.', 'buddypress' ); ?></p> |
| | 244 | </div> |
| | 245 | |
| | 246 | <input type="checkbox" name="delete-account-understand" id="delete-account-understand" value="1" onclick="if(this.checked) { document.getElementById('delete-account-button').disabled = ''; } else { document.getElementById('delete-account-button').disabled = 'disabled'; }" /> <?php _e( 'I understand the consequences of deleting my account.', 'buddypress' ); ?> |
| | 247 | |
| | 248 | <div class="submit"> |
| | 249 | <input type="submit" disabled="disabled" value="<?php _e( 'Delete My Account', 'buddypress' ) ?> →" id="delete-account-button" name="delete-account-button" /> |
| | 250 | </div> |
| | 251 | |
| | 252 | <?php wp_nonce_field('delete-account') ?> |
| | 253 | </form> |
| | 254 | <?php |
| | 255 | } |