Changeset 9488
- Timestamp:
- 02/17/2015 05:31:15 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/bp-groups-forums.php
r9351 r9488 50 50 groups_update_groupmeta( $group_id, 'forum_id', $forum_id ); 51 51 52 /** 53 * Fires after the creation of a new forum inside a specific BuddyPress group. 54 * 55 * @since BuddyPress (1.0.0) 56 * 57 * @param int $forum_id ID of the newly created forum. 58 * @param int $group_id ID of the associated group. 59 */ 52 60 do_action( 'groups_new_group_forum', $forum_id, $group_id ); 53 61 } … … 75 83 } 76 84 85 /** 86 * Filters the group forum metadata value argument. 87 * 88 * @since BuddyPress (1.2.5) 89 * 90 * @param array $value Array of metadata values to update the group forum with. 91 */ 77 92 bp_forums_update_forum( apply_filters( 'groups_update_group_forum', array( 78 93 'forum_id' => groups_get_groupmeta( $group_id, 'forum_id' ), … … 103 118 } 104 119 120 /** 121 * Filters the text for the forum post before save. 122 * 123 * @since BuddyPress (1.2.0) 124 * 125 * @param string $post_text Text for the forum post. 126 */ 105 127 $post_text = apply_filters( 'group_forum_post_text_before_save', $post_text ); 128 129 /** 130 * Filters the ID for the forum post before save. 131 * 132 * @since BuddyPress (1.2.0) 133 * 134 * @param int $topic_id ID of the topic the post will be associated with. 135 */ 106 136 $topic_id = apply_filters( 'group_forum_post_topic_id_before_save', $topic_id ); 107 137 $post_id = bp_forums_insert_post( array( … … 123 153 } 124 154 125 // Record this in activity streams 155 /** 156 * Filters the new groups activity forum post action. 157 * 158 * @since BuddyPress (1.2.0) 159 * 160 * @param string $activity_action Formatted action related to group activity posting. 161 * @param int $post_id ID of the newly created group forum post. 162 * @param string $post_text The text for the forum post. 163 * @param object $topic Object holding current topic details. Passed by reference. 164 */ 165 $action = apply_filters_ref_array( 'groups_activity_new_forum_post_action', array( $activity_action, $post_id, $post_text, &$topic ) ); 166 167 /** 168 * Filters the new groups activity forum post content. 169 * 170 * @since BuddyPress (1.2.0) 171 * 172 * @param string $activity_content Excerpt-length activity content to be posted. 173 * @param int $post_id ID of the newly created group forum post. 174 * @param string $post_text The text for the forum post. 175 * @param object $topic Object holding current topic details. Passed by reference. 176 */ 177 $content = apply_filters_ref_array( 'groups_activity_new_forum_post_content', array( $activity_content, $post_id, $post_text, &$topic ) ); 178 179 /** 180 * Filters the new groups activity forum post primary link. 181 * 182 * @since BuddyPress (1.1.0) 183 * 184 * @param string $value URL to the newly posted forum post. 185 */ 186 $filtered_primary_link = apply_filters( 'groups_activity_new_forum_post_primary_link', "{$primary_link}#post-{$post_id}" ); 187 126 188 groups_record_activity( array( 127 'action' => apply_filters_ref_array( 'groups_activity_new_forum_post_action', array( $activity_action, $post_id, $post_text, &$topic ) ),128 'content' => apply_filters_ref_array( 'groups_activity_new_forum_post_content', array( $activity_content, $post_id, $post_text, &$topic ) ),129 'primary_link' => apply_filters( 'groups_activity_new_forum_post_primary_link', "{$primary_link}#post-{$post_id}" ),189 'action' => $action, 190 'content' => $content, 191 'primary_link' => $filtered_primary_link, 130 192 'type' => 'new_forum_post', 131 193 'item_id' => bp_get_current_group_id(), … … 133 195 ) ); 134 196 197 /** 198 * Fires after the creation of a new group forum topic post. 199 * 200 * @since BuddyPress (1.0.0) 201 * 202 * @param int $value ID of the current group. 203 * @param int $post_id ID of the new created forum topic post. 204 */ 135 205 do_action( 'groups_new_forum_topic_post', bp_get_current_group_id(), $post_id ); 136 206 … … 155 225 return false; 156 226 227 /** 228 * Filters the new groups forum topic title before saving. 229 * 230 * @since BuddyPress (1.2.0) 231 * 232 * @param string $topic_title The title for the forum topic. 233 */ 157 234 $topic_title = apply_filters( 'group_forum_topic_title_before_save', $topic_title ); 235 236 /** 237 * Filters the new groups forum topic text before saving. 238 * 239 * @since BuddyPress (1.2.0) 240 * 241 * @param string $topic_text The text for the forum topic. 242 */ 158 243 $topic_text = apply_filters( 'group_forum_topic_text_before_save', $topic_text ); 244 245 /** 246 * Filters the new groups forum topic tags before saving. 247 * 248 * @since BuddyPress (1.2.0) 249 * 250 * @param string $topic_tags A comma-delimited string of topic tags. 251 */ 159 252 $topic_tags = apply_filters( 'group_forum_topic_tags_before_save', $topic_tags ); 253 254 /** 255 * Filters the forum ID this forum topic resides in. 256 * 257 * @since BuddyPress (1.2.0) 258 * 259 * @param string $forum_id The forum ID this forum topic resides in. 260 */ 160 261 $forum_id = apply_filters( 'group_forum_topic_forum_id_before_save', $forum_id ); 161 262 $topic_id = bp_forums_new_topic( array( … … 174 275 $activity_content = bp_create_excerpt( $topic_text ); 175 276 176 // Record this in activity streams 277 /** 278 * Filters the new groups activity forum topic action. 279 * 280 * @since BuddyPress (1.2.0) 281 * 282 * @param string $activity_action Formatted action related to forum topic. 283 * @param string $topic_text New topic text. 284 * @param object $topic Object holding current topic details. Passed by reference. 285 */ 286 $action = apply_filters_ref_array( 'groups_activity_new_forum_topic_action', array( $activity_action, $topic_text, &$topic ) ); 287 288 /** 289 * Filters the new groups activity forum topic content. 290 * 291 * @since BuddyPress (1.2.0) 292 * 293 * @param string $activity_content Excerpt-length activity content to be posted. 294 * @param string $topic_text New topic text. 295 * @param object $topic Object holding current topic details. Passed by reference. 296 */ 297 $content = apply_filters_ref_array( 'groups_activity_new_forum_topic_content', array( $activity_content, $topic_text, &$topic ) ); 298 299 /** 300 * Filters the new groups activity forum topic primary link. 301 * 302 * @since BuddyPress (1.1.0) 303 * 304 * @param string $value Concatenated primary link. 305 */ 306 $primary_link = apply_filters( 'groups_activity_new_forum_topic_primary_link', bp_get_group_permalink( groups_get_current_group() ) . 'forum/topic/' . $topic->topic_slug . '/' ); 307 177 308 groups_record_activity( array( 178 'action' => apply_filters_ref_array( 'groups_activity_new_forum_topic_action', array( $activity_action, $topic_text, &$topic ) ),179 'content' => apply_filters_ref_array( 'groups_activity_new_forum_topic_content', array( $activity_content, $topic_text, &$topic ) ),180 'primary_link' => apply_filters( 'groups_activity_new_forum_topic_primary_link', bp_get_group_permalink( groups_get_current_group() ) . 'forum/topic/' . $topic->topic_slug . '/' ),309 'action' => $action, 310 'content' => $content, 311 'primary_link' => $primary_link, 181 312 'type' => 'new_forum_topic', 182 313 'item_id' => bp_get_current_group_id(), … … 184 315 ) ); 185 316 317 /** 318 * Fires after the creation of a new group forum topic. 319 * 320 * @since BuddyPress (1.0.0) 321 * 322 * @param int $value ID of the current group. 323 * @param object $topic Object holding current topic details. Passed by reference. 324 */ 186 325 do_action_ref_array( 'groups_new_forum_topic', array( bp_get_current_group_id(), &$topic ) ); 187 326 … … 205 344 $bp = buddypress(); 206 345 346 /** This filter is documented in bp-groups/bp-groups-forums.php */ 207 347 $topic_title = apply_filters( 'group_forum_topic_title_before_save', $topic_title ); 348 349 /** This filter is documented in bp-groups/bp-groups-forums.php */ 208 350 $topic_text = apply_filters( 'group_forum_topic_text_before_save', $topic_text ); 209 351 $topic = bp_forums_update_topic( array( … … 231 373 $activity_content = bp_create_excerpt( $topic_text ); 232 374 233 // Record this in activity streams 375 /** This filter is documented in bp-groups/bp-groups-forums.php */ 376 $action = apply_filters_ref_array( 'groups_activity_new_forum_topic_action', array( $activity_action, $topic_text, &$topic ) ); 377 378 /** This filter is documented in bp-groups/bp-groups-forums.php */ 379 $content = apply_filters_ref_array( 'groups_activity_new_forum_topic_content', array( $activity_content, $topic_text, &$topic ) ); 380 381 /** This filter is documented in bp-groups/bp-groups-forums.php */ 382 $primary_link = apply_filters( 'groups_activity_new_forum_topic_primary_link', bp_get_group_permalink( groups_get_current_group() ) . 'forum/topic/' . $topic->topic_slug . '/' ); 383 234 384 groups_record_activity( array( 235 385 'id' => $id, 236 'action' => apply_filters_ref_array( 'groups_activity_new_forum_topic_action', array( $activity_action, $topic_text, &$topic ) ),237 'content' => apply_filters_ref_array( 'groups_activity_new_forum_topic_content', array( $activity_content, $topic_text, &$topic ) ),238 'primary_link' => apply_filters( 'groups_activity_new_forum_topic_primary_link', bp_get_group_permalink( groups_get_current_group() ) . 'forum/topic/' . $topic->topic_slug . '/' ),386 'action' => $action, 387 'content' => $content, 388 'primary_link' => $primary_link, 239 389 'type' => 'new_forum_topic', 240 390 'item_id' => (int) bp_get_current_group_id(), … … 244 394 ) ); 245 395 396 /** 397 * Fires after the update of a group forum topic. 398 * 399 * @since BuddyPress (1.1.0) 400 * 401 * @param object $topic Object holding current topic being updated. Passed by reference. 402 */ 246 403 do_action_ref_array( 'groups_update_group_forum_topic', array( &$topic ) ); 247 404 … … 266 423 $bp = buddypress(); 267 424 425 /** This filter is documented in bp-groups/bp-groups-forums.php */ 268 426 $post_text = apply_filters( 'group_forum_post_text_before_save', $post_text ); 427 428 /** This filter is documented in bp-groups/bp-groups-forums.php */ 269 429 $topic_id = apply_filters( 'group_forum_post_topic_id_before_save', $topic_id ); 270 430 $post = bp_forums_get_post( $post_id ); … … 301 461 } 302 462 303 // Update the entry in activity streams 463 /** This filter is documented in bp-groups/bp-groups-forums.php */ 464 $action = apply_filters_ref_array( 'groups_activity_new_forum_post_action', array( $activity_action, $post_text, &$topic, &$topic ) ); 465 466 /** This filter is documented in bp-groups/bp-groups-forums.php */ 467 $content = apply_filters_ref_array( 'groups_activity_new_forum_post_content', array( $activity_content, $post_text, &$topic, &$topic ) ); 468 469 /** This filter is documented in bp-groups/bp-groups-forums.php */ 470 $filtered_primary_link = apply_filters( 'groups_activity_new_forum_post_primary_link', $primary_link . "#post-" . $post_id ); 471 304 472 groups_record_activity( array( 305 473 'id' => $id, 306 'action' => apply_filters_ref_array( 'groups_activity_new_forum_post_action', array( $activity_action, $post_text, &$topic, &$topic ) ),307 'content' => apply_filters_ref_array( 'groups_activity_new_forum_post_content', array( $activity_content, $post_text, &$topic, &$topic ) ),308 'primary_link' => apply_filters( 'groups_activity_new_forum_post_primary_link', $primary_link . "#post-" . $post_id ),474 'action' => $action, 475 'content' => $content, 476 'primary_link' => $filtered_primary_link, 309 477 'type' => 'new_forum_post', 310 478 'item_id' => (int) bp_get_current_group_id(), … … 314 482 ) ); 315 483 484 /** 485 * Fires after the update of a group forum post. 486 * 487 * @since BuddyPress (1.1.0) 488 * 489 * @param object $post Object holding current post being updated. 490 * @param object $topic Object holding current topic details. Passed by reference. 491 */ 316 492 do_action_ref_array( 'groups_update_group_forum_post', array( $post, &$topic ) ); 317 493 … … 337 513 338 514 if ( !empty( $action ) ) { 515 516 /** 517 * Fires before the deletion of a group forum topic. 518 * 519 * @since BuddyPress (1.2.9) 520 * 521 * @param int $topic_id ID of the topic to be deleted. 522 */ 339 523 do_action( 'groups_before_delete_group_forum_topic', $topic_id ); 340 524 … … 361 545 } 362 546 547 /** 548 * Fires after the deletion of a group forum topic. 549 * 550 * @since BuddyPress (1.1.0) 551 * 552 * @param int $topic_id ID of the topic that was deleted. 553 */ 363 554 do_action( 'groups_delete_group_forum_topic', $topic_id ); 364 555 } … … 385 576 386 577 if ( !empty( $action ) ) { 578 579 /** 580 * Fires before the deletion of a group forum post. 581 * 582 * @since BuddyPress (1.5.0) 583 * 584 * @param int $post_id ID of the post to be deleted. 585 * @param int $topic_id ID of the associated topic. 586 */ 387 587 do_action( 'groups_before_delete_group_forum_post', $post_id, $topic_id ); 388 588 … … 397 597 } 398 598 599 /** 600 * Fires after the deletion of a group forum post. 601 * 602 * @since BuddyPress (1.1.0) 603 * 604 * @param int $post_id ID of the post that was deleted. 605 * @param int $topic_id ID of the associated topic. 606 */ 399 607 do_action( 'groups_delete_group_forum_post', $post_id, $topic_id ); 400 608 } … … 413 621 */ 414 622 function groups_total_public_forum_topic_count( $type = 'newest' ) { 623 624 /** 625 * Filters the total count of all public topics of a given type, across groups/forums. 626 * 627 * @since BuddyPress (1.1.0) 628 * 629 * @param int $value Total count of all public topics. 630 */ 415 631 return apply_filters( 'groups_total_public_forum_topic_count', BP_Groups_Group::get_global_forum_topic_count( $type ) ); 416 632 } … … 427 643 */ 428 644 function groups_total_forum_topic_count( $status = 'public', $search_terms = false ) { 645 646 /** 647 * Filters the total count of all topics of a given status, across groups/forums. 648 * 649 * @since BuddyPress (1.5.0) 650 * 651 * @param int $value Total count of all topics. 652 */ 429 653 return apply_filters( 'groups_total_forum_topic_count', BP_Groups_Group::get_global_topic_count( $status, $search_terms ) ); 430 654 }
Note: See TracChangeset
for help on using the changeset viewer.