<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][9488] trunk/src/bp-groups/bp-groups-forums.php: Adds hooks documentation for bp-groups-forums.php.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://buddypress.trac.wordpress.org/changeset/9488">9488</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://buddypress.trac.wordpress.org/changeset/9488","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>tw2113</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2015-02-17 05:31:15 +0000 (Tue, 17 Feb 2015)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Adds hooks documentation for bp-groups-forums.php.
See <a href="http://buddypress.trac.wordpress.org/ticket/5943">#5943</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcbpgroupsbpgroupsforumsphp">trunk/src/bp-groups/bp-groups-forums.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcbpgroupsbpgroupsforumsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-groups/bp-groups-forums.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-groups/bp-groups-forums.php 2015-02-17 05:16:34 UTC (rev 9487)
+++ trunk/src/bp-groups/bp-groups-forums.php 2015-02-17 05:31:15 UTC (rev 9488)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -49,6 +49,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> groups_update_groupmeta( $group_id, 'forum_id', $forum_id );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Fires after the creation of a new forum inside a specific BuddyPress group.
+ *
+ * @since BuddyPress (1.0.0)
+ *
+ * @param int $forum_id ID of the newly created forum.
+ * @param int $group_id ID of the associated group.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> do_action( 'groups_new_group_forum', $forum_id, $group_id );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -74,6 +82,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Filters the group forum metadata value argument.
+ *
+ * @since BuddyPress (1.2.5)
+ *
+ * @param array $value Array of metadata values to update the group forum with.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> bp_forums_update_forum( apply_filters( 'groups_update_group_forum', array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'forum_id' => groups_get_groupmeta( $group_id, 'forum_id' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'forum_name' => $group->name,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -102,7 +117,22 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Filters the text for the forum post before save.
+ *
+ * @since BuddyPress (1.2.0)
+ *
+ * @param string $post_text Text for the forum post.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> $post_text = apply_filters( 'group_forum_post_text_before_save', $post_text );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * Filters the ID for the forum post before save.
+ *
+ * @since BuddyPress (1.2.0)
+ *
+ * @param int $topic_id ID of the topic the post will be associated with.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> $topic_id = apply_filters( 'group_forum_post_topic_id_before_save', $topic_id );
</span><span class="cx" style="display: block; padding: 0 10px"> $post_id = bp_forums_insert_post( array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'post_text' => $post_text,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -122,16 +152,56 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $primary_link .= "?topic_page=" . $page;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Record this in activity streams
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Filters the new groups activity forum post action.
+ *
+ * @since BuddyPress (1.2.0)
+ *
+ * @param string $activity_action Formatted action related to group activity posting.
+ * @param int $post_id ID of the newly created group forum post.
+ * @param string $post_text The text for the forum post.
+ * @param object $topic Object holding current topic details. Passed by reference.
+ */
+ $action = apply_filters_ref_array( 'groups_activity_new_forum_post_action', array( $activity_action, $post_id, $post_text, &$topic ) );
+
+ /**
+ * Filters the new groups activity forum post content.
+ *
+ * @since BuddyPress (1.2.0)
+ *
+ * @param string $activity_content Excerpt-length activity content to be posted.
+ * @param int $post_id ID of the newly created group forum post.
+ * @param string $post_text The text for the forum post.
+ * @param object $topic Object holding current topic details. Passed by reference.
+ */
+ $content = apply_filters_ref_array( 'groups_activity_new_forum_post_content', array( $activity_content, $post_id, $post_text, &$topic ) );
+
+ /**
+ * Filters the new groups activity forum post primary link.
+ *
+ * @since BuddyPress (1.1.0)
+ *
+ * @param string $value URL to the newly posted forum post.
+ */
+ $filtered_primary_link = apply_filters( 'groups_activity_new_forum_post_primary_link', "{$primary_link}#post-{$post_id}" );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> groups_record_activity( array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'action' => apply_filters_ref_array( 'groups_activity_new_forum_post_action', array( $activity_action, $post_id, $post_text, &$topic ) ),
- 'content' => apply_filters_ref_array( 'groups_activity_new_forum_post_content', array( $activity_content, $post_id, $post_text, &$topic ) ),
- 'primary_link' => apply_filters( 'groups_activity_new_forum_post_primary_link', "{$primary_link}#post-{$post_id}" ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'action' => $action,
+ 'content' => $content,
+ 'primary_link' => $filtered_primary_link,
</ins><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'new_forum_post',
</span><span class="cx" style="display: block; padding: 0 10px"> 'item_id' => bp_get_current_group_id(),
</span><span class="cx" style="display: block; padding: 0 10px"> 'secondary_item_id' => $post_id
</span><span class="cx" style="display: block; padding: 0 10px"> ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Fires after the creation of a new group forum topic post.
+ *
+ * @since BuddyPress (1.0.0)
+ *
+ * @param int $value ID of the current group.
+ * @param int $post_id ID of the new created forum topic post.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> do_action( 'groups_new_forum_topic_post', bp_get_current_group_id(), $post_id );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return $post_id;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -154,9 +224,40 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( empty( $topic_title ) || empty( $topic_text ) )
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Filters the new groups forum topic title before saving.
+ *
+ * @since BuddyPress (1.2.0)
+ *
+ * @param string $topic_title The title for the forum topic.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> $topic_title = apply_filters( 'group_forum_topic_title_before_save', $topic_title );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * Filters the new groups forum topic text before saving.
+ *
+ * @since BuddyPress (1.2.0)
+ *
+ * @param string $topic_text The text for the forum topic.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> $topic_text = apply_filters( 'group_forum_topic_text_before_save', $topic_text );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * Filters the new groups forum topic tags before saving.
+ *
+ * @since BuddyPress (1.2.0)
+ *
+ * @param string $topic_tags A comma-delimited string of topic tags.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> $topic_tags = apply_filters( 'group_forum_topic_tags_before_save', $topic_tags );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * Filters the forum ID this forum topic resides in.
+ *
+ * @since BuddyPress (1.2.0)
+ *
+ * @param string $forum_id The forum ID this forum topic resides in.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> $forum_id = apply_filters( 'group_forum_topic_forum_id_before_save', $forum_id );
</span><span class="cx" style="display: block; padding: 0 10px"> $topic_id = bp_forums_new_topic( array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'topic_title' => $topic_title,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -173,16 +274,54 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $activity_action = sprintf( __( '%1$s started the forum topic %2$s in the group %3$s', 'buddypress'), bp_core_get_userlink( bp_loggedin_user_id() ), '<a href="' . bp_get_group_permalink( groups_get_current_group() ) . 'forum/topic/' . $topic->topic_slug .'/">' . esc_attr( $topic->topic_title ) . '</a>', '<a href="' . bp_get_group_permalink( groups_get_current_group() ) . '">' . esc_attr( bp_get_current_group_name() ) . '</a>' );
</span><span class="cx" style="display: block; padding: 0 10px"> $activity_content = bp_create_excerpt( $topic_text );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Record this in activity streams
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Filters the new groups activity forum topic action.
+ *
+ * @since BuddyPress (1.2.0)
+ *
+ * @param string $activity_action Formatted action related to forum topic.
+ * @param string $topic_text New topic text.
+ * @param object $topic Object holding current topic details. Passed by reference.
+ */
+ $action = apply_filters_ref_array( 'groups_activity_new_forum_topic_action', array( $activity_action, $topic_text, &$topic ) );
+
+ /**
+ * Filters the new groups activity forum topic content.
+ *
+ * @since BuddyPress (1.2.0)
+ *
+ * @param string $activity_content Excerpt-length activity content to be posted.
+ * @param string $topic_text New topic text.
+ * @param object $topic Object holding current topic details. Passed by reference.
+ */
+ $content = apply_filters_ref_array( 'groups_activity_new_forum_topic_content', array( $activity_content, $topic_text, &$topic ) );
+
+ /**
+ * Filters the new groups activity forum topic primary link.
+ *
+ * @since BuddyPress (1.1.0)
+ *
+ * @param string $value Concatenated primary link.
+ */
+ $primary_link = apply_filters( 'groups_activity_new_forum_topic_primary_link', bp_get_group_permalink( groups_get_current_group() ) . 'forum/topic/' . $topic->topic_slug . '/' );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> groups_record_activity( array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'action' => apply_filters_ref_array( 'groups_activity_new_forum_topic_action', array( $activity_action, $topic_text, &$topic ) ),
- 'content' => apply_filters_ref_array( 'groups_activity_new_forum_topic_content', array( $activity_content, $topic_text, &$topic ) ),
- 'primary_link' => apply_filters( 'groups_activity_new_forum_topic_primary_link', bp_get_group_permalink( groups_get_current_group() ) . 'forum/topic/' . $topic->topic_slug . '/' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'action' => $action,
+ 'content' => $content,
+ 'primary_link' => $primary_link,
</ins><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'new_forum_topic',
</span><span class="cx" style="display: block; padding: 0 10px"> 'item_id' => bp_get_current_group_id(),
</span><span class="cx" style="display: block; padding: 0 10px"> 'secondary_item_id' => $topic->topic_id
</span><span class="cx" style="display: block; padding: 0 10px"> ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Fires after the creation of a new group forum topic.
+ *
+ * @since BuddyPress (1.0.0)
+ *
+ * @param int $value ID of the current group.
+ * @param object $topic Object holding current topic details. Passed by reference.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> do_action_ref_array( 'groups_new_forum_topic', array( bp_get_current_group_id(), &$topic ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return $topic;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -204,7 +343,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function groups_update_group_forum_topic( $topic_id, $topic_title, $topic_text, $topic_tags = false ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $bp = buddypress();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /** This filter is documented in bp-groups/bp-groups-forums.php */
</ins><span class="cx" style="display: block; padding: 0 10px"> $topic_title = apply_filters( 'group_forum_topic_title_before_save', $topic_title );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /** This filter is documented in bp-groups/bp-groups-forums.php */
</ins><span class="cx" style="display: block; padding: 0 10px"> $topic_text = apply_filters( 'group_forum_topic_text_before_save', $topic_text );
</span><span class="cx" style="display: block; padding: 0 10px"> $topic = bp_forums_update_topic( array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'topic_title' => $topic_title,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -230,12 +372,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $activity_action = sprintf( __( '%1$s edited the forum topic %2$s in the group %3$s', 'buddypress'), bp_core_get_userlink( $topic->topic_poster ), '<a href="' . bp_get_group_permalink( groups_get_current_group() ) . 'forum/topic/' . $topic->topic_slug .'/">' . esc_attr( $topic->topic_title ) . '</a>', '<a href="' . bp_get_group_permalink( groups_get_current_group() ) . '">' . esc_attr( bp_get_current_group_name() ) . '</a>' );
</span><span class="cx" style="display: block; padding: 0 10px"> $activity_content = bp_create_excerpt( $topic_text );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Record this in activity streams
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /** This filter is documented in bp-groups/bp-groups-forums.php */
+ $action = apply_filters_ref_array( 'groups_activity_new_forum_topic_action', array( $activity_action, $topic_text, &$topic ) );
+
+ /** This filter is documented in bp-groups/bp-groups-forums.php */
+ $content = apply_filters_ref_array( 'groups_activity_new_forum_topic_content', array( $activity_content, $topic_text, &$topic ) );
+
+ /** This filter is documented in bp-groups/bp-groups-forums.php */
+ $primary_link = apply_filters( 'groups_activity_new_forum_topic_primary_link', bp_get_group_permalink( groups_get_current_group() ) . 'forum/topic/' . $topic->topic_slug . '/' );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> groups_record_activity( array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'id' => $id,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'action' => apply_filters_ref_array( 'groups_activity_new_forum_topic_action', array( $activity_action, $topic_text, &$topic ) ),
- 'content' => apply_filters_ref_array( 'groups_activity_new_forum_topic_content', array( $activity_content, $topic_text, &$topic ) ),
- 'primary_link' => apply_filters( 'groups_activity_new_forum_topic_primary_link', bp_get_group_permalink( groups_get_current_group() ) . 'forum/topic/' . $topic->topic_slug . '/' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'action' => $action,
+ 'content' => $content,
+ 'primary_link' => $primary_link,
</ins><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'new_forum_topic',
</span><span class="cx" style="display: block; padding: 0 10px"> 'item_id' => (int) bp_get_current_group_id(),
</span><span class="cx" style="display: block; padding: 0 10px"> 'user_id' => (int) $topic->topic_poster,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -243,6 +393,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'recorded_time ' => $topic->topic_time
</span><span class="cx" style="display: block; padding: 0 10px"> ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Fires after the update of a group forum topic.
+ *
+ * @since BuddyPress (1.1.0)
+ *
+ * @param object $topic Object holding current topic being updated. Passed by reference.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> do_action_ref_array( 'groups_update_group_forum_topic', array( &$topic ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return $topic;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -265,7 +422,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function groups_update_group_forum_post( $post_id, $post_text, $topic_id, $page = false ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $bp = buddypress();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /** This filter is documented in bp-groups/bp-groups-forums.php */
</ins><span class="cx" style="display: block; padding: 0 10px"> $post_text = apply_filters( 'group_forum_post_text_before_save', $post_text );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /** This filter is documented in bp-groups/bp-groups-forums.php */
</ins><span class="cx" style="display: block; padding: 0 10px"> $topic_id = apply_filters( 'group_forum_post_topic_id_before_save', $topic_id );
</span><span class="cx" style="display: block; padding: 0 10px"> $post = bp_forums_get_post( $post_id );
</span><span class="cx" style="display: block; padding: 0 10px"> $post_id = bp_forums_insert_post( array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -300,12 +460,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Update the entry in activity streams
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /** This filter is documented in bp-groups/bp-groups-forums.php */
+ $action = apply_filters_ref_array( 'groups_activity_new_forum_post_action', array( $activity_action, $post_text, &$topic, &$topic ) );
+
+ /** This filter is documented in bp-groups/bp-groups-forums.php */
+ $content = apply_filters_ref_array( 'groups_activity_new_forum_post_content', array( $activity_content, $post_text, &$topic, &$topic ) );
+
+ /** This filter is documented in bp-groups/bp-groups-forums.php */
+ $filtered_primary_link = apply_filters( 'groups_activity_new_forum_post_primary_link', $primary_link . "#post-" . $post_id );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> groups_record_activity( array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'id' => $id,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'action' => apply_filters_ref_array( 'groups_activity_new_forum_post_action', array( $activity_action, $post_text, &$topic, &$topic ) ),
- 'content' => apply_filters_ref_array( 'groups_activity_new_forum_post_content', array( $activity_content, $post_text, &$topic, &$topic ) ),
- 'primary_link' => apply_filters( 'groups_activity_new_forum_post_primary_link', $primary_link . "#post-" . $post_id ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'action' => $action,
+ 'content' => $content,
+ 'primary_link' => $filtered_primary_link,
</ins><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'new_forum_post',
</span><span class="cx" style="display: block; padding: 0 10px"> 'item_id' => (int) bp_get_current_group_id(),
</span><span class="cx" style="display: block; padding: 0 10px"> 'user_id' => (int) $post->poster_id,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -313,6 +481,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'recorded_time' => $post->post_time
</span><span class="cx" style="display: block; padding: 0 10px"> ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Fires after the update of a group forum post.
+ *
+ * @since BuddyPress (1.1.0)
+ *
+ * @param object $post Object holding current post being updated.
+ * @param object $topic Object holding current topic details. Passed by reference.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> do_action_ref_array( 'groups_update_group_forum_post', array( $post, &$topic ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return $post_id;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -336,6 +512,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $action = bp_forums_delete_topic( array( 'topic_id' => $topic_id ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( !empty( $action ) ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * Fires before the deletion of a group forum topic.
+ *
+ * @since BuddyPress (1.2.9)
+ *
+ * @param int $topic_id ID of the topic to be deleted.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> do_action( 'groups_before_delete_group_forum_topic', $topic_id );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Delete the corresponding activity stream items
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -360,6 +544,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Fires after the deletion of a group forum topic.
+ *
+ * @since BuddyPress (1.1.0)
+ *
+ * @param int $topic_id ID of the topic that was deleted.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> do_action( 'groups_delete_group_forum_topic', $topic_id );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -384,6 +575,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $action = bp_forums_delete_post( array( 'post_id' => $post_id ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( !empty( $action ) ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * Fires before the deletion of a group forum post.
+ *
+ * @since BuddyPress (1.5.0)
+ *
+ * @param int $post_id ID of the post to be deleted.
+ * @param int $topic_id ID of the associated topic.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> do_action( 'groups_before_delete_group_forum_post', $post_id, $topic_id );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Delete the corresponding activity stream item
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -396,6 +596,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Fires after the deletion of a group forum post.
+ *
+ * @since BuddyPress (1.1.0)
+ *
+ * @param int $post_id ID of the post that was deleted.
+ * @param int $topic_id ID of the associated topic.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> do_action( 'groups_delete_group_forum_post', $post_id, $topic_id );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -412,6 +620,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return int The topic count.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function groups_total_public_forum_topic_count( $type = 'newest' ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * Filters the total count of all public topics of a given type, across groups/forums.
+ *
+ * @since BuddyPress (1.1.0)
+ *
+ * @param int $value Total count of all public topics.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> return apply_filters( 'groups_total_public_forum_topic_count', BP_Groups_Group::get_global_forum_topic_count( $type ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -426,5 +642,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return int The topic count.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function groups_total_forum_topic_count( $status = 'public', $search_terms = false ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * Filters the total count of all topics of a given status, across groups/forums.
+ *
+ * @since BuddyPress (1.5.0)
+ *
+ * @param int $value Total count of all topics.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> return apply_filters( 'groups_total_forum_topic_count', BP_Groups_Group::get_global_topic_count( $status, $search_terms ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre>
</div>
</div>
</body>
</html>