Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/02/2009 07:54:21 PM (17 years ago)
Author:
apeatling
Message:

Merging 1.1 branch changes and syncing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-settings.php

    r2059 r2077  
    33if ( !defined( 'BP_SETTINGS_SLUG' ) )
    44        define( 'BP_SETTINGS_SLUG', 'settings' );
    5        
     5
    66function bp_core_add_settings_nav() {
    77        global $bp;
    8        
     8
    99        /* Set up settings as a sudo-component for identification and nav selection */
    1010        $bp->settings->id = 'settings';
    1111        $bp->settings->slug = BP_SETTINGS_SLUG;
    12        
     12
    1313        /* Register this in the active components array */
    1414        $bp->active_components[$bp->settings->slug] = $bp->settings->id;
     
    1818
    1919        $settings_link = $bp->loggedin_user->domain . 'settings/';
    20        
     20
    2121        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() ) );
    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() ) );
    23        
     23
    2424        if ( !is_site_admin() && !(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() ) );
     
    3232function bp_core_screen_general_settings() {
    3333        global $current_user, $bp_settings_updated, $pass_error;
    34        
     34
    3535        $bp_settings_updated = false;
    3636        $pass_error = false;
    37        
     37
    3838        if ( isset($_POST['submit']) ) {
    3939                check_admin_referer('bp_settings_general');
    40                
     40
    4141                require_once( WPINC . '/registration.php' );
    42                
     42
    4343                // Form has been submitted and nonce checks out, lets do it.
    44                
     44
    4545                if ( $_POST['email'] != '' )
    4646                        $current_user->user_email = wp_specialchars( trim( $_POST['email'] ) );
     
    5656                        unset( $current_user->user_pass );
    5757                }
    58                
     58
    5959                if ( !$pass_error && wp_update_user( get_object_vars( $current_user ) ) )
    6060                        $bp_settings_updated = true;
    6161        }
    62        
     62
    6363        add_action( 'bp_template_title', 'bp_core_screen_general_settings_title' );
    6464        add_action( 'bp_template_content', 'bp_core_screen_general_settings_content' );
    65        
     65
    6666        bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'plugin-template' ) );
    6767}
     
    7979                </div>
    8080        <?php } ?>
    81        
     81
    8282        <?php if ( $pass_error && !$bp_settings_updated ) { ?>
    8383                <div id="message" class="error fade">
    8484                        <p><?php _e( 'Your passwords did not match', 'buddypress' ) ?></p>
    85                 </div> 
     85                </div>
    8686        <?php } ?>
    8787
     
    8989                <label for="email"><?php _e( 'Account Email', 'buddypress' ) ?></label>
    9090                <input type="text" name="email" id="email" value="<?php echo attribute_escape( $current_user->user_email ); ?>" class="settings-input" />
    91                        
     91
    9292                <label for="pass1"><?php _e( 'Change Password <span>(leave blank for no change)</span>', 'buddypress' ) ?></label>
    9393                <input type="password" name="pass1" id="pass1" size="16" value="" class="settings-input small" /> &nbsp;<?php _e( 'New Password', 'buddypress' ) ?><br />
    9494                <input type="password" name="pass2" id="pass2" size="16" value="" class="settings-input small" /> &nbsp;<?php _e( 'Repeat New Password', 'buddypress' ) ?>
    95        
     95
    9696                <p class="submit"><input type="submit" name="submit" value="<?php _e( 'Save Changes', 'buddypress' ) ?>" id="submit" class="auto"/></p>
    9797                <?php wp_nonce_field('bp_settings_general') ?>
     
    104104function bp_core_screen_notification_settings() {
    105105        global $current_user, $bp_settings_updated;
    106        
     106
    107107        $bp_settings_updated = false;
    108        
     108
    109109        if ( $_POST['submit'] ) {
    110110                check_admin_referer('bp_settings_notifications');
    111                
     111
    112112                if ( $_POST['notifications'] ) {
    113113                        foreach ( $_POST['notifications'] as $key => $value ) {
     
    115115                        }
    116116                }
    117                
     117
    118118                $bp_settings_updated = true;
    119119        }
    120                
     120
    121121        add_action( 'bp_template_title', 'bp_core_screen_notification_settings_title' );
    122122        add_action( 'bp_template_content', 'bp_core_screen_notification_settings_content' );
    123        
     123
    124124        bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'plugin-template' ) );
    125125}
     
    137137                </div>
    138138        <?php } ?>
    139        
     139
    140140        <form action="<?php echo $bp->loggedin_user->domain . 'settings/notifications' ?>" method="post" id="settings-form">
    141141                <h3><?php _e( 'Email Notifications', 'buddypress' ) ?></h3>
    142142                <p><?php _e( 'Send a notification by email when:', 'buddypress' ) ?></p>
    143                
     143
    144144                <?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
    148148                <?php wp_nonce_field('bp_settings_notifications') ?>
    149                
     149
    150150        </form>
    151151<?php
     
    154154/**** DELETE ACCOUNT ****/
    155155
    156 function bp_core_screen_delete_account() {     
     156function bp_core_screen_delete_account() {
    157157        if ( isset( $_POST['delete-account-understand'] ) ) {
    158158                check_admin_referer( 'delete-account' );
     
    162162                        bp_core_redirect( site_url() );
    163163        }
    164        
    165164        add_action( 'bp_template_title', 'bp_core_screen_delete_account_title' );
    166165        add_action( 'bp_template_content', 'bp_core_screen_delete_account_content' );
    167        
     166
    168167        bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'plugin-template' ) );
    169168}
     
    177176
    178177        <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
    180179                <div id="message" class="info">
    181180                        <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>
    182181                </div>
    183                
     182
    184183                <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' ); ?>
    185184                <p><input type="submit" disabled="disabled" value="<?php _e( 'Delete My Account', 'buddypress' ) ?> &raquo;" id="delete-account-button" name="delete-account-button" /></p>
Note: See TracChangeset for help on using the changeset viewer.