Skip to:
Content

BuddyPress.org

Changeset 1784


Ignore:
Timestamp:
09/03/2009 07:48:41 PM (15 years ago)
Author:
apeatling
Message:

Added ability for admins to disable account deletion.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core.php

    r1767 r1784  
    13261326    global $bp;
    13271327
    1328     // Be careful with this function!
    1329    
     1328    /* Make sure account deletion is not disabled */
     1329    if ( 1 == (int)get_site_option( 'bp-disable-account-deletion' ) )
     1330        return false;
     1331
    13301332    /* Site admins should not be allowed to delete their accounts */
    13311333    if ( is_site_admin() )
    13321334        return false;
    1333    
     1335
    13341336    require_once( ABSPATH . '/wp-admin/includes/mu.php' );
    13351337    require_once( ABSPATH . '/wp-admin/includes/user.php' );
  • trunk/bp-core/bp-core-admin.php

    r1677 r1784  
    8585                    </td>           
    8686                </tr>
    87                 <?php } ?>
    88                
     87                <?php } ?>             
     88                <tr>
     89                    <th scope="row"><?php _e( 'Disable user account deletion?', 'buddypress' ) ?>:</th>
     90                    <td>
     91                        <input type="radio" name="bp-admin[bp-disable-account-deletion]"<?php if ( (int)get_site_option( 'bp-disable-account-deletion' ) ) : ?> checked="checked"<?php endif; ?> id="bp-disable-account-deletion" value="1" /> <?php _e( 'Yes', 'buddypress' ) ?> &nbsp;
     92                        <input type="radio" name="bp-admin[bp-disable-account-deletion]"<?php if ( !(int)get_site_option( 'bp-disable-account-deletion' ) || '' == get_site_option( 'bp-disable-account-deletion' ) ) : ?> checked="checked"<?php endif; ?> id="bp-disable-account-deletion" value="0" /> <?php _e( 'No', 'buddypress' ) ?>
     93                    </td>           
     94                </tr>               
    8995                <?php if ( !locate_template( array( 'registration/register.php' ) ) ) :?>
    9096                <tr>
  • trunk/bp-core/bp-core-settings.php

    r1718 r1784  
    2222    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() ) );
    2323   
    24     if ( !is_site_admin() )
     24    if ( !is_site_admin() && 1 != (int)get_site_option( 'bp-disable-account-deletion' ) )
    2525        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() ) );
    2626}
     
    3636    $pass_error = false;
    3737   
    38     if ( isset($_POST['submit']) && check_admin_referer('bp_settings_general') ) {
     38    if ( isset($_POST['submit']) ) {
     39        check_admin_referer('bp_settings_general');
     40       
    3941        require_once( WPINC . '/registration.php' );
    4042       
     
    105107    $bp_settings_updated = false;
    106108   
    107     if ( $_POST['submit'] && check_admin_referer('bp_settings_notifications') ) {
     109    if ( $_POST['submit'] ) {
     110        check_admin_referer('bp_settings_notifications');
     111       
    108112        if ( $_POST['notifications'] ) {
    109113            foreach ( $_POST['notifications'] as $key => $value ) {
     
    153157    global $current_user, $bp_settings_updated, $pass_error;
    154158   
    155     if ( isset( $_POST['delete-account-button'] ) && check_admin_referer('delete-account') ) {
    156         if ( !check_admin_referer( 'delete-account' ) )
    157             return false;
     159    if ( isset( $_POST['delete-account-button'] ) ) {
     160        check_admin_referer( 'delete-account' );
    158161       
    159162        // delete the users account
     
    165168    $pass_error = false;
    166169   
    167     if ( isset($_POST['submit']) && check_admin_referer('bp_settings_general') ) {
     170    if ( isset($_POST['submit']) ) {
     171        check_admin_referer('bp_settings_general');
     172       
    168173        require_once( WPINC . '/registration.php' );
    169174       
Note: See TracChangeset for help on using the changeset viewer.