Skip to:
Content

BuddyPress.org

Changeset 3033


Ignore:
Timestamp:
06/10/2010 07:43:47 PM (16 years ago)
Author:
johnjamesjacoby
Message:

Better handling of blogname and blogdescription changes from r3031 and r3032

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/bp-blogs.php

    r3032 r3033  
    358358
    359359/**
    360  * bp_blogs_updated_option()
    361  *
    362  * Handles the syncing of updated options that we store in blogmeta
    363  *
    364  * @global object $wpdb Database object
    365  * @param string $option Name of option that's
    366  * @param string $oldvalue The previous option (not used here)
    367  * @param string $_newvalue The new value
     360 * bp_blogs_update_option_blogname()
     361 *
     362 * Updates blogname in BuddyPress blogmeta table
     363 *
     364 * @global object $wpdb DB Layer
     365 * @param string $oldvalue Value before save (not used)
     366 * @param string $newvalue Value to change meta to
    368367 */
    369 function bp_blogs_updated_option( $option, $oldvalue, $_newvalue ) {
     368function bp_blogs_update_option_blogname( $oldvalue, $newvalue ) {
    370369    global $wpdb;
    371 
    372     // Use switch so this can be extended later if needed
    373     switch ( $option ) {
    374         case 'name' :
    375         case 'description' :
    376             bp_blogs_update_blogmeta( $wpdb->blogid, $option, $_newvalue );
    377             break;
    378         default :
    379             break;
    380     }
    381 }
    382 add_action( 'updated_option', 'bp_blogs_updated_option', 10, 3 );
     370    bp_blogs_update_blogmeta( $wpdb->blogid, 'name', $newvalue );
     371}
     372add_action( 'update_option_blogname', 'bp_blogs_update_option_blogname', 10, 2 );
     373
     374/**
     375 * bp_blogs_update_option_blogdescription()
     376 *
     377 * Updates blogdescription in BuddyPress blogmeta table
     378 *
     379 * @global object $wpdb DB Layer
     380 * @param string $oldvalue Value before save (not used)
     381 * @param string $newvalue Value to change meta to
     382 */
     383function bp_blogs_update_option_blogdescription( $oldvalue, $newvalue ) {
     384    global $wpdb;
     385    bp_blogs_update_blogmeta( $wpdb->blogid, 'description', $newvalue );
     386}
     387add_action( 'update_option_blogdescription', 'bp_blogs_update_option_blogdescription', 10, 2 );
    383388
    384389function bp_blogs_record_post( $post_id, $post, $user_id = false ) {
Note: See TracChangeset for help on using the changeset viewer.