Skip to:
Content

BuddyPress.org

Changeset 6579


Ignore:
Timestamp:
12/10/2012 06:50:12 AM (14 years ago)
Author:
johnjamesjacoby
Message:

See #4761:

  • More Credits changes...
  • Update contributor avatars and metadata.
  • Add update/activate redirection helpers.
  • Code improvements to updater.
Location:
trunk/bp-core
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/admin/bp-core-functions.php

    r6558 r6579  
    162162
    163163/**
    164  * Redirect user to bbPress's What's New page on activation
    165  *
    166  * @since bbPress (r4389)
    167  *
    168  * @internal Used internally to redirect bbPress to the about page on activation
     164 * Redirect user to BuddyPress's What's New page on activation
     165 *
     166 * @since BuddyPress (1.7)
     167 *
     168 * @internal Used internally to redirect BuddyPress to the about page on activation
    169169 *
    170170 * @uses get_transient() To see if transient to redirect exists
     
    175175 * @uses admin_url() To get the admin URL to index.php
    176176 *
    177  * @return If no transient, or in network admin, or is bulk activation
     177 * @return If no transient, or is bulk activation
    178178 */
    179179function bp_do_activation_redirect() {
     
    187187
    188188        // Bail if activating from network, or bulk
    189         if ( is_network_admin() || isset( $_GET['activate-multi'] ) )
    190                 return;
    191 
    192         // Redirect to bbPress about page
    193         wp_safe_redirect( add_query_arg( array( 'page' => 'bp-about' ), admin_url( 'index.php' ) ) );
     189        if ( isset( $_GET['activate-multi'] ) )
     190                return;
     191
     192        // Redirect to BuddyPress about page
     193        wp_safe_redirect( add_query_arg( array( 'page' => 'bp-about' ), bp_get_admin_url( 'index.php' ) ) );
    194194}
    195195
  • trunk/bp-core/bp-core-actions.php

    r6531 r6579  
    9393        add_action( 'bp_loaded', 'bp_admin' );
    9494}
     95
     96// Activation redirect
     97add_action( 'bp_activation', 'bp_add_activation_redirect' );
  • trunk/bp-core/bp-core-admin.php

    r6558 r6579  
    375375        public function about_screen() {
    376376
     377                // Switch page to use for settings
     378                $settings_page = bp_is_network_activated() ? 'settings.php' : 'options-general.php';
     379
    377380                list( $display_version ) = explode( '-', bp_get_version() ); ?>
    378381
     
    442445
    443446                        <div class="return-to-dashboard">
    444                                 <a href="<?php echo esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'buddypress' ), 'options-general.php' ) ) ); ?>"><?php _e( 'Go to Community Settings' ); ?></a>
     447                                <a href="<?php echo esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components' ), $settings_page ) ) ); ?>"><?php _e( 'Go to Community Settings' ); ?></a>
    445448                        </div>
    446449
     
    459462         */
    460463        public function credits_screen() {
     464
     465                // Switch page to use for settings
     466                $settings_page = bp_is_network_activated() ? 'settings.php' : 'options-general.php';
    461467
    462468                list( $display_version ) = explode( '-', bp_get_version() ); ?>
     
    480486                        <ul class="wp-people-group " id="wp-people-group-project-leaders">
    481487                                <li class="wp-person" id="wp-person-apeatling">
    482                                         <a href="http://profiles.wordpress.org/apeatling"><img src="http://0.gravatar.com/avatar/767fc9c115a1b989744c755db47feb60?s=60" class="gravatar" alt="Andy Peatling" /></a>
     488                                        <a href="http://profiles.wordpress.org/apeatling"><img src="http://0.gravatar.com/avatar/bb29d699b5cba218c313b61aa82249da?s=60" class="gravatar" alt="Andy Peatling" /></a>
    483489                                        <a class="web" href="http://profiles.wordpress.org/apeatling">Andy Peatling</a>
    484490                                        <span class="title"><?php _e( 'Founding Developer', 'buddypress' ); ?></span>
     
    490496                                </li>
    491497                                <li class="wp-person" id="wp-person-boonebgorges">
    492                                         <a href="http://profiles.wordpress.org/boonebgorges"><img src="http://0.gravatar.com/avatar/6a7c997edea340616bcc6d0fe03f65dd?s=60" class="gravatar" alt="Boone B. Gorges" /></a>
     498                                        <a href="http://profiles.wordpress.org/boonebgorges"><img src="http://0.gravatar.com/avatar/9cf7c4541a582729a5fc7ae484786c0c?s=60" class="gravatar" alt="Boone B. Gorges" /></a>
    493499                                        <a class="web" href="http://profiles.wordpress.org/boonebgorges">Boone B. Gorges</a>
    494500                                        <span class="title"><?php _e( 'Lead Developer', 'buddypress' ); ?></span>
    495501                                </li>
    496502                                <li class="wp-person" id="wp-person-djpaul">
    497                                         <a href="http://profiles.wordpress.org/djpaul"><img src="http://0.gravatar.com/avatar/e341eca9e1a85dcae7127044301b4363?s=60" class="gravatar" alt="Paul Gibbs" /></a>
     503                                        <a href="http://profiles.wordpress.org/djpaul"><img src="http://0.gravatar.com/avatar/3bc9ab796299d67ce83dceb9554f75df?s=60" class="gravatar" alt="Paul Gibbs" /></a>
    498504                                        <a class="web" href="http://profiles.wordpress.org/djpaul">Paul Gibbs</a>
    499505                                        <span class="title"><?php _e( 'Lead Developer', 'buddypress' ); ?></span>
     
    503509                        <h4 class="wp-people-group"><?php _e( 'Contributing Developers', 'buddypress' ); ?></h4>
    504510                        <ul class="wp-people-group " id="wp-people-group-contributing-developers">
    505                                 <li class="wp-person" id="wp-person-jmdodd">
    506                                         <a href="http://profiles.wordpress.org/jmdodd"><img src="http://0.gravatar.com/avatar/6a7c997edea340616bcc6d0fe03f65dd?s=60" class="gravatar" alt="Jennifer M. Dodd" /></a>
    507                                         <a class="web" href="http://profiles.wordpress.org/jmdodd">Jennifer M. Dodd</a>
    508                                         <span class="title"></span>
    509                                 </li>
    510                                 <li class="wp-person" id="wp-person-jaredatch">
    511                                         <a href="http://profiles.wordpress.org/jaredatch"><img src="http://0.gravatar.com/avatar/e341eca9e1a85dcae7127044301b4363?s=60" class="gravatar" alt="Jared Atchison" /></a>
    512                                         <a class="web" href="http://profiles.wordpress.org/jaredatch">Jared Atchison</a>
    513                                         <span class="title"></span>
    514                                 </li>
    515                                 <li class="wp-person" id="wp-person-gautamgupta">
    516                                         <a href="http://profiles.wordpress.org/gautamgupta"><img src="http://0.gravatar.com/avatar/b0810422cbe6e4eead4def5ae7a90b34?s=60" class="gravatar" alt="Gautam Gupta" /></a>
    517                                         <a class="web" href="http://profiles.wordpress.org/gautamgupta">Gautam Gupta</a>
    518                                         <span class="title"></span>
     511                                <li class="wp-person" id="wp-person-r-a-y">
     512                                        <a href="http://profiles.wordpress.org/r-a-y"><img src="http://0.gravatar.com/avatar/3bfa556a62b5bfac1012b6ba5f42ebfa?s=60" class="gravatar" alt="Ray" /></a>
     513                                        <a class="web" href="http://profiles.wordpress.org/r-a-y">Ray</a>
     514                                        <span class="title"><?php _e( 'Quality Officer', 'buddypress' ); ?></span>
     515                                </li>
     516                                <li class="wp-person" id="wp-person-karmatosed">
     517                                        <a href="http://profiles.wordpress.org/karmatosed"><img src="http://0.gravatar.com/avatar/d36d2c1821af9249b69ff7f5ed60529b?s=60" class="gravatar" alt="Tammie Lister" /></a>
     518                                        <a class="web" href="http://profiles.wordpress.org/karmatosed">Tammie Lister</a>
     519                                        <span class="title"><?php _e( 'Mark-up Officer', 'buddypress' ); ?></span>
     520                                </li>
     521                                <li class="wp-person" id="wp-person-mercime">
     522                                        <a href="http://profiles.wordpress.org/mercime"><img src="http://0.gravatar.com/avatar/fae451be6708241627983570a1a1817a?s=60" class="gravatar" alt="Mercime" /></a>
     523                                        <a class="web" href="http://profiles.wordpress.org/mercime">Mercime</a>
     524                                        <span class="title"><?php _e( 'Support Officer', 'buddypress' ); ?></span>
    519525                                </li>
    520526                        </ul>
     
    522528                        <h4 class="wp-people-group"><?php _e( 'Codex Rockstars', 'buddypress' ); ?></h4>
    523529                        <ul class="wp-people-group " id="wp-people-group-codex-rockstars">
    524                                 <li class="wp-person" id="wp-person-masonjames">
    525                                         <a href="http://profiles.wordpress.org/masonjames"><img src="http://0.gravatar.com/avatar/99dee4d5287d0f9e26ff72e7228d97ac?s=60" class="gravatar" alt="Mason James" /></a>
    526                                         <a class="web" href="http://profiles.wordpress.org/masonjames">Mason James</a>
    527                                         <span class="title"></span>
    528                                 </li>
    529                                 <li class="wp-person" id="wp-person-wordsforwp">
    530                                         <a href="http://profiles.wordpress.org/wordsforwp"><img src="http://0.gravatar.com/avatar/5437119b446adad1af813c44944e6c9c?s=60" class="gravatar" alt="Siobhan McKeown" /></a>
    531                                         <a class="web" href="http://profiles.wordpress.org/wordsforwp">Siobhan McKeown</a>
    532                                         <span class="title"></span>
    533                                 </li>
    534                                 <li class="wp-person" id="wp-person-JarretC">
    535                                         <a href="http://profiles.wordpress.org/JarretC"><img src="http://0.gravatar.com/avatar/e00501bf782b42d5db19ff75fca14f6a?s=60" class="gravatar" alt="Jarret Cade" /></a>
    536                                         <a class="web" href="http://profiles.wordpress.org/JarretC">Jarret Cade</a>
     530                                <li class="wp-person" id="wp-person-modemlooper">
     531                                        <a href="http://profiles.wordpress.org/modemlooper"><img src="http://0.gravatar.com/avatar/1c07be1016e845de514931477c939307?s=60" class="gravatar" alt="Modemlooper" /></a>
     532                                        <a class="web" href="http://profiles.wordpress.org/modemlooper">Modemlooper</a>
     533                                        <span class="title"><?php _e( 'Mobile Officer', 'buddypress' ); ?></span>
     534                                </li>
     535                                <li class="wp-person" id="wp-person-dennissmolek">
     536                                        <a href="http://profiles.wordpress.org/dennissmolek"><img src="http://0.gravatar.com/avatar/015eeb0cebb40f949d0f317e2dfe66c3?s=60" class="gravatar" alt="Dennis Smolek" /></a>
     537                                        <a class="web" href="http://profiles.wordpress.org/dennissmolek">Dennis Smolek</a>
    537538                                        <span class="title"></span>
    538539                                </li>
     
    577578
    578579                        <div class="return-to-dashboard">
    579                                 <a href="<?php echo esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'buddypress' ), 'options-general.php' ) ) ); ?>"><?php _e( 'Go to Community Settings' ); ?></a>
     580                                <a href="<?php echo esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components' ), $settings_page ) ) ); ?>"><?php _e( 'Go to Community Settings' ); ?></a>
    580581                        </div>
    581582
  • trunk/bp-core/bp-core-functions.php

    r6558 r6579  
    2626         *
    2727         * @since BuddyPress (1.6)
    28          * @global BuddyPress $bp
    2928         * @return string The BuddyPress version
    3029         */
    3130        function bp_get_version() {
    32                 global $bp;
    33                 return $bp->version;
     31                return buddypress()->version;
    3432        }
    3533
     
    4745         *
    4846         * @since BuddyPress (1.6)
    49          * @global BuddyPress $bp
    5047         * @return string The BuddyPress version
    5148         */
    5249        function bp_get_db_version() {
    53                 global $bp;
    54                 return $bp->db_version;
     50                return buddypress()->db_version;
    5551        }
    5652
     
    6864         *
    6965         * @since BuddyPress (1.6)
    70          * @global BuddyPress $bp
    7166         * @return string The BuddyPress version direct from the database
    7267         */
    7368        function bp_get_db_version_raw() {
    74                 global $bp;
    75 
    76                 $retval = 0;
    77                 if ( !empty( $bp->db_version_raw ) )
    78                         $retval = $bp->db_version_raw;
    79 
    80                 return $retval;
     69                $bp     = buddypress();
     70                return !empty( $bp->db_version_raw ) ? $bp->db_version_raw : 0;
    8171        }
    8272
  • trunk/bp-core/bp-core-update.php

    r6436 r6579  
    1212
    1313/**
    14  * Compare the BuddyPress version to the DB version to determine if updating
    15  *
    16  * @since BuddyPress (1.6)
     14 * If there is no raw DB version, this is the first installation
     15 *
     16 * @since BuddyPress (1.7)
    1717 *
    1818 * @uses get_option()
     
    2020 * @return bool True if update, False if not
    2121 */
     22function bp_is_install() {
     23        return ! bp_get_db_version_raw();
     24}
     25
     26/**
     27 * Compare the BuddyPress version to the DB version to determine if updating
     28 *
     29 * @since BuddyPress (1.6)
     30 *
     31 * @uses get_option()
     32 * @uses bp_get_db_version() To get BuddyPress's database version
     33 * @return bool True if update, False if not
     34 */
    2235function bp_is_update() {
    2336
     
    4255 */
    4356function bp_is_activation( $basename = '' ) {
    44         $bp = buddypress();
    45 
     57        $bp     = buddypress();
    4658        $action = false;
    47         if ( ! empty( $_REQUEST['action'] ) && ( '-1' != $_REQUEST['action'] ) )
     59
     60        if ( ! empty( $_REQUEST['action'] ) && ( '-1' != $_REQUEST['action'] ) ) {
    4861                $action = $_REQUEST['action'];
    49         elseif ( ! empty( $_REQUEST['action2'] ) && ( '-1' != $_REQUEST['action2'] ) )
     62        } elseif ( ! empty( $_REQUEST['action2'] ) && ( '-1' != $_REQUEST['action2'] ) ) {
    5063                $action = $_REQUEST['action2'];
     64        }
    5165
    5266        // Bail if not activating
    53         if ( empty( $action ) || !in_array( $action, array( 'activate', 'activate-selected' ) ) )
    54                 return false;
     67        if ( empty( $action ) || !in_array( $action, array( 'activate', 'activate-selected' ) ) ) {
     68                return false;
     69        }
    5570
    5671        // The plugin(s) being activated
    57         if ( $action == 'activate' )
     72        if ( $action == 'activate' ) {
    5873                $plugins = isset( $_GET['plugin'] ) ? array( $_GET['plugin'] ) : array();
    59         else
     74        } else {
    6075                $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
     76        }
    6177
    6278        // Set basename if empty
    63         if ( empty( $basename ) && !empty( $bp->basename ) )
     79        if ( empty( $basename ) && !empty( $bp->basename ) ) {
    6480                $basename = $bp->basename;
     81        }
    6582
    6683        // Bail if no basename
    67         if ( empty( $basename ) )
    68                 return false;
     84        if ( empty( $basename ) ) {
     85                return false;
     86        }
    6987
    7088        // Is BuddyPress being activated?
     
    8199 */
    82100function bp_is_deactivation( $basename = '' ) {
    83         $bp = buddypress();
    84 
     101        $bp     = buddypress();
    85102        $action = false;
    86         if ( ! empty( $_REQUEST['action'] ) && ( '-1' != $_REQUEST['action'] ) )
     103
     104        if ( ! empty( $_REQUEST['action'] ) && ( '-1' != $_REQUEST['action'] ) ) {
    87105                $action = $_REQUEST['action'];
    88         elseif ( ! empty( $_REQUEST['action2'] ) && ( '-1' != $_REQUEST['action2'] ) )
     106        } elseif ( ! empty( $_REQUEST['action2'] ) && ( '-1' != $_REQUEST['action2'] ) ) {
    89107                $action = $_REQUEST['action2'];
     108        }
    90109
    91110        // Bail if not deactivating
    92         if ( empty( $action ) || !in_array( $action, array( 'deactivate', 'deactivate-selected' ) ) )
    93                 return false;
     111        if ( empty( $action ) || !in_array( $action, array( 'deactivate', 'deactivate-selected' ) ) ) {
     112                return false;
     113        }
    94114
    95115        // The plugin(s) being deactivated
    96         if ( $action == 'deactivate' )
     116        if ( 'deactivate' == $action ) {
    97117                $plugins = isset( $_GET['plugin'] ) ? array( $_GET['plugin'] ) : array();
    98         else
     118        } else {
    99119                $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
     120        }
    100121
    101122        // Set basename if empty
    102         if ( empty( $basename ) && !empty( $bp->basename ) )
     123        if ( empty( $basename ) && !empty( $bp->basename ) ) {
    103124                $basename = $bp->basename;
     125        }
    104126
    105127        // Bail if no basename
    106         if ( empty( $basename ) )
    107                 return false;
     128        if ( empty( $basename ) ) {
     129                return false;
     130        }
    108131
    109132        // Is bbPress being deactivated?
     
    135158
    136159        // Are we running an outdated version of BuddyPress?
    137         if ( bp_is_update() ) {
    138 
    139                 // Bump the version
    140                 bp_version_bump();
    141 
    142                 // Run the deactivation function to wipe roles, caps, and rewrite rules
    143                 bp_deactivation();
    144 
    145                 // Run the activation function to reset roles, caps, and rewrite rules
    146                 bp_activation();
    147         }
     160        if ( ! bp_is_update() )
     161                return;
     162       
     163        bp_version_updater();
     164}
     165
     166/**
     167 * bbPress's version updater looks at what the current database version is, and
     168 * runs whatever other code is needed.
     169 *
     170 * This is most-often used when the data schema changes, but should also be used
     171 * to correct issues with bbPress meta-data silently on software update.
     172 *
     173 * @since bbPress (r4104)
     174 */
     175function bp_version_updater() {
     176
     177        // Get the raw database version
     178        $raw_db_version = (int) bp_get_db_version_raw();
     179
     180        /** 1.6 Branch ************************************************************/
     181
     182        // 1.6
     183        if ( $raw_db_version < 6067 ) {
     184                // Do nothing
     185        }
     186
     187        /** All done! *************************************************************/
     188
     189        // Bump the version
     190        bp_version_bump();
     191}
     192
     193/**
     194 * Redirect user to BuddyPress's What's New page on activation
     195 *
     196 * @since BuddyPress (1.7)
     197 *
     198 * @internal Used internally to redirect BuddyPress to the about page on activation
     199 *
     200 * @uses set_transient() To drop the activation transient for 30 seconds
     201 *
     202 * @return If bulk activation
     203 */
     204function bp_add_activation_redirect() {
     205
     206        // Bail if activating from network, or bulk
     207        if ( isset( $_GET['activate-multi'] ) )
     208                return;
     209
     210        // Add the transient to redirect
     211    set_transient( '_bp_activation_redirect', true, 30 );
    148212}
    149213
Note: See TracChangeset for help on using the changeset viewer.