Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
07/10/2014 10:22:16 PM (12 years ago)
Author:
johnjamesjacoby
Message:

Add return values to bp_blogs_record_existing_blogs() add use them in a new blog meta data recording repair tool. See #5749.

File:
1 edited

Legend:

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

    r8146 r8589  
    133133        }
    134134
     135        // Blogs:
     136        // - user blog count
     137        if ( bp_is_active( 'blogs' ) ) {
     138                $repair_list[90] = array(
     139                        'bp-blog-records',
     140                        __( 'Repopulate blogs records', 'buddypress' ),
     141                        'bp_admin_repair_blog_records',
     142                );
     143        }
     144
    135145        ksort( $repair_list );
    136146
     
    240250
    241251/**
     252 * Recalculate user-to-blog relationships and useful blog meta data
     253 *
     254 * @since BuddyPress (2.1.0)
     255 *
     256 * @return array
     257 */
     258function bp_admin_repair_blog_records() {
     259
     260        // Description of this tool, dispalyed to the user
     261        $statement = __( 'Repopulating Blogs records… %s', 'buddypress' );
     262
     263        // Default to failure text
     264        $result    = __( 'Failed!',   'buddypress' );
     265
     266        // Default to unrepaired
     267        $repair    = false;
     268
     269        // Run function if blogs component is active
     270        if ( bp_is_active( 'blogs' ) ) {
     271                $repair = bp_blogs_record_existing_blogs();
     272        }
     273
     274        // Setup success/fail messaging
     275        if ( true === $repair ) {
     276                $result = __( 'Complete!', 'buddypress' );
     277        }
     278
     279        // All done!
     280        return array( 0, sprintf( $statement, $result ) );
     281}
     282
     283/**
    242284 * Recalculate the total number of active site members.
    243285 *
     
    282324                        case 0:
    283325                                return false;
    284                                 break;
    285326
    286327                        case 1:
Note: See TracChangeset for help on using the changeset viewer.