<!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][6326] trunk: Theme Compat:</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, #logmsg > ol { margin-left: 0; 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">
<dt>Revision</dt> <dd><a href="http://buddypress.trac.wordpress.org/changeset/6326">6326</a></dd>
<dt>Author</dt> <dd>johnjamesjacoby</dd>
<dt>Date</dt> <dd>2012-09-11 17:53:00 +0000 (Tue, 11 Sep 2012)</dd>
</dl>
<h3>Log Message</h3>
<pre>Theme Compat:
* Prevent firing ajax actions inside buddypress-functions.php when bp-default is active in theme stack.
* Revert part of r6285 and put bp-default actions back on after_setup_theme for backpat.
* Repair some bp-default JS that never worked correctly.
* Prevent debug notices in activity stream comment posting and notification sending if not AJAX.
* Also fixes bp-legacy ajax activity comment posting.
* Fixes <a href="http://buddypress.trac.wordpress.org/ticket/4510">#4510</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpactivitybpactivityactionsphp">trunk/bp-activity/bp-activity-actions.php</a></li>
<li><a href="#trunkbpactivitybpactivitynotificationsphp">trunk/bp-activity/bp-activity-notifications.php</a></li>
<li><a href="#trunkbploaderphp">trunk/bp-loader.php</a></li>
<li><a href="#trunkbpthemesbpdefault_incajaxphp">trunk/bp-themes/bp-default/_inc/ajax.php</a></li>
<li><a href="#trunkbpthemesbpdefault_incglobaljs">trunk/bp-themes/bp-default/_inc/global.js</a></li>
<li><a href="#trunkbpthemesbplegacybuddypressfunctionsphp">trunk/bp-themes/bp-legacy/buddypress-functions.php</a></li>
<li><a href="#trunkbpthemesbplegacyjsbuddypressjs">trunk/bp-themes/bp-legacy/js/buddypress.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpactivitybpactivityactionsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity/bp-activity-actions.php (6325 => 6326)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-actions.php        2012-09-11 17:36:26 UTC (rev 6325)
+++ trunk/bp-activity/bp-activity-actions.php        2012-09-11 17:53:00 UTC (rev 6326)
</span><span class="lines">@@ -325,9 +325,9 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         $comment_id = bp_activity_new_comment( array(
</span><del>-                'content' => $content,
</del><ins>+                'content' => $content,
</ins><span class="cx">                 'activity_id' => $activity_id,
</span><del>-                'parent_id' => $parent_id
</del><ins>+                'parent_id' => false
</ins><span class="cx">         ));
</span><span class="cx">
</span><span class="cx">         if ( !empty( $comment_id ) )
</span></span></pre></div>
<a id="trunkbpactivitybpactivitynotificationsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity/bp-activity-notifications.php (6325 => 6326)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-notifications.php        2012-09-11 17:36:26 UTC (rev 6325)
+++ trunk/bp-activity/bp-activity-notifications.php        2012-09-11 17:53:00 UTC (rev 6326)
</span><span class="lines">@@ -188,7 +188,7 @@
</span><span class="cx">          * If this is a reply to another comment, send an email notification to the
</span><span class="cx">          * author of the immediate parent comment.
</span><span class="cx">          */
</span><del>-        if ( $activity_id == $parent_id )
</del><ins>+        if ( empty( $parent_id ) || ( $activity_id == $parent_id ) )
</ins><span class="cx">                 return false;
</span><span class="cx">
</span><span class="cx">         $parent_comment = new BP_Activity_Activity( $parent_id );
</span></span></pre></div>
<a id="trunkbploaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-loader.php (6325 => 6326)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-loader.php        2012-09-11 17:36:26 UTC (rev 6325)
+++ trunk/bp-loader.php        2012-09-11 17:53:00 UTC (rev 6326)
</span><span class="lines">@@ -266,7 +266,7 @@
</span><span class="cx">
</span><span class="cx">                 /** Versions **********************************************************/
</span><span class="cx">
</span><del>-                $this->version = '1.7-bleeding-6305';
</del><ins>+                $this->version = '1.7-bleeding-6326';
</ins><span class="cx">                 $this->db_version = 6066;
</span><span class="cx">
</span><span class="cx">                 /** Loading ***********************************************************/
</span></span></pre></div>
<a id="trunkbpthemesbpdefault_incajaxphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/_inc/ajax.php (6325 => 6326)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/_inc/ajax.php        2012-09-11 17:36:26 UTC (rev 6325)
+++ trunk/bp-themes/bp-default/_inc/ajax.php        2012-09-11 17:53:00 UTC (rev 6326)
</span><span class="lines">@@ -75,7 +75,7 @@
</span><span class="cx">                 add_action( 'wp_ajax_nopriv_' . $name, $function );
</span><span class="cx">         }
</span><span class="cx"> }
</span><del>-add_action( 'bp_after_setup_theme', 'bp_dtheme_register_actions', 20 );
</del><ins>+add_action( 'after_setup_theme', 'bp_dtheme_register_actions', 20 );
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * This function looks scarier than it actually is. :)
</span></span></pre></div>
<a id="trunkbpthemesbpdefault_incglobaljs"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/_inc/global.js (6325 => 6326)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/_inc/global.js        2012-09-11 17:36:26 UTC (rev 6325)
+++ trunk/bp-themes/bp-default/_inc/global.js        2012-09-11 17:53:00 UTC (rev 6326)
</span><span class="lines">@@ -399,9 +399,9 @@
</span><span class="cx">
</span><span class="cx">                 /* Activity comment posting */
</span><span class="cx">                 if ( target.attr('name') == 'ac_form_submit' ) {
</span><del>-                        var form = target.parent().parent();
</del><ins>+                        var form = target.parents( 'form' );
</ins><span class="cx">                         var form_parent = form.parent();
</span><del>-                        var form_id = form.attr('id').split('-');
</del><ins>+                        var form_id = form.attr('id').split('-');
</ins><span class="cx">
</span><span class="cx">                         if ( !form_parent.hasClass('activity-comments') ) {
</span><span class="cx">                                 var tmp_id = form_parent.attr('id').split('-');
</span><span class="lines">@@ -411,7 +411,7 @@
</span><span class="cx">                         }
</span><span class="cx">
</span><span class="cx">                         /* Hide any error messages */
</span><del>-                        jq( 'form#' + form + ' div.error').hide();
</del><ins>+                        jq( 'form#' + form.attr('id') + ' div.error').hide();
</ins><span class="cx">                         target.addClass('loading').prop('disabled', true);
</span><span class="cx">
</span><span class="cx">                         var ajaxdata = {
</span><span class="lines">@@ -452,7 +452,7 @@
</span><span class="cx">                                                                 form.parent().parent().addClass('has-comments');
</span><span class="cx">                                                         }
</span><span class="cx">                                                         );
</span><del>-                                                jq( 'form#' + form + ' textarea').val('');
</del><ins>+                                                jq( 'form#' + form.attr('id') + ' textarea').val('');
</ins><span class="cx">
</span><span class="cx">                                                 /* Increase the "Reply (X)" button count */
</span><span class="cx">                                                 jq('li#activity-' + form_id[2] + ' a.acomment-reply span').html( Number( jq('li#activity-' + form_id[2] + ' a.acomment-reply span').html() ) + 1 );
</span></span></pre></div>
<a id="trunkbpthemesbplegacybuddypressfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-legacy/buddypress-functions.php (6325 => 6326)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-legacy/buddypress-functions.php        2012-09-11 17:36:26 UTC (rev 6325)
+++ trunk/bp-themes/bp-legacy/buddypress-functions.php        2012-09-11 17:53:00 UTC (rev 6326)
</span><span class="lines">@@ -94,6 +94,61 @@
</span><span class="cx">                 add_filter( 'bp_enqueue_scripts', array( $this, 'localize_scripts' ) ); // Enqueue theme script localization
</span><span class="cx">                 add_action( 'bp_head', array( $this, 'head_scripts' ) ); // Output some extra JS in the <head>
</span><span class="cx">
</span><ins>+                /** Ajax **************************************************************/
+
+                $actions = array(
+
+                        // Directory filters
+                        'blogs_filter' => 'bp_legacy_theme_object_template_loader',
+                        'forums_filter' => 'bp_legacy_theme_object_template_loader',
+                        'groups_filter' => 'bp_legacy_theme_object_template_loader',
+                        'members_filter' => 'bp_legacy_theme_object_template_loader',
+                        'messages_filter' => 'bp_legacy_theme_messages_template_loader',
+
+                        // Friends
+                        'accept_friendship' => 'bp_legacy_theme_ajax_accept_friendship',
+                        'addremove_friend' => 'bp_legacy_theme_ajax_addremove_friend',
+                        'reject_friendship' => 'bp_legacy_theme_ajax_reject_friendship',
+
+                        // Activity
+                        'activity_get_older_updates' => 'bp_legacy_theme_activity_template_loader',
+                        'activity_mark_fav' => 'bp_legacy_theme_mark_activity_favorite',
+                        'activity_mark_unfav' => 'bp_legacy_theme_unmark_activity_favorite',
+                        'activity_widget_filter' => 'bp_legacy_theme_activity_template_loader',
+                        'delete_activity' => 'bp_legacy_theme_delete_activity',
+                        'delete_activity_comment' => 'bp_legacy_theme_delete_activity_comment',
+                        'get_single_activity_content' => 'bp_legacy_theme_get_single_activity_content',
+                        'new_activity_comment' => 'bp_legacy_theme_new_activity_comment',
+                        'post_update' => 'bp_legacy_theme_post_update',
+                        'bp_spam_activity' => 'bp_legacy_theme_spam_activity',
+                        'bp_spam_activity_comment' => 'bp_legacy_theme_spam_activity',
+
+                        // Groups
+                        'groups_invite_user' => 'bp_legacy_theme_ajax_invite_user',
+                        'joinleave_group' => 'bp_legacy_theme_ajax_joinleave_group',
+
+                        // Messages
+                        'messages_autocomplete_results' => 'bp_legacy_theme_ajax_messages_autocomplete_results',
+                        'messages_close_notice' => 'bp_legacy_theme_ajax_close_notice',
+                        'messages_delete' => 'bp_legacy_theme_ajax_messages_delete',
+                        'messages_markread' => 'bp_legacy_theme_ajax_message_markread',
+                        'messages_markunread' => 'bp_legacy_theme_ajax_message_markunread',
+                        'messages_send_reply' => 'bp_legacy_theme_ajax_messages_send_reply',
+                );
+
+                /**
+                 * Register all of these AJAX handlers
+                 *
+                 * The "wp_ajax_" action is used for logged in users, and "wp_ajax_nopriv_"
+                 * executes for users that aren't logged in. This is for backpat with BP <1.6.
+                 */
+                foreach( $actions as $name => $function ) {
+                        add_action( 'wp_ajax_' . $name, $function );
+                        add_action( 'wp_ajax_nopriv_' . $name, $function );
+                }
+
+                add_filter( 'bp_ajax_querystring', 'bp_legacy_theme_ajax_querystring', 10, 2 );
+
</ins><span class="cx">                 /** Override **********************************************************/
</span><span class="cx">
</span><span class="cx">                 do_action_ref_array( 'bp_theme_compat_actions', array( &$this ) );
</span><span class="lines">@@ -213,81 +268,6 @@
</span><span class="cx"> endif;
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * AJAX Functions
- *
- * All of these functions enhance the responsiveness of the user interface in
- * the legacy theme by adding AJAX functionality.
- *
- * For more information on how the custom AJAX functions work, see
- * http://codex.wordpress.org/AJAX_in_Plugins.
- *
- * @package BuddyPress
- * @since BuddyPress (1.2)
- * @subpackage BP_Legacy
- */
-
-/**
- * Register AJAX handlers for BP Legacy theme functionality.
- *
- * This function is registered to the after_setup_theme hook with priority 20 as
- * this file is included in a function hooked to after_setup_theme at priority 10.
- *
- * @since BuddyPress (1.6)
- */
-function bp_legacy_theme_register_actions() {
-        $actions = array(
-                // Directory filters
-                'blogs_filter' => 'bp_legacy_theme_object_template_loader',
-                'forums_filter' => 'bp_legacy_theme_object_template_loader',
-                'groups_filter' => 'bp_legacy_theme_object_template_loader',
-                'members_filter' => 'bp_legacy_theme_object_template_loader',
-                'messages_filter' => 'bp_legacy_theme_messages_template_loader',
-
-                // Friends
-                'accept_friendship' => 'bp_legacy_theme_ajax_accept_friendship',
-                'addremove_friend' => 'bp_legacy_theme_ajax_addremove_friend',
-                'reject_friendship' => 'bp_legacy_theme_ajax_reject_friendship',
-
-                // Activity
-                'activity_get_older_updates' => 'bp_legacy_theme_activity_template_loader',
-                'activity_mark_fav' => 'bp_legacy_theme_mark_activity_favorite',
-                'activity_mark_unfav' => 'bp_legacy_theme_unmark_activity_favorite',
-                'activity_widget_filter' => 'bp_legacy_theme_activity_template_loader',
-                'delete_activity' => 'bp_legacy_theme_delete_activity',
-                'delete_activity_comment' => 'bp_legacy_theme_delete_activity_comment',
-                'get_single_activity_content' => 'bp_legacy_theme_get_single_activity_content',
-                'new_activity_comment' => 'bp_legacy_theme_new_activity_comment',
-                'post_update' => 'bp_legacy_theme_post_update',
-                'bp_spam_activity' => 'bp_legacy_theme_spam_activity',
-                'bp_spam_activity_comment' => 'bp_legacy_theme_spam_activity',
-
-                // Groups
-                'groups_invite_user' => 'bp_legacy_theme_ajax_invite_user',
-                'joinleave_group' => 'bp_legacy_theme_ajax_joinleave_group',
-
-                // Messages
-                'messages_autocomplete_results' => 'bp_legacy_theme_ajax_messages_autocomplete_results',
-                'messages_close_notice' => 'bp_legacy_theme_ajax_close_notice',
-                'messages_delete' => 'bp_legacy_theme_ajax_messages_delete',
-                'messages_markread' => 'bp_legacy_theme_ajax_message_markread',
-                'messages_markunread' => 'bp_legacy_theme_ajax_message_markunread',
-                'messages_send_reply' => 'bp_legacy_theme_ajax_messages_send_reply',
-        );
-
-        /**
-         * Register all of these AJAX handlers
-         *
-         * The "wp_ajax_" action is used for logged in users, and "wp_ajax_nopriv_"
-         * executes for users that aren't logged in. This is for backpat with BP <1.6.
-         */
-        foreach( $actions as $name => $function ) {
-                add_action( 'wp_ajax_' . $name, $function );
-                add_action( 'wp_ajax_nopriv_' . $name, $function );
-        }
-}
-add_action( 'bp_after_setup_theme', 'bp_legacy_theme_register_actions', 20 );
-
-/**
</del><span class="cx"> * This function looks scarier than it actually is. :)
</span><span class="cx"> * Each object loop (activity/members/groups/blogs/forums) contains default
</span><span class="cx"> * parameters to show specific information based on the page we are currently
</span><span class="lines">@@ -370,7 +350,6 @@
</span><span class="cx">
</span><span class="cx">         return apply_filters( 'bp_legacy_theme_ajax_querystring', $query_string, $object, $object_filter, $object_scope, $object_page, $object_search_terms, $object_extras );
</span><span class="cx"> }
</span><del>-add_filter( 'bp_ajax_querystring', 'bp_legacy_theme_ajax_querystring', 10, 2 );
</del><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Load the template loop for the current object.
</span></span></pre></div>
<a id="trunkbpthemesbplegacyjsbuddypressjs"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-legacy/js/buddypress.js (6325 => 6326)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-legacy/js/buddypress.js        2012-09-11 17:36:26 UTC (rev 6325)
+++ trunk/bp-themes/bp-legacy/js/buddypress.js        2012-09-11 17:53:00 UTC (rev 6326)
</span><span class="lines">@@ -411,7 +411,7 @@
</span><span class="cx">                         }
</span><span class="cx">
</span><span class="cx">                         /* Hide any error messages */
</span><del>-                        jq( 'form#' + form + ' div.error').hide();
</del><ins>+                        jq( 'form#' + form.attr('id') + ' div.error').hide();
</ins><span class="cx">                         target.addClass('loading').prop('disabled', true);
</span><span class="cx">
</span><span class="cx">                         var ajaxdata = {
</span><span class="lines">@@ -452,7 +452,7 @@
</span><span class="cx">                                                                 form.parent().parent().addClass('has-comments');
</span><span class="cx">                                                         }
</span><span class="cx">                                                         );
</span><del>-                                                jq( 'form#' + form + ' textarea').val('');
</del><ins>+                                                jq( 'form#' + form.attr('id') + ' textarea').val('');
</ins><span class="cx">
</span><span class="cx">                                                 /* Increase the "Reply (X)" button count */
</span><span class="cx">                                                 jq('li#activity-' + form_id[2] + ' a.acomment-reply span').html( Number( jq('li#activity-' + form_id[2] + ' a.acomment-reply span').html() ) + 1 );
</span></span></pre>
</div>
</div>
</body>
</html>