<!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" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { 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 #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#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>
<title>[BuddyPress] [3473] trunk: WP_DEBUG fixes on group forum pages</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>3473</dd>
<dt>Author</dt> <dd>boonebgorges</dd>
<dt>Date</dt> <dd>2010-11-21 23:43:15 +0000 (Sun, 21 Nov 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>WP_DEBUG fixes on group forum pages</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpcorebpcoretemplatetagsphp">trunk/bp-core/bp-core-templatetags.php</a></li>
<li><a href="#trunkbpforumsbpforumstemplatetagsphp">trunk/bp-forums/bp-forums-templatetags.php</a></li>
<li><a href="#trunkbpforumsphp">trunk/bp-forums.php</a></li>
<li><a href="#trunkbpgroupsphp">trunk/bp-groups.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpcorebpcoretemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-templatetags.php (3472 => 3473)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-templatetags.php        2010-11-21 23:30:57 UTC (rev 3472)
+++ trunk/bp-core/bp-core-templatetags.php        2010-11-21 23:43:15 UTC (rev 3473)
</span><span class="lines">@@ -1781,7 +1781,7 @@
</span><span class="cx"> function bp_is_group_forum_topic() {
</span><span class="cx">         global $bp;
</span><span class="cx"> 
</span><del>-        if ( BP_GROUPS_SLUG == $bp-&gt;current_component &amp;&amp; $bp-&gt;is_single_item &amp;&amp; 'forum' == $bp-&gt;current_action &amp;&amp; 'topic' == $bp-&gt;action_variables[0] )
</del><ins>+        if ( BP_GROUPS_SLUG == $bp-&gt;current_component &amp;&amp; $bp-&gt;is_single_item &amp;&amp; 'forum' == $bp-&gt;current_action &amp;&amp; isset( $bp-&gt;action_variables[0] ) &amp;&amp; 'topic' == $bp-&gt;action_variables[0] )
</ins><span class="cx">                 return true;
</span><span class="cx"> 
</span><span class="cx">         return false;
</span><span class="lines">@@ -1790,7 +1790,7 @@
</span><span class="cx"> function bp_is_group_forum_topic_edit() {
</span><span class="cx">         global $bp;
</span><span class="cx"> 
</span><del>-        if ( BP_GROUPS_SLUG == $bp-&gt;current_component &amp;&amp; $bp-&gt;is_single_item &amp;&amp; 'forum' == $bp-&gt;current_action &amp;&amp; 'topic' == $bp-&gt;action_variables[0] &amp;&amp; 'edit' == $bp-&gt;action_variables[2] )
</del><ins>+        if ( BP_GROUPS_SLUG == $bp-&gt;current_component &amp;&amp; $bp-&gt;is_single_item &amp;&amp; 'forum' == $bp-&gt;current_action &amp;&amp; isset( $bp-&gt;action_variables[0] ) &amp;&amp; 'topic' == $bp-&gt;action_variables[0] &amp;&amp; isset( $bp-&gt;action_variables[2] ) &amp;&amp; 'edit' == $bp-&gt;action_variables[2] )
</ins><span class="cx">                 return true;
</span><span class="cx"> 
</span><span class="cx">         return false;
</span></span></pre></div>
<a id="trunkbpforumsbpforumstemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-forums/bp-forums-templatetags.php (3472 => 3473)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-forums/bp-forums-templatetags.php        2010-11-21 23:30:57 UTC (rev 3472)
+++ trunk/bp-forums/bp-forums-templatetags.php        2010-11-21 23:43:15 UTC (rev 3473)
</span><span class="lines">@@ -83,6 +83,9 @@
</span><span class="cx">                 $this-&gt;total_topic_count = apply_filters( 'bp_forums_template_total_topic_count', $this-&gt;total_topic_count, $this-&gt;topic_count, &amp;$topics, $type, $forum_id, $per_page, $max, $no_stickies );
</span><span class="cx"> 
</span><span class="cx">                 if ( !$no_stickies ) {
</span><ins>+                        $stickies = array();
+                        $standard = array();
+
</ins><span class="cx">                         // Place stickies at the top - not sure why bbPress doesn't do this?
</span><span class="cx">                         foreach( (array)$this-&gt;topics as $topic ) {
</span><span class="cx">                                 if ( 1 == (int)$topic-&gt;topic_sticky ) {
</span><span class="lines">@@ -187,7 +190,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /* If $_GET['fs'] is set, let's auto populate the search_terms var */
</span><del>-        if ( $bp-&gt;is_directory &amp;&amp; !empty( $_GET['fs'] ) )
</del><ins>+        if ( isset( $bp-&gt;is_directory ) &amp;&amp; !empty( $_GET['fs'] ) )
</ins><span class="cx">                 $search_terms = $_GET['fs'];
</span><span class="cx"> 
</span><span class="cx">         /* Show stickies on a group forum */
</span></span></pre></div>
<a id="trunkbpforumsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-forums.php (3472 => 3473)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-forums.php        2010-11-21 23:30:57 UTC (rev 3472)
+++ trunk/bp-forums.php        2010-11-21 23:43:15 UTC (rev 3473)
</span><span class="lines">@@ -514,7 +514,7 @@
</span><span class="cx">                 $poster_names = $wpdb-&gt;get_results( $wpdb-&gt;prepare( &quot;SELECT pd.user_id, pd.value FROM {$bp-&gt;profile-&gt;table_name_data} pd WHERE pd.user_id IN ( {$user_ids} )&quot; ) );
</span><span class="cx">                 for ( $i = 0; $i &lt; count( $posts ); $i++ ) {
</span><span class="cx">                         foreach ( (array)$poster_names as $name ) {
</span><del>-                                if ( $name-&gt;user_id == $topics[$i]-&gt;user_id )
</del><ins>+                                if ( isset( $topics[$i] ) &amp;&amp; $name-&gt;user_id == $topics[$i]-&gt;user_id )
</ins><span class="cx">                                 $posts[$i]-&gt;poster_name = $poster-&gt;value;
</span><span class="cx">                         }
</span><span class="cx">                 }
</span></span></pre></div>
<a id="trunkbpgroupsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups.php (3472 => 3473)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups.php        2010-11-21 23:30:57 UTC (rev 3472)
+++ trunk/bp-groups.php        2010-11-21 23:43:15 UTC (rev 3473)
</span><span class="lines">@@ -287,14 +287,14 @@
</span><span class="cx">         if ( $bp-&gt;is_single_item &amp;&amp; $bp-&gt;groups-&gt;current_group-&gt;user_has_access ) {
</span><span class="cx"> 
</span><span class="cx">                 /* Fetch the details we need */
</span><del>-                $topic_slug = $bp-&gt;action_variables[1];
</del><ins>+                $topic_slug = isset( $bp-&gt;action_variables[1] ) ? $bp-&gt;action_variables[1] : false;
</ins><span class="cx">                 $topic_id = bp_forums_get_topic_id_from_slug( $topic_slug );
</span><span class="cx">                 $forum_id = groups_get_groupmeta( $bp-&gt;groups-&gt;current_group-&gt;id, 'forum_id' );
</span><span class="cx"> 
</span><span class="cx">                 if ( $topic_slug &amp;&amp; $topic_id ) {
</span><span class="cx"> 
</span><span class="cx">                         /* Posting a reply */
</span><del>-                        if ( !$bp-&gt;action_variables[2] &amp;&amp; isset( $_POST['submit_reply'] ) ) {
</del><ins>+                        if ( !isset( $bp-&gt;action_variables[2] ) &amp;&amp; isset( $_POST['submit_reply'] ) ) {
</ins><span class="cx">                                 /* Check the nonce */
</span><span class="cx">                                 check_admin_referer( 'bp_forums_new_reply' );
</span><span class="cx"> 
</span><span class="lines">@@ -302,19 +302,21 @@
</span><span class="cx">                                 if ( $bp-&gt;groups-&gt;auto_join &amp;&amp; !is_super_admin() &amp;&amp; 'public' == $bp-&gt;groups-&gt;current_group-&gt;status &amp;&amp; !groups_is_user_member( $bp-&gt;loggedin_user-&gt;id, $bp-&gt;groups-&gt;current_group-&gt;id ) )
</span><span class="cx">                                         groups_join_group( $bp-&gt;groups-&gt;current_group-&gt;id, $bp-&gt;loggedin_user-&gt;id );
</span><span class="cx"> 
</span><del>-                                if ( !$post_id = groups_new_group_forum_post( $_POST['reply_text'], $topic_id, $_GET['topic_page'] ) )
</del><ins>+                                $topic_page = isset( $_GET['topic_page'] ) ? $_GET['topic_page'] : false;
+
+                                if ( !$post_id = groups_new_group_forum_post( $_POST['reply_text'], $topic_id, $topic_page ) )
</ins><span class="cx">                                         bp_core_add_message( __( 'There was an error when replying to that topic', 'buddypress'), 'error' );
</span><span class="cx">                                 else
</span><span class="cx">                                         bp_core_add_message( __( 'Your reply was posted successfully', 'buddypress') );
</span><span class="cx"> 
</span><del>-                                if ( $_SERVER['QUERY_STRING'] )
</del><ins>+                                if ( isset( $_SERVER['QUERY_STRING'] ) )
</ins><span class="cx">                                         $query_vars = '?' . $_SERVER['QUERY_STRING'];
</span><span class="cx"> 
</span><span class="cx">                                 bp_core_redirect( bp_get_group_permalink( $bp-&gt;groups-&gt;current_group ) . 'forum/topic/' . $topic_slug . '/' . $query_vars . '#post-' . $post_id );
</span><span class="cx">                         }
</span><span class="cx"> 
</span><span class="cx">                         /* Sticky a topic */
</span><del>-                        else if ( 'stick' == $bp-&gt;action_variables[2] &amp;&amp; ( $bp-&gt;is_item_admin || $bp-&gt;is_item_mod ) ) {
</del><ins>+                        else if ( isset( $bp-&gt;action_variables[2] ) &amp;&amp; 'stick' == $bp-&gt;action_variables[2] &amp;&amp; ( isset( $bp-&gt;is_item_admin ) || isset( $bp-&gt;is_item_mod ) ) ) {
</ins><span class="cx">                                 /* Check the nonce */
</span><span class="cx">                                 check_admin_referer( 'bp_forums_stick_topic' );
</span><span class="cx"> 
</span><span class="lines">@@ -328,7 +330,7 @@
</span><span class="cx">                         }
</span><span class="cx"> 
</span><span class="cx">                         /* Un-Sticky a topic */
</span><del>-                        else if ( 'unstick' == $bp-&gt;action_variables[2] &amp;&amp; ( $bp-&gt;is_item_admin || $bp-&gt;is_item_mod ) ) {
</del><ins>+                        else if ( isset( $bp-&gt;action_variables[2] ) &amp;&amp; 'unstick' == $bp-&gt;action_variables[2] &amp;&amp; ( isset( $bp-&gt;is_item_admin ) || isset( $bp-&gt;is_item_mod ) ) ) {
</ins><span class="cx">                                 /* Check the nonce */
</span><span class="cx">                                 check_admin_referer( 'bp_forums_unstick_topic' );
</span><span class="cx"> 
</span><span class="lines">@@ -342,7 +344,7 @@
</span><span class="cx">                         }
</span><span class="cx"> 
</span><span class="cx">                         /* Close a topic */
</span><del>-                        else if ( 'close' == $bp-&gt;action_variables[2] &amp;&amp; ( $bp-&gt;is_item_admin || $bp-&gt;is_item_mod ) ) {
</del><ins>+                        else if ( isset( $bp-&gt;action_variables[2] ) &amp;&amp; 'close' == $bp-&gt;action_variables[2] &amp;&amp; ( isset( $bp-&gt;is_item_admin ) || isset( $bp-&gt;is_item_mod ) ) ) {
</ins><span class="cx">                                 /* Check the nonce */
</span><span class="cx">                                 check_admin_referer( 'bp_forums_close_topic' );
</span><span class="cx"> 
</span><span class="lines">@@ -356,7 +358,7 @@
</span><span class="cx">                         }
</span><span class="cx"> 
</span><span class="cx">                         /* Open a topic */
</span><del>-                        else if ( 'open' == $bp-&gt;action_variables[2] &amp;&amp; ( $bp-&gt;is_item_admin || $bp-&gt;is_item_mod ) ) {
</del><ins>+                        else if ( isset( $bp-&gt;action_variables[2] ) &amp;&amp; 'open' == $bp-&gt;action_variables[2] &amp;&amp; ( isset( $bp-&gt;is_item_admin ) || isset( $bp-&gt;is_item_mod ) ) ) {
</ins><span class="cx">                                 /* Check the nonce */
</span><span class="cx">                                 check_admin_referer( 'bp_forums_open_topic' );
</span><span class="cx"> 
</span><span class="lines">@@ -370,7 +372,7 @@
</span><span class="cx">                         }
</span><span class="cx"> 
</span><span class="cx">                         /* Delete a topic */
</span><del>-                        else if ( 'delete' == $bp-&gt;action_variables[2] &amp;&amp; empty( $bp-&gt;action_variables[3] ) ) {
</del><ins>+                        else if ( isset( $bp-&gt;action_variables[2] ) &amp;&amp; 'delete' == $bp-&gt;action_variables[2] &amp;&amp; empty( $bp-&gt;action_variables[3] ) ) {
</ins><span class="cx">                                 /* Fetch the topic */
</span><span class="cx">                                 $topic = bp_forums_get_topic_details( $topic_id );
</span><span class="cx"> 
</span><span class="lines">@@ -391,7 +393,7 @@
</span><span class="cx">                         }
</span><span class="cx"> 
</span><span class="cx">                         /* Editing a topic */
</span><del>-                        else if ( 'edit' == $bp-&gt;action_variables[2] &amp;&amp; empty( $bp-&gt;action_variables[3] ) ) {
</del><ins>+                        else if ( isset( $bp-&gt;action_variables[2] ) &amp;&amp; 'edit' == $bp-&gt;action_variables[2] &amp;&amp; empty( $bp-&gt;action_variables[3] ) ) {
</ins><span class="cx">                                 /* Fetch the topic */
</span><span class="cx">                                 $topic = bp_forums_get_topic_details( $topic_id );
</span><span class="cx"> 
</span><span class="lines">@@ -416,7 +418,7 @@
</span><span class="cx">                         }
</span><span class="cx"> 
</span><span class="cx">                         /* Delete a post */
</span><del>-                        else if ( 'delete' == $bp-&gt;action_variables[2] &amp;&amp; $post_id = $bp-&gt;action_variables[4] ) {
</del><ins>+                        else if ( isset( $bp-&gt;action_variables[2] ) &amp;&amp; 'delete' == $bp-&gt;action_variables[2] &amp;&amp; isset( $bp-&gt;action_variables[4] ) &amp;&amp; $post_id = $bp-&gt;action_variables[4] ) {
</ins><span class="cx">                                 /* Fetch the post */
</span><span class="cx">                                 $post = bp_forums_get_post( $post_id );
</span><span class="cx"> 
</span><span class="lines">@@ -437,7 +439,7 @@
</span><span class="cx">                         }
</span><span class="cx"> 
</span><span class="cx">                         /* Editing a post */
</span><del>-                        else if ( 'edit' == $bp-&gt;action_variables[2] &amp;&amp; $post_id = $bp-&gt;action_variables[4] ) {
</del><ins>+                        else if ( isset( $bp-&gt;action_variables[2] ) &amp;&amp; 'edit' == $bp-&gt;action_variables[2] &amp;&amp; isset( $bp-&gt;action_variables[4] ) &amp;&amp; $post_id = $bp-&gt;action_variables[4] ) {
</ins><span class="cx">                                 /* Fetch the post */
</span><span class="cx">                                 $post = bp_forums_get_post( $bp-&gt;action_variables[4] );
</span><span class="cx"> 
</span><span class="lines">@@ -485,7 +487,7 @@
</span><span class="cx">                                 else if ( empty( $_POST['topic_text'] ) )
</span><span class="cx">                                         $error_message = __( 'Forum posts cannot be empty. Please enter some text.', 'buddypress' );
</span><span class="cx">                                 
</span><del>-                                if ( $error_message ) {
</del><ins>+                                if ( isset( $error_message ) ) {
</ins><span class="cx">                                         bp_core_add_message( $error_message, 'error' );
</span><span class="cx">                                         $redirect = bp_get_group_permalink( $bp-&gt;groups-&gt;current_group ) . 'forum';
</span><span class="cx">                                 } else {
</span><span class="lines">@@ -513,7 +515,7 @@
</span><span class="cx">         global $bp;
</span><span class="cx"> 
</span><span class="cx">         if ( $bp-&gt;is_single_item ) {
</span><del>-                /* Refresh the group member count meta */
</del><ins>+                // Refresh the group member count meta
</ins><span class="cx">                 groups_update_groupmeta( $bp-&gt;groups-&gt;current_group-&gt;id, 'total_member_count', groups_get_total_member_count( $bp-&gt;groups-&gt;current_group-&gt;id ) );
</span><span class="cx"> 
</span><span class="cx">                 do_action( 'groups_screen_group_members', $bp-&gt;groups-&gt;current_group-&gt;id );
</span></span></pre>
</div>
</div>

</body>
</html>