Changeset 5829
- Timestamp:
- 02/23/2012 06:18:39 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-members/bp-members-actions.php
r5803 r5829 56 56 } 57 57 } 58 add_action( 'bp_actions', 'bp_core_action_set_spammer_status' ); 58 // Unhooked in BuddyPress (1.6) - moved to settings 59 //add_action( 'bp_actions', 'bp_core_action_set_spammer_status' ); 59 60 60 61 /** … … 91 92 } 92 93 } 93 add_action( 'bp_actions', 'bp_core_action_delete_user' ); 94 // Unhooked in BuddyPress (1.6) - moved to settings 95 //add_action( 'bp_actions', 'bp_core_action_delete_user' ); 94 96 95 97 /** -
trunk/bp-members/bp-members-adminbar.php
r5704 r5829 110 110 111 111 // User Admin > Spam/unspam 112 if ( !bp_is_user_spammer( bp_displayed_user_id() ) ) { 113 $wp_admin_bar->add_menu( array( 114 'parent' => $bp->user_admin_menu_id, 115 'id' => $bp->user_admin_menu_id . '-spam-user', 116 'title' => __( 'Mark as Spammer', 'buddypress' ), 117 'href' => wp_nonce_url( bp_displayed_user_domain() . 'admin/mark-spammer/', 'mark-unmark-spammer' ), 118 'meta' => array( 'onclick' => 'confirm(" ' . __( 'Are you sure you want to mark this user as a spammer?', 'buddypress' ) . '");' ) 119 ) ); 120 } else { 121 $wp_admin_bar->add_menu( array( 122 'parent' => $bp->user_admin_menu_id, 123 'id' => $bp->user_admin_menu_id . '-unspam-user', 124 'title' => __( 'Not a Spammer', 'buddypress' ), 125 'href' => wp_nonce_url( bp_displayed_user_domain() . 'admin/unmark-spammer/', 'mark-unmark-spammer' ), 126 'meta' => array( 'onclick' => 'confirm(" ' . __( 'Are you sure you want to mark this user as not a spammer?', 'buddypress' ) . '");' ) 127 ) ); 128 } 112 $wp_admin_bar->add_menu( array( 113 'parent' => $bp->user_admin_menu_id, 114 'id' => $bp->user_admin_menu_id . '-user-capabilities', 115 'title' => __( 'User Capabilities', 'buddypress' ), 116 'href' => bp_displayed_user_domain() . 'settings/capabilities/' 117 ) ); 129 118 130 119 // User Admin > Delete Account … … 133 122 'id' => $bp->user_admin_menu_id . '-delete-user', 134 123 'title' => __( 'Delete Account', 'buddypress' ), 135 'href' => wp_nonce_url( bp_displayed_user_domain() . 'admin/delete-user/', 'delete-user' ), 136 'meta' => array( 'onclick' => 'confirm(" ' . __( "Are you sure you want to delete this user's account?", 'buddypress' ) . '");' ) 124 'href' => bp_displayed_user_domain() . 'settings/delete-account/' 137 125 ) ); 138 126 } -
trunk/bp-members/bp-members-functions.php
r5803 r5829 489 489 * Processes a spammed or unspammed user 490 490 * 491 * This function is called in t woways:492 * - in bp_ core_action_set_spammer_status() (when spammingfrom the front-end)493 * - by bp_core_mark_user_spam_admin() or bp_core_mark_user_ham_admin() (when spamming from the494 * Dashboard)495 * 496 * @since 1.6491 * This function is called in three ways: 492 * - in bp_settings_action_capabilities() (from the front-end) 493 * - by bp_core_mark_user_spam_admin() (from wp-admin) 494 * - bp_core_mark_user_ham_admin() (from wp-admin) 495 * 496 * @since BuddyPress (1.6) 497 497 * 498 498 * @param int $user_id The user being spammed/hammed … … 519 519 } 520 520 521 $is_spam = 'spam' == $status;521 $is_spam = ( 'spam' == $status ); 522 522 523 523 // Only you can prevent infinite loops 524 524 remove_action( 'make_spam_user', 'bp_core_mark_user_spam_admin' ); 525 remove_action( 'make_ham_user', 'bp_core_mark_user_ham_admin');525 remove_action( 'make_ham_user', 'bp_core_mark_user_ham_admin' ); 526 526 527 527 // When marking as spam in the Dashboard, these actions are handled by WordPress 528 528 if ( !is_admin() ) { 529 529 530 // Get the blogs for the user 530 531 $blogs = get_blogs_of_user( $user_id, true ); … … 551 552 // Call multisite actions in single site mode for good measure 552 553 if ( !is_multisite() ) { 553 $wp_action = $is_spam? 'make_spam_user' : 'make_ham_user';554 $wp_action = ( true === $is_spam ) ? 'make_spam_user' : 'make_ham_user'; 554 555 do_action( $wp_action, bp_displayed_user_id() ); 555 556 } … … 557 558 558 559 // Hide this user's activity 559 if ( $is_spam&& bp_is_active( 'activity' ) ) {560 if ( ( true === $is_spam ) && bp_is_active( 'activity' ) ) { 560 561 bp_activity_hide_user_activity( $user_id ); 561 562 } 562 563 563 564 // We need a special hook for is_spam so that components can delete data at spam time 564 $bp_action = $is_spam? 'bp_make_spam_user' : 'bp_make_ham_user';565 $bp_action = ( true === $is_spam ) ? 'bp_make_spam_user' : 'bp_make_ham_user'; 565 566 do_action( $bp_action, $user_id ); 566 567 … … 574 575 * Hook to WP's make_spam_user and run our custom BP spam functions 575 576 * 576 * @since 1.6577 * @since BuddyPress (1.6) 577 578 * 578 579 * @param int $user_id The user id passed from the make_spam_user hook … … 586 587 * Hook to WP's make_ham_user and run our custom BP spam functions 587 588 * 588 * @since 1.6589 * @since BuddyPress (1.6) 589 590 * 590 591 * @param int $user_id The user id passed from the make_ham_user hook … … 751 752 * 752 753 * @package BuddyPress Core 753 * @global object $bp Global BuddyPress settings object754 * @uses bp_current_user_can() Checks to see if the user is a site administrator.755 754 * @uses wpmu_delete_user() Deletes a user from the system on multisite installs. 756 755 * @uses wp_delete_user() Deletes a user from the system on singlesite installs. 757 756 */ 758 757 function bp_core_delete_account( $user_id = 0 ) { 759 global $bp, $wp_version; 760 761 if ( !$user_id ) 758 759 if ( empty( $user_id ) ) 762 760 $user_id = bp_loggedin_user_id(); 763 761 764 762 // Make sure account deletion is not disabled 765 if ( !empty( $bp->site_options['bp-disable-account-deletion'] ) && !bp_current_user_can( 'bp_moderate') )763 if ( bp_disable_account_deletion() ) 766 764 return false; 767 765 … … 772 770 // Specifically handle multi-site environment 773 771 if ( is_multisite() ) { 774 if ( $wp_version >= '3.0' ) 775 require( ABSPATH . '/wp-admin/includes/ms.php' ); 776 else 777 require( ABSPATH . '/wp-admin/includes/mu.php' ); 778 772 require( ABSPATH . '/wp-admin/includes/ms.php' ); 779 773 require( ABSPATH . '/wp-admin/includes/user.php' ); 780 774 -
trunk/bp-settings/bp-settings-actions.php
r5785 r5829 12 12 if ( !defined( 'ABSPATH' ) ) exit; 13 13 14 /** General *******************************************************************/ 15 16 function bp_core_screen_general_settings() { 14 /** 15 * Handles the changing and saving of user email addressos and passwords 16 * 17 * We do quite a bit of logic and error handling here to make sure that users 18 * do not accidentally lock themselves out of their accounts. We also try to 19 * provide as accurate of feedback as possible without exposing anyone else's 20 * inforation to them. 21 * 22 * Special considerations are made for super admins that are able to edit any 23 * users accounts already, without knowing their existing password. 24 * 25 * @global BuddyPress $bp 26 * @return If no reason to proceed 27 */ 28 function bp_settings_action_general() { 17 29 global $bp; 18 30 31 // Bail if not a POST action 32 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 33 return; 34 35 // Bail if not in settings 36 if ( ! bp_is_settings_component() || ! bp_is_current_action( 'general' ) ) 37 return; 38 39 // 404 if there are any additional action variables attached 19 40 if ( bp_action_variables() ) { 20 41 bp_do_404(); … … 22 43 } 23 44 24 // Setup private variables 25 $bp_settings_updated = $pass_error = $email_error = $pwd_error = false; 45 // Define local defaults 46 $email_error = false; // invalid|blocked|taken|empty|nochange 47 $pass_error = false; // invalid|mismatch|empty|nochange 48 $pass_changed = false; // true if the user changes their password 49 $feedback_type = 'error'; // success|error 50 $feedback = array(); // array of strings for feedback 51 52 /** Handle Form ***********************************************************/ 26 53 27 54 if ( isset( $_POST['submit'] ) ) { … … 31 58 32 59 // Validate the user again for the current password when making a big change 33 if ( bp_current_user_can( 'bp_moderate' ) || ( !empty( $_POST['pwd'] ) && $_POST['pwd'] != ''&& wp_check_password( $_POST['pwd'], $bp->displayed_user->userdata->user_pass, bp_displayed_user_id() ) ) ) {60 if ( ( is_super_admin() ) || ( !empty( $_POST['pwd'] ) && wp_check_password( $_POST['pwd'], $bp->displayed_user->userdata->user_pass, bp_displayed_user_id() ) ) ) { 34 61 35 62 $update_user = get_userdata( bp_displayed_user_id() ); 36 63 37 // Make sure changing an email address does not already exist 38 if ( $_POST['email'] != '' ) { 64 /** Email Change Attempt ******************************************/ 65 66 if ( !empty( $_POST['email'] ) ) { 39 67 40 68 // What is missing from the profile page vs signup - lets double check the goodies 41 69 $user_email = sanitize_email( esc_html( trim( $_POST['email'] ) ) ); 42 70 43 // Is email valid 44 if ( !is_email( $user_email ) ) 45 $email_error = true; 46 47 // Get blocked email domains 48 $limited_email_domains = get_site_option( 'limited_email_domains', 'buddypress' ); 49 50 // If blocked email domains exist, see if this is one of them 51 if ( is_array( $limited_email_domains ) && empty( $limited_email_domains ) == false ) { 52 $emaildomain = substr( $user_email, 1 + strpos( $user_email, '@' ) ); 53 54 if ( in_array( $emaildomain, (array) $limited_email_domains ) == false ) { 55 $email_error = true; 71 // Skip this if no change to email 72 if ( $bp->displayed_user->userdata->user_email != $user_email ) { 73 74 // Is email valid 75 if ( !is_email( $user_email ) ) 76 $email_error = 'invalid'; 77 78 // Get blocked email domains 79 $limited_email_domains = get_site_option( 'limited_email_domains', 'buddypress' ); 80 81 // If blocked email domains exist, see if this is one of them 82 if ( is_array( $limited_email_domains ) && empty( $limited_email_domains ) == false ) { 83 $emaildomain = substr( $user_email, 1 + strpos( $user_email, '@' ) ); 84 85 if ( in_array( $emaildomain, (array) $limited_email_domains ) == false ) { 86 $email_error = 'blocked'; 87 } 56 88 } 57 } 58 59 // No errors, and email address doesn't match 60 if ( ( false === $email_error ) && ( $bp->displayed_user->userdata->user_email != $user_email ) ) { 61 62 // We don't want email dupes in the system 63 if ( email_exists( $user_email ) ) 64 $email_error = true; 65 66 // Set updated user email to this email address 89 90 // No errors, and email address doesn't match 91 if ( ( false === $email_error ) && email_exists( $user_email ) ) { 92 $email_error = 'taken'; 93 } 94 95 // No change 96 } else { 97 $email_error = 'nochange'; 98 } 99 100 // Yay we made it! 101 if ( false === $email_error ) { 67 102 $update_user->user_email = $user_email; 68 103 } 69 } 70 71 // Password change 104 105 // Email address cannot be empty 106 } else { 107 $email_error = 'empty'; 108 } 109 110 /** Password Change Attempt ***************************************/ 111 72 112 if ( !empty( $_POST['pass1'] ) && !empty( $_POST['pass2'] ) ) { 73 113 74 114 // Password change attempt is successful 75 if ( $_POST['pass1'] == $_POST['pass2']&& !strpos( " " . $_POST['pass1'], "\\" ) ) {115 if ( ( $_POST['pass1'] == $_POST['pass2'] ) && !strpos( " " . $_POST['pass1'], "\\" ) ) { 76 116 $update_user->user_pass = $_POST['pass1']; 117 $pass_changed = true; 77 118 78 119 // Password change attempt was unsuccessful 79 120 } else { 80 $pass_error = true; 81 } 121 $pass_error = 'mismatch'; 122 } 123 124 // Both password fields were empty 125 } elseif ( empty( $_POST['pass1'] ) && empty( $_POST['pass2'] ) ) { 126 $pass_error = 'nochange'; 82 127 83 128 // One of the password boxes was left empty 84 } else if ( ( empty( $_POST['pass1'] ) && !empty( $_POST['pass2'] ) ) || ( !empty( $_POST['pass1'] ) && empty( $_POST['pass2'] ) ) ) { 85 $pass_error = true; 86 87 // Not a password change attempt so empty the user_pass 88 } else { 89 // unset( $update_user->user_pass ); // WP_User has no __unset() 90 $update_user->user_pass = null; 129 } elseif ( ( empty( $_POST['pass1'] ) && !empty( $_POST['pass2'] ) ) || ( !empty( $_POST['pass1'] ) && empty( $_POST['pass2'] ) ) ) { 130 $pass_error = 'empty'; 91 131 } 92 132 … … 95 135 if ( isset( $update_user->data ) && is_object( $update_user->data ) ) { 96 136 $update_user = $update_user->data; 137 $update_user = get_object_vars( $update_user ); 138 139 // Unset the password field to prevent it from emptying out the 140 // user's user_pass field in the database. 141 // @see wp_update_user() 142 if ( false === $pass_changed ) { 143 unset( $update_user['user_pass'] ); 144 } 97 145 } 98 146 99 147 // Make sure these changes are in $bp for the current page load 100 if ( ( false === $email_error ) && ( false === $pass_error ) && ( wp_update_user( get_object_vars( $update_user )) ) ) {148 if ( ( false === $email_error ) && ( false === $pass_error ) && ( wp_update_user( $update_user ) ) ) { 101 149 $bp->displayed_user->userdata = bp_core_get_core_userdata( bp_displayed_user_id() ); 102 $bp_settings_updated = true;103 150 } 104 151 105 152 // Password Error 106 153 } else { 107 $pwd_error = true; 108 } 109 110 // Add user feedback messages 111 if ( empty( $pass_error ) && empty( $pwd_error ) && ( empty( $email_error ) ) ) 112 bp_core_add_message( __( 'Changes saved.', 'buddypress' ), 'success' ); 113 114 elseif ( !empty( $pass_error ) ) 115 bp_core_add_message( __( 'Your new passwords did not match.', 'buddypress' ), 'error' ); 116 117 elseif ( !empty( $pwd_error ) ) 118 bp_core_add_message( __( 'Your existing password is incorrect.', 'buddypress' ), 'error' ); 119 120 elseif ( !empty( $email_error ) ) 121 bp_core_add_message( __( 'Sorry, that email address is already used or is invalid.', 'buddypress' ), 'error' ); 154 $pass_error = 'invalid'; 155 } 156 157 // Email feedback 158 switch ( $email_error ) { 159 case 'invalid' : 160 $feedback['email_invalid'] = __( 'That email address is invalid. Check the formatting and try again.', 'buddypress' ); 161 break; 162 case 'blocked' : 163 $feedback['email_blocked'] = __( 'That email address is currently unavailable for use.', 'buddypress' ); 164 break; 165 case 'taken' : 166 $feedback['email_taken'] = __( 'That email address is already taken.', 'buddypress' ); 167 break; 168 case 'empty' : 169 $feedback['email_empty'] = __( 'Email address cannot be empty.', 'buddypress' ); 170 break; 171 case 'nochange' : 172 $email_error = false; 173 break; 174 } 175 176 // Password feedback 177 switch ( $pass_error ) { 178 case 'invalid' : 179 $feedback['pass_error'] = __( 'Your current password is invalid.', 'buddypress' ); 180 break; 181 case 'mismatch' : 182 $feedback['pass_mismatch'] = __( 'The new password fields did not match.', 'buddypress' ); 183 break; 184 case 'empty' : 185 $feedback['pass_empty'] = __( 'One of the password fields was empty.', 'buddypress' ); 186 break; 187 case 'nochange' : 188 $pass_error = false; 189 break; 190 } 191 192 // No errors so show a simple success message 193 if ( ( false === $email_error ) && ( ( false == $pass_error ) && ( true === $pass_changed ) ) ) { 194 $feedback[] = __( 'Your settings have been saved.', 'buddypress' ); 195 $feedback_type = 'success'; 196 197 // Some kind of errors occurred 198 } elseif ( ( false === $email_error ) && ( ( false == $pass_error ) && ( false === $pass_changed ) ) ) { 199 if ( bp_is_my_profile() ) { 200 $feedback['nochange'] = __( 'No changes were made to your account.', 'buddypress' ); 201 } else { 202 $feedback['nochange'] = __( 'No changes were made to this account.', 'buddypress' ); 203 } 204 } 205 206 // Set the feedback 207 bp_core_add_message( implode( '</p><p>', $feedback ), $feedback_type ); 122 208 123 209 // Execute additional code 124 210 do_action( 'bp_core_general_settings_after_save' ); 125 126 bp_core_redirect( bp_displayed_user_domain() . bp_get_settings_slug() . '/general/' ); 127 } 128 129 // Load the template 130 bp_core_load_template( apply_filters( 'bp_core_screen_general_settings', 'members/single/settings/general' ) ); 211 212 // Redirect to prevent issues with browser back button 213 bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_get_settings_slug() . '/general' ) ); 214 } 131 215 } 132 133 /** Notifications *************************************************************/ 134 135 function bp_core_screen_notification_settings() { 136 216 add_action( 'bp_actions', 'bp_settings_action_general' ); 217 218 /** 219 * Handles the changing and saving of user notification settings 220 * 221 * @return If no reason to proceed 222 */ 223 function bp_settings_action_notifications() { 224 225 // Bail if not a POST action 226 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 227 return; 228 229 // Bail if not in settings 230 if ( ! bp_is_settings_component() || ! bp_is_current_action( 'notifications' ) ) 231 return false; 232 233 // 404 if there are any additional action variables attached 137 234 if ( bp_action_variables() ) { 138 235 bp_do_404(); … … 141 238 142 239 if ( isset( $_POST['submit'] ) ) { 143 check_admin_referer( 'bp_settings_notifications');240 check_admin_referer( 'bp_settings_notifications' ); 144 241 145 242 if ( isset( $_POST['notifications'] ) ) { 146 243 foreach ( (array) $_POST['notifications'] as $key => $value ) { 147 if ( $meta_key = bp_get_user_meta_key( $key ) ) 148 bp_update_user_meta( (int)bp_displayed_user_id(), $meta_key, $value ); 149 } 150 } 151 152 bp_core_add_message( __( 'Changes saved.', 'buddypress' ), 'success' ); 244 if ( $meta_key = bp_get_user_meta_key( $key ) ) { 245 bp_update_user_meta( (int) bp_displayed_user_id(), $meta_key, $value ); 246 } 247 } 248 } 249 250 // Switch feedback for super admins 251 if ( bp_is_my_profile() ) { 252 bp_core_add_message( __( 'Your notification settings have been saved.', 'buddypress' ), 'success' ); 253 } else { 254 bp_core_add_message( __( "This user's notification settings have been saved.", 'buddypress' ), 'success' ); 255 } 153 256 154 257 do_action( 'bp_core_notification_settings_after_save' ); … … 156 259 bp_core_redirect( bp_displayed_user_domain() . bp_get_settings_slug() . '/notifications/' ); 157 260 } 158 159 bp_core_load_template( apply_filters( 'bp_core_screen_notification_settings', 'members/single/settings/notifications' ) );160 261 } 161 162 /** Delete Account ************************************************************/ 163 164 function bp_core_screen_delete_account() { 165 262 add_action( 'bp_actions', 'bp_settings_action_notifications' ); 263 264 /** 265 * Handles the setting of user capabilities, spamming, hamming, role, etc... 266 * 267 * @return If no reason to proceed 268 */ 269 function bp_settings_action_capabilities() { 270 271 // Bail if not a POST action 272 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 273 return; 274 275 // Bail if not in settings 276 if ( ! bp_is_settings_component() || ! bp_is_current_action( 'capabilities' ) ) 277 return false; 278 279 // 404 if there are any additional action variables attached 166 280 if ( bp_action_variables() ) { 167 281 bp_do_404(); … … 169 283 } 170 284 285 if ( isset( $_POST['capabilities-submit'] ) ) { 286 287 // Nonce check 288 check_admin_referer( 'capabilities' ); 289 290 do_action( 'bp_settings_capabilities_before_save' ); 291 292 /** Spam **************************************************************/ 293 294 $is_spammer = !empty( $_POST['user-spammer'] ) ? true : false; 295 296 if ( bp_is_user_spammer( bp_displayed_user_id() ) != $is_spammer ) { 297 $status = ( true == $is_spammer ) ? 'spam' : 'ham'; 298 bp_core_process_spammer_status( bp_displayed_user_id(), $status ); 299 do_action( 'bp_core_action_set_spammer_status', bp_displayed_user_id(), $status ); 300 } 301 302 /** Other *************************************************************/ 303 304 do_action( 'bp_settings_capabilities_after_save' ); 305 306 // Redirect to the root domain 307 bp_core_redirect( bp_displayed_user_domain() . bp_get_settings_slug() . '/capabilities/' ); 308 } 309 } 310 add_action( 'bp_actions', 'bp_settings_action_capabilities' ); 311 312 /** 313 * Handles the deleting of a user 314 * 315 * @return If no reason to proceed 316 */ 317 function bp_settings_action_delete_account() { 318 319 // Bail if not a POST action 320 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 321 return; 322 323 // Bail if not in settings 324 if ( ! bp_is_settings_component() || ! bp_is_current_action( 'delete-account' ) ) 325 return false; 326 327 // 404 if there are any additional action variables attached 328 if ( bp_action_variables() ) { 329 bp_do_404(); 330 return; 331 } 332 171 333 if ( isset( $_POST['delete-account-understand'] ) ) { 334 172 335 // Nonce check 173 336 check_admin_referer( 'delete-account' ); 174 337 338 // Get username now because it might be gone soon! 339 $username = bp_get_displayed_user_fullname(); 340 175 341 // delete the users account 176 342 if ( bp_core_delete_account( bp_displayed_user_id() ) ) { 177 bp_core_redirect( home_url() ); 178 } 179 } 180 181 // Load the template 182 bp_core_load_template( apply_filters( 'bp_core_screen_delete_account', 'members/single/settings/delete-account' ) ); 343 344 // Add feedback ater deleting a user 345 bp_core_add_message( sprintf( __( '%s was successfully deleted.', 'buddypress' ), $username ), 'success' ); 346 347 // Redirect to the root domain 348 bp_core_redirect( bp_get_root_domain() ); 349 } 350 } 183 351 } 352 add_action( 'bp_actions', 'bp_settings_action_delete_account' ); 184 353 185 354 ?> -
trunk/bp-settings/bp-settings-loader.php
r5704 r5829 50 50 * 51 51 * @since 1.5 52 * @global obj $bp53 52 */ 54 53 function setup_globals() { … … 69 68 /** 70 69 * Setup BuddyBar navigation 71 *72 * @global obj $bp73 70 */ 74 71 function setup_nav() { 75 global $bp;76 72 77 73 // Define local variable … … 84 80 'position' => 100, 85 81 'show_for_displayed_user' => bp_core_can_edit_settings(), 86 'screen_function' => 'bp_ core_screen_general_settings',82 'screen_function' => 'bp_settings_screen_general', 87 83 'default_subnav_slug' => 'general' 88 84 ); … … 104 100 'parent_url' => $settings_link, 105 101 'parent_slug' => $this->slug, 106 'screen_function' => 'bp_ core_screen_general_settings',102 'screen_function' => 'bp_settings_screen_general', 107 103 'position' => 10, 108 104 'user_has_access' => bp_core_can_edit_settings() … … 115 111 'parent_url' => $settings_link, 116 112 'parent_slug' => $this->slug, 117 'screen_function' => 'bp_ core_screen_notification_settings',113 'screen_function' => 'bp_settings_screen_notification', 118 114 'position' => 20, 119 115 'user_has_access' => bp_core_can_edit_settings() 120 116 ); 121 117 118 // Add Spam Account nav item 119 if ( bp_current_user_can( 'bp_moderate' ) ) { 120 $sub_nav[] = array( 121 'name' => __( 'Capabilities', 'buddypress' ), 122 'slug' => 'capabilities', 123 'parent_url' => $settings_link, 124 'parent_slug' => $this->slug, 125 'screen_function' => 'bp_settings_screen_capabilities', 126 'position' => 80, 127 'user_has_access' => ! bp_is_my_profile() 128 ); 129 } 130 122 131 // Add Delete Account nav item 123 if ( ! bp_current_user_can( 'bp_moderate' ) && empty( $bp->site_options['bp-disable-account-deletion']) ) {132 if ( ! bp_disable_account_deletion() ) { 124 133 $sub_nav[] = array( 125 134 'name' => __( 'Delete Account', 'buddypress' ), … … 127 136 'parent_url' => $settings_link, 128 137 'parent_slug' => $this->slug, 129 'screen_function' => 'bp_ core_screen_delete_account',138 'screen_function' => 'bp_settings_screen_delete_account', 130 139 'position' => 90, 131 'user_has_access' => bp_is_my_profile() 140 'user_has_access' => bp_is_my_profile() || !is_super_admin( bp_displayed_user_id() ) 132 141 ); 133 142 } -
trunk/bp-settings/bp-settings-screens.php
r5690 r5829 5 5 * 6 6 * @package BuddyPress 7 * @subpackage Settings Functions7 * @subpackage SettingsScreens 8 8 */ 9 9 … … 11 11 if ( !defined( 'ABSPATH' ) ) exit; 12 12 13 /** 14 * Show the general settings template 15 * 16 * @since BuddyPress (1.5) 17 * 18 * @return If we shouldn't be here 19 */ 20 function bp_settings_screen_general() { 21 22 if ( bp_action_variables() ) { 23 bp_do_404(); 24 return; 25 } 26 27 bp_core_load_template( apply_filters( 'bp_settings_screen_general_settings', 'members/single/settings/general' ) ); 28 } 29 30 /** 31 * Show the notifications settings template 32 * 33 * @since BuddyPress (1.5) 34 * 35 * @return If we shouldn't be here 36 */ 37 function bp_settings_screen_notification() { 38 39 if ( bp_action_variables() ) { 40 bp_do_404(); 41 return; 42 } 43 44 bp_core_load_template( apply_filters( 'bp_settings_screen_notification_settings', 'members/single/settings/notifications' ) ); 45 } 46 47 /** 48 * Show the delete-account settings template 49 * 50 * @since BuddyPress (1.5) 51 * 52 * @return If we shouldn't be here 53 */ 54 function bp_settings_screen_delete_account() { 55 56 if ( bp_action_variables() ) { 57 bp_do_404(); 58 return; 59 } 60 61 // Load the template 62 bp_core_load_template( apply_filters( 'bp_settings_screen_delete_account', 'members/single/settings/delete-account' ) ); 63 } 64 65 /** 66 * Show the capabilities settings template 67 * 68 * @since BuddyPress (1.6) 69 * 70 * @return If we shouldn't be here 71 */ 72 function bp_settings_screen_capabilities() { 73 74 if ( bp_action_variables() ) { 75 bp_do_404(); 76 return; 77 } 78 79 // Load the template 80 bp_core_load_template( apply_filters( 'bp_settings_screen_capabilities', 'members/single/settings/capabilities' ) ); 81 } 82 13 83 ?> -
trunk/bp-themes/bp-default/members/single/settings/delete-account.php
r5737 r5829 50 50 <h3><?php _e( 'Delete Account', 'buddypress' ); ?></h3> 51 51 52 <div id="message" class="info"> 53 54 <?php if ( bp_is_my_profile() ) : ?> 55 56 <p><?php _e( 'Deleting your account will delete all of the content you have created. It will be completely irrecoverable.', 'buddypress' ); ?></p> 57 58 <?php else : ?> 59 60 <p><?php _e( 'Deleting this account will delete all of the content it has created. It will be completely irrecoverable.', 'buddypress' ); ?></p> 61 62 <?php endif; ?> 63 64 </div> 65 52 66 <form action="<?php echo bp_displayed_user_domain() . bp_get_settings_slug() . '/delete-account'; ?>" name="account-delete-form" id="account-delete-form" class="standard-form" method="post"> 53 54 <div id="message" class="info">55 <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>56 </div>57 58 <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' ); ?>59 67 60 68 <?php do_action( 'bp_members_delete_account_before_submit' ); ?> 61 69 70 <label> 71 <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'; }" /> 72 <?php _e( 'I understand the consequences.', 'buddypress' ); ?> 73 </label> 74 62 75 <div class="submit"> 63 <input type="submit" disabled="disabled" value="<?php _e( 'Delete MyAccount', 'buddypress' ); ?>" id="delete-account-button" name="delete-account-button" />76 <input type="submit" disabled="disabled" value="<?php _e( 'Delete Account', 'buddypress' ); ?>" id="delete-account-button" name="delete-account-button" /> 64 77 </div> 65 78 … … 67 80 68 81 <?php wp_nonce_field( 'delete-account' ); ?> 82 69 83 </form> 70 84 -
trunk/bp-themes/bp-default/members/single/settings/general.php
r5737 r5829 7 7 * @subpackage bp-default 8 8 */ 9 ?>10 9 11 <?phpget_header( 'buddypress' ); ?>10 get_header( 'buddypress' ); ?> 12 11 13 12 <div id="content"> … … 54 53 <form action="<?php echo bp_displayed_user_domain() . bp_get_settings_slug() . '/general'; ?>" method="post" class="standard-form" id="settings-form"> 55 54 56 <label for="pwd"><?php _e( 'Current Password <span>(required to update email or change current password)</span>', 'buddypress' ); ?></label> 57 <input type="password" name="pwd" id="pwd" size="16" value="" class="settings-input small" /> <a href="<?php echo site_url( add_query_arg( array( 'action' => 'lostpassword' ), 'wp-login.php' ), 'login' ); ?>" title="<?php _e( 'Password Lost and Found', 'buddypress' ); ?>"><?php _e( 'Lost your password?', 'buddypress' ); ?></a> 55 <?php if ( !is_super_admin() ) : ?> 56 57 <label for="pwd"><?php _e( 'Current Password <span>(required to update email or change current password)</span>', 'buddypress' ); ?></label> 58 <input type="password" name="pwd" id="pwd" size="16" value="" class="settings-input small" /> <a href="<?php echo site_url( add_query_arg( array( 'action' => 'lostpassword' ), 'wp-login.php' ), 'login' ); ?>" title="<?php _e( 'Password Lost and Found', 'buddypress' ); ?>"><?php _e( 'Lost your password?', 'buddypress' ); ?></a> 59 60 <?php endif; ?> 58 61 59 62 <label for="email"><?php _e( 'Account Email', 'buddypress' ); ?></label> -
trunk/bp-themes/bp-default/members/single/settings/notifications.php
r5737 r5829 7 7 * @subpackage bp-default 8 8 */ 9 ?>10 9 11 <?phpget_header( 'buddypress' ); ?>10 get_header( 'buddypress' ); ?> 12 11 13 12 <div id="content">
Note: See TracChangeset
for help on using the changeset viewer.