Changeset 6779
- Timestamp:
- 02/08/2013 06:36:14 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-forums/bp-forums-functions.php
r6778 r6779 35 35 */ 36 36 function bp_forums_is_installed_correctly() { 37 global $bp;37 $bp = buddypress(); 38 38 39 39 if ( isset( $bp->forums->bbconfig ) && is_file( $bp->forums->bbconfig ) ) … … 52 52 */ 53 53 function bp_forums_has_directory() { 54 global $bp; 55 56 return (bool) !empty( $bp->pages->forums->id ); 54 return (bool) !empty( buddypress()->pages->forums->id ); 57 55 } 58 56 … … 67 65 do_action( 'bbpress_init' ); 68 66 69 $ defaults =array(67 $r = wp_parse_args( $args, array( 70 68 'forum_name' => '', 71 69 'forum_desc' => '', … … 73 71 'forum_order' => false, 74 72 'forum_is_category' => 0 75 ); 76 77 $r = wp_parse_args( $args, $defaults ); 73 ) ); 78 74 extract( $r, EXTR_SKIP ); 79 75 … … 84 80 do_action( 'bbpress_init' ); 85 81 86 $ defaults =array(82 $r = wp_parse_args( $args, array( 87 83 'forum_id' => '', 88 84 'forum_name' => '', … … 92 88 'forum_order' => false, 93 89 'forum_is_category' => 0 94 ); 95 96 $r = wp_parse_args( $args, $defaults ); 90 ) ); 97 91 extract( $r, EXTR_SKIP ); 98 92 … … 113 107 114 108 function bp_forums_get_forum_topics( $args = '' ) { 115 global $bp; 116 117 do_action( 'bbpress_init' ); 118 119 $defaults = array( 109 do_action( 'bbpress_init' ); 110 111 $r = wp_parse_args( $args, array( 120 112 'type' => 'newest', 121 113 'forum_id' => false, … … 128 120 'show_stickies' => 'all', 129 121 'filter' => false // if $type = tag then filter is the tag name, otherwise it's terms to search on. 130 ); 131 132 $r = wp_parse_args( $args, $defaults ); 122 ) ); 133 123 extract( $r, EXTR_SKIP ); 134 124 … … 184 174 do_action( 'bbpress_init' ); 185 175 186 $ defaults =array(176 $r = wp_parse_args( $args, array( 187 177 'topic_title' => '', 188 178 'topic_slug' => '', … … 197 187 'topic_tags' => false, // accepts array or comma delim 198 188 'forum_id' => 0 // accepts ids or slugs 199 ); 200 201 $r = wp_parse_args( $args, $defaults ); 189 ) ); 202 190 extract( $r, EXTR_SKIP ); 203 191 … … 229 217 230 218 function bp_forums_update_topic( $args = '' ) { 231 global $bp; 232 233 do_action( 'bbpress_init' ); 234 235 $defaults = array( 219 do_action( 'bbpress_init' ); 220 221 $r = wp_parse_args( $args, array( 236 222 'topic_id' => false, 237 223 'topic_title' => '', 238 224 'topic_text' => '', 239 225 'topic_tags' => false 240 ); 241 242 $r = wp_parse_args( $args, $defaults ); 226 ) ); 243 227 extract( $r, EXTR_SKIP ); 244 228 … … 264 248 265 249 function bp_forums_sticky_topic( $args = '' ) { 266 global $bp; 267 268 do_action( 'bbpress_init' ); 269 270 $defaults = array( 250 do_action( 'bbpress_init' ); 251 252 $r = wp_parse_args( $args, array( 271 253 'topic_id' => false, 272 254 'mode' => 'stick' // stick/unstick 273 ); 274 275 $r = wp_parse_args( $args, $defaults ); 255 ) ); 276 256 extract( $r, EXTR_SKIP ); 277 257 … … 285 265 286 266 function bp_forums_openclose_topic( $args = '' ) { 287 global $bp; 288 289 do_action( 'bbpress_init' ); 290 291 $defaults = array( 267 do_action( 'bbpress_init' ); 268 269 $r = wp_parse_args( $args, array( 292 270 'topic_id' => false, 293 271 'mode' => 'close' // stick/unstick 294 ); 295 296 $r = wp_parse_args( $args, $defaults ); 272 ) ); 297 273 extract( $r, EXTR_SKIP ); 298 274 … … 306 282 307 283 function bp_forums_delete_topic( $args = '' ) { 308 global $bp; 309 310 do_action( 'bbpress_init' ); 311 312 $defaults = array( 284 do_action( 'bbpress_init' ); 285 286 $r = wp_parse_args( $args, array( 313 287 'topic_id' => false 314 ); 315 316 $r = wp_parse_args( $args, $defaults ); 288 ) ); 317 289 extract( $r, EXTR_SKIP ); 318 290 … … 403 375 */ 404 376 function bp_forums_total_topic_count_for_user( $user_id = 0, $type = 'active' ) { 405 global $bp;406 407 377 do_action( 'bbpress_init' ); 408 378 … … 443 413 */ 444 414 function bp_forums_total_replied_count_for_user( $user_id = 0, $type = 'active' ) { 445 global $bp;446 447 415 do_action( 'bbpress_init' ); 448 416 … … 480 448 481 449 function bp_forums_get_topic_extras( $topics ) { 482 global $ bp, $wpdb, $bbdb;450 global $wpdb, $bbdb; 483 451 484 452 if ( empty( $topics ) ) 485 453 return $topics; 454 455 $bp = buddypress(); 486 456 487 457 // Get the topic ids … … 556 526 557 527 function bp_forums_delete_post( $args = '' ) { 558 global $bp; 559 560 do_action( 'bbpress_init' ); 561 562 $defaults = array( 528 do_action( 'bbpress_init' ); 529 530 $r = wp_parse_args( $args, array( 563 531 'post_id' => false 564 ); 565 566 $r = wp_parse_args( $args, $defaults ); 532 ) ); 533 567 534 extract( $r, EXTR_SKIP ); 568 535 … … 571 538 572 539 function bp_forums_insert_post( $args = '' ) { 573 global $bp;574 575 540 do_action( 'bbpress_init' ); 576 541 … … 666 631 667 632 function bp_forums_filter_caps( $allcaps ) { 668 global $ bp, $wp_roles, $bb_table_prefix;633 global $wp_roles, $bb_table_prefix; 669 634 670 635 if ( !bp_loggedin_user_id() )
Note: See TracChangeset
for help on using the changeset viewer.