Changeset 2077 for trunk/bp-core/bp-core-settings.php
- Timestamp:
- 11/02/2009 07:54:21 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/bp-core/bp-core-settings.php (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-settings.php
r2059 r2077 3 3 if ( !defined( 'BP_SETTINGS_SLUG' ) ) 4 4 define( 'BP_SETTINGS_SLUG', 'settings' ); 5 5 6 6 function bp_core_add_settings_nav() { 7 7 global $bp; 8 8 9 9 /* Set up settings as a sudo-component for identification and nav selection */ 10 10 $bp->settings->id = 'settings'; 11 11 $bp->settings->slug = BP_SETTINGS_SLUG; 12 12 13 13 /* Register this in the active components array */ 14 14 $bp->active_components[$bp->settings->slug] = $bp->settings->id; … … 18 18 19 19 $settings_link = $bp->loggedin_user->domain . 'settings/'; 20 20 21 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_home() ) ); 22 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_home() ) ); 23 23 24 24 if ( !is_site_admin() && !(int) get_site_option( 'bp-disable-account-deletion' ) ) 25 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_home() ) ); … … 32 32 function bp_core_screen_general_settings() { 33 33 global $current_user, $bp_settings_updated, $pass_error; 34 34 35 35 $bp_settings_updated = false; 36 36 $pass_error = false; 37 37 38 38 if ( isset($_POST['submit']) ) { 39 39 check_admin_referer('bp_settings_general'); 40 40 41 41 require_once( WPINC . '/registration.php' ); 42 42 43 43 // Form has been submitted and nonce checks out, lets do it. 44 44 45 45 if ( $_POST['email'] != '' ) 46 46 $current_user->user_email = wp_specialchars( trim( $_POST['email'] ) ); … … 56 56 unset( $current_user->user_pass ); 57 57 } 58 58 59 59 if ( !$pass_error && wp_update_user( get_object_vars( $current_user ) ) ) 60 60 $bp_settings_updated = true; 61 61 } 62 62 63 63 add_action( 'bp_template_title', 'bp_core_screen_general_settings_title' ); 64 64 add_action( 'bp_template_content', 'bp_core_screen_general_settings_content' ); 65 65 66 66 bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'plugin-template' ) ); 67 67 } … … 79 79 </div> 80 80 <?php } ?> 81 81 82 82 <?php if ( $pass_error && !$bp_settings_updated ) { ?> 83 83 <div id="message" class="error fade"> 84 84 <p><?php _e( 'Your passwords did not match', 'buddypress' ) ?></p> 85 </div> 85 </div> 86 86 <?php } ?> 87 87 … … 89 89 <label for="email"><?php _e( 'Account Email', 'buddypress' ) ?></label> 90 90 <input type="text" name="email" id="email" value="<?php echo attribute_escape( $current_user->user_email ); ?>" class="settings-input" /> 91 91 92 92 <label for="pass1"><?php _e( 'Change Password <span>(leave blank for no change)</span>', 'buddypress' ) ?></label> 93 93 <input type="password" name="pass1" id="pass1" size="16" value="" class="settings-input small" /> <?php _e( 'New Password', 'buddypress' ) ?><br /> 94 94 <input type="password" name="pass2" id="pass2" size="16" value="" class="settings-input small" /> <?php _e( 'Repeat New Password', 'buddypress' ) ?> 95 95 96 96 <p class="submit"><input type="submit" name="submit" value="<?php _e( 'Save Changes', 'buddypress' ) ?>" id="submit" class="auto"/></p> 97 97 <?php wp_nonce_field('bp_settings_general') ?> … … 104 104 function bp_core_screen_notification_settings() { 105 105 global $current_user, $bp_settings_updated; 106 106 107 107 $bp_settings_updated = false; 108 108 109 109 if ( $_POST['submit'] ) { 110 110 check_admin_referer('bp_settings_notifications'); 111 111 112 112 if ( $_POST['notifications'] ) { 113 113 foreach ( $_POST['notifications'] as $key => $value ) { … … 115 115 } 116 116 } 117 117 118 118 $bp_settings_updated = true; 119 119 } 120 120 121 121 add_action( 'bp_template_title', 'bp_core_screen_notification_settings_title' ); 122 122 add_action( 'bp_template_content', 'bp_core_screen_notification_settings_content' ); 123 123 124 124 bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'plugin-template' ) ); 125 125 } … … 137 137 </div> 138 138 <?php } ?> 139 139 140 140 <form action="<?php echo $bp->loggedin_user->domain . 'settings/notifications' ?>" method="post" id="settings-form"> 141 141 <h3><?php _e( 'Email Notifications', 'buddypress' ) ?></h3> 142 142 <p><?php _e( 'Send a notification by email when:', 'buddypress' ) ?></p> 143 143 144 144 <?php do_action( 'bp_notification_settings' ) ?> 145 146 <p class="submit"><input type="submit" name="submit" value="<?php _e( 'Save Changes', 'buddypress' ) ?>" id="submit" class="auto"/></p> 147 145 146 <p class="submit"><input type="submit" name="submit" value="<?php _e( 'Save Changes', 'buddypress' ) ?>" id="submit" class="auto"/></p> 147 148 148 <?php wp_nonce_field('bp_settings_notifications') ?> 149 149 150 150 </form> 151 151 <?php … … 154 154 /**** DELETE ACCOUNT ****/ 155 155 156 function bp_core_screen_delete_account() { 156 function bp_core_screen_delete_account() { 157 157 if ( isset( $_POST['delete-account-understand'] ) ) { 158 158 check_admin_referer( 'delete-account' ); … … 162 162 bp_core_redirect( site_url() ); 163 163 } 164 165 164 add_action( 'bp_template_title', 'bp_core_screen_delete_account_title' ); 166 165 add_action( 'bp_template_content', 'bp_core_screen_delete_account_content' ); 167 166 168 167 bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'plugin-template' ) ); 169 168 } … … 177 176 178 177 <form action="<?php echo $bp->loggedin_user->domain . 'settings/delete-account'; ?>" name="account-delete-form" id="account-delete-form" class="standard-form" method="post"> 179 178 180 179 <div id="message" class="info"> 181 180 <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> 182 181 </div> 183 182 184 183 <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' ); ?> 185 184 <p><input type="submit" disabled="disabled" value="<?php _e( 'Delete My Account', 'buddypress' ) ?> »" id="delete-account-button" name="delete-account-button" /></p>
Note: See TracChangeset
for help on using the changeset viewer.