Changeset 8189 for trunk/bp-blogs/bp-blogs-functions.php
- Timestamp:
- 03/28/2014 10:33:16 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-blogs/bp-blogs-functions.php
r8135 r8189 183 183 return false; 184 184 185 $url = get_home_url( $blog_id ); 186 $name = get_blog_option( $blog_id, 'blogname' ); 187 $description = get_blog_option( $blog_id, 'blogdescription' ); 188 189 if ( empty( $name ) ) 190 return false; 185 $name = get_blog_option( $blog_id, 'blogname' ); 186 187 if ( empty( $name ) ) { 188 return false; 189 } 190 191 $url = get_home_url( $blog_id ); 192 $description = get_blog_option( $blog_id, 'blogdescription' ); 193 $close_old_posts = get_blog_option( $blog_id, 'close_comments_for_old_posts' ); 194 $close_days_old = get_blog_option( $blog_id, 'close_comments_days_old' ); 195 196 $thread_depth = get_blog_option( $blog_id, 'thread_comments' ); 197 if ( ! empty( $thread_depth ) ) { 198 $thread_depth = get_blog_option( $blog_id, 'thread_comments_depth' ); 199 } else { 200 // perhaps filter this? 201 $thread_depth = 1; 202 } 191 203 192 204 $recorded_blog = new BP_Blogs_Blog; … … 200 212 bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'description', $description ); 201 213 bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'last_activity', bp_core_current_time() ); 214 bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'close_comments_for_old_posts', $close_old_posts ); 215 bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'close_comments_days_old', $close_days_old ); 216 bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'thread_comments_depth', $thread_depth ); 202 217 203 218 $is_private = !empty( $_POST['blog_public'] ) && (int) $_POST['blog_public'] ? false : true; … … 251 266 } 252 267 add_action( 'update_option_blogdescription', 'bp_blogs_update_option_blogdescription', 10, 2 ); 268 269 /** 270 * Update "Close comments for old posts" option in BuddyPress blogmeta table. 271 * 272 * @since BuddyPress (2.0.0) 273 * 274 * @global object $wpdb DB Layer. 275 * 276 * @param string $oldvalue Value before save. Passed by do_action() but 277 * unused here. 278 * @param string $newvalue Value to change meta to. 279 */ 280 function bp_blogs_update_option_close_comments_for_old_posts( $oldvalue, $newvalue ) { 281 global $wpdb; 282 283 bp_blogs_update_blogmeta( $wpdb->blogid, 'close_comments_for_old_posts', $newvalue ); 284 } 285 add_action( 'update_option_close_comments_for_old_posts', 'bp_blogs_update_option_close_comments_for_old_posts', 10, 2 ); 286 287 /** 288 * Update "Close comments after days old" option in BuddyPress blogmeta table. 289 * 290 * @since BuddyPress (2.0.0) 291 * 292 * @global object $wpdb DB Layer. 293 * 294 * @param string $oldvalue Value before save. Passed by do_action() but 295 * unused here. 296 * @param string $newvalue Value to change meta to. 297 */ 298 function bp_blogs_update_option_close_close_comments_days_old( $oldvalue, $newvalue ) { 299 global $wpdb; 300 301 bp_blogs_update_blogmeta( $wpdb->blogid, 'close_comments_days_old', $newvalue ); 302 } 303 add_action( 'update_option_close_comments_days_old', 'bp_blogs_update_option_close_comments_days_old', 10, 2 ); 304 305 /** 306 * When toggling threaded comments, update thread depth in blogmeta table. 307 * 308 * @since BuddyPress (2.0.0) 309 * 310 * @global object $wpdb DB Layer. 311 * 312 * @param string $oldvalue Value before save. Passed by do_action() but 313 * unused here. 314 * @param string $newvalue Value to change meta to. 315 */ 316 function bp_blogs_update_option_thread_comments( $oldvalue, $newvalue ) { 317 global $wpdb; 318 319 if ( empty( $newvalue ) ) { 320 $thread_depth = 1; 321 } else { 322 $thread_depth = get_option( 'thread_comments_depth' ); 323 } 324 325 bp_blogs_update_blogmeta( $wpdb->blogid, 'thread_comments_depth', $thread_depth ); 326 } 327 add_action( 'update_option_thread_comments', 'bp_blogs_update_option_thread_comments', 10, 2 ); 328 329 /** 330 * When updating comment depth, update thread depth in blogmeta table. 331 * 332 * @since BuddyPress (2.0.0) 333 * 334 * @global object $wpdb DB Layer. 335 * 336 * @param string $oldvalue Value before save. Passed by do_action() but 337 * unused here. 338 * @param string $newvalue Value to change meta to. 339 */ 340 function bp_blogs_update_option_thread_comments_depth( $oldvalue, $newvalue ) { 341 global $wpdb; 342 343 $comments_enabled = get_option( 'thread_comments' ); 344 345 if ( $comments_enabled ) { 346 bp_blogs_update_blogmeta( $wpdb->blogid, 'thread_comments_depth', $newvalue ); 347 } 348 } 349 add_action( 'update_option_thread_comments_depth', 'bp_blogs_update_option_thread_comments_depth', 10, 2 ); 253 350 254 351 /**
Note: See TracChangeset
for help on using the changeset viewer.