Skip to:
Content

Changeset 6326


Ignore:
Timestamp:
09/11/2012 05:53:00 PM (6 years ago)
Author:
johnjamesjacoby
Message:

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 #4510
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-actions.php

    r6259 r6326  
    326326
    327327    $comment_id = bp_activity_new_comment( array(
    328         'content' => $content,
     328        'content'     => $content,
    329329        'activity_id' => $activity_id,
    330         'parent_id' => $parent_id
     330        'parent_id'   => false
    331331    ));
    332332
  • trunk/bp-activity/bp-activity-notifications.php

    r5929 r6326  
    189189     * author of the immediate parent comment.
    190190     */
    191     if ( $activity_id == $parent_id )
     191    if ( empty( $parent_id ) || ( $activity_id == $parent_id ) )
    192192        return false;
    193193
  • trunk/bp-loader.php

    r6305 r6326  
    267267        /** Versions **********************************************************/
    268268
    269         $this->version    = '1.7-bleeding-6305';
     269        $this->version    = '1.7-bleeding-6326';
    270270        $this->db_version = 6066;
    271271
  • trunk/bp-themes/bp-default/_inc/ajax.php

    r6285 r6326  
    7676    }
    7777}
    78 add_action( 'bp_after_setup_theme', 'bp_dtheme_register_actions', 20 );
     78add_action( 'after_setup_theme', 'bp_dtheme_register_actions', 20 );
    7979
    8080/**
  • trunk/bp-themes/bp-default/_inc/global.js

    r6172 r6326  
    400400        /* Activity comment posting */
    401401        if ( target.attr('name') == 'ac_form_submit' ) {
    402             var form = target.parent().parent();
     402            var form        = target.parents( 'form' );
    403403            var form_parent = form.parent();
    404             var form_id = form.attr('id').split('-');
     404            var form_id     = form.attr('id').split('-');
    405405
    406406            if ( !form_parent.hasClass('activity-comments') ) {
     
    412412
    413413            /* Hide any error messages */
    414             jq( 'form#' + form + ' div.error').hide();
     414            jq( 'form#' + form.attr('id') + ' div.error').hide();
    415415            target.addClass('loading').prop('disabled', true);
    416416
     
    453453                            }
    454454                            );
    455                         jq( 'form#' + form + ' textarea').val('');
     455                        jq( 'form#' + form.attr('id') + ' textarea').val('');
    456456
    457457                        /* Increase the "Reply (X)" button count */
  • trunk/bp-themes/bp-legacy/buddypress-functions.php

    r6323 r6326  
    9494        add_filter( 'bp_enqueue_scripts', array( $this, 'localize_scripts' ) ); // Enqueue theme script localization
    9595        add_action( 'bp_head',            array( $this, 'head_scripts'     ) ); // Output some extra JS in the <head>
     96
     97        /** Ajax **************************************************************/
     98
     99        $actions = array(
     100
     101            // Directory filters
     102            'blogs_filter'    => 'bp_legacy_theme_object_template_loader',
     103            'forums_filter'   => 'bp_legacy_theme_object_template_loader',
     104            'groups_filter'   => 'bp_legacy_theme_object_template_loader',
     105            'members_filter'  => 'bp_legacy_theme_object_template_loader',
     106            'messages_filter' => 'bp_legacy_theme_messages_template_loader',
     107
     108            // Friends
     109            'accept_friendship' => 'bp_legacy_theme_ajax_accept_friendship',
     110            'addremove_friend'  => 'bp_legacy_theme_ajax_addremove_friend',
     111            'reject_friendship' => 'bp_legacy_theme_ajax_reject_friendship',
     112
     113            // Activity
     114            'activity_get_older_updates'  => 'bp_legacy_theme_activity_template_loader',
     115            'activity_mark_fav'           => 'bp_legacy_theme_mark_activity_favorite',
     116            'activity_mark_unfav'         => 'bp_legacy_theme_unmark_activity_favorite',
     117            'activity_widget_filter'      => 'bp_legacy_theme_activity_template_loader',
     118            'delete_activity'             => 'bp_legacy_theme_delete_activity',
     119            'delete_activity_comment'     => 'bp_legacy_theme_delete_activity_comment',
     120            'get_single_activity_content' => 'bp_legacy_theme_get_single_activity_content',
     121            'new_activity_comment'        => 'bp_legacy_theme_new_activity_comment',
     122            'post_update'                 => 'bp_legacy_theme_post_update',
     123            'bp_spam_activity'            => 'bp_legacy_theme_spam_activity',
     124            'bp_spam_activity_comment'    => 'bp_legacy_theme_spam_activity',
     125
     126            // Groups
     127            'groups_invite_user' => 'bp_legacy_theme_ajax_invite_user',
     128            'joinleave_group'    => 'bp_legacy_theme_ajax_joinleave_group',
     129
     130            // Messages
     131            'messages_autocomplete_results' => 'bp_legacy_theme_ajax_messages_autocomplete_results',
     132            'messages_close_notice'         => 'bp_legacy_theme_ajax_close_notice',
     133            'messages_delete'               => 'bp_legacy_theme_ajax_messages_delete',
     134            'messages_markread'             => 'bp_legacy_theme_ajax_message_markread',
     135            'messages_markunread'           => 'bp_legacy_theme_ajax_message_markunread',
     136            'messages_send_reply'           => 'bp_legacy_theme_ajax_messages_send_reply',
     137        );
     138
     139        /**
     140         * Register all of these AJAX handlers
     141         *
     142         * The "wp_ajax_" action is used for logged in users, and "wp_ajax_nopriv_"
     143         * executes for users that aren't logged in. This is for backpat with BP <1.6.
     144         */
     145        foreach( $actions as $name => $function ) {
     146            add_action( 'wp_ajax_'        . $name, $function );
     147            add_action( 'wp_ajax_nopriv_' . $name, $function );
     148        }
     149
     150        add_filter( 'bp_ajax_querystring', 'bp_legacy_theme_ajax_querystring', 10, 2 );
    96151
    97152        /** Override **********************************************************/
     
    214269
    215270/**
    216  * AJAX Functions
    217  *
    218  * All of these functions enhance the responsiveness of the user interface in
    219  * the legacy theme by adding AJAX functionality.
    220  *
    221  * For more information on how the custom AJAX functions work, see
    222  * http://codex.wordpress.org/AJAX_in_Plugins.
    223  *
    224  * @package BuddyPress
    225  * @since BuddyPress (1.2)
    226  * @subpackage BP_Legacy
    227  */
    228 
    229 /**
    230  * Register AJAX handlers for BP Legacy theme functionality.
    231  *
    232  * This function is registered to the after_setup_theme hook with priority 20 as
    233  * this file is included in a function hooked to after_setup_theme at priority 10.
    234  *
    235  * @since BuddyPress (1.6)
    236  */
    237 function bp_legacy_theme_register_actions() {
    238     $actions = array(
    239         // Directory filters
    240         'blogs_filter'    => 'bp_legacy_theme_object_template_loader',
    241         'forums_filter'   => 'bp_legacy_theme_object_template_loader',
    242         'groups_filter'   => 'bp_legacy_theme_object_template_loader',
    243         'members_filter'  => 'bp_legacy_theme_object_template_loader',
    244         'messages_filter' => 'bp_legacy_theme_messages_template_loader',
    245 
    246         // Friends
    247         'accept_friendship' => 'bp_legacy_theme_ajax_accept_friendship',
    248         'addremove_friend'  => 'bp_legacy_theme_ajax_addremove_friend',
    249         'reject_friendship' => 'bp_legacy_theme_ajax_reject_friendship',
    250 
    251         // Activity
    252         'activity_get_older_updates'  => 'bp_legacy_theme_activity_template_loader',
    253         'activity_mark_fav'           => 'bp_legacy_theme_mark_activity_favorite',
    254         'activity_mark_unfav'         => 'bp_legacy_theme_unmark_activity_favorite',
    255         'activity_widget_filter'      => 'bp_legacy_theme_activity_template_loader',
    256         'delete_activity'             => 'bp_legacy_theme_delete_activity',
    257         'delete_activity_comment'     => 'bp_legacy_theme_delete_activity_comment',
    258         'get_single_activity_content' => 'bp_legacy_theme_get_single_activity_content',
    259         'new_activity_comment'        => 'bp_legacy_theme_new_activity_comment',
    260         'post_update'                 => 'bp_legacy_theme_post_update',
    261         'bp_spam_activity'            => 'bp_legacy_theme_spam_activity',
    262         'bp_spam_activity_comment'    => 'bp_legacy_theme_spam_activity',
    263 
    264         // Groups
    265         'groups_invite_user' => 'bp_legacy_theme_ajax_invite_user',
    266         'joinleave_group'    => 'bp_legacy_theme_ajax_joinleave_group',
    267 
    268         // Messages
    269         'messages_autocomplete_results' => 'bp_legacy_theme_ajax_messages_autocomplete_results',
    270         'messages_close_notice'         => 'bp_legacy_theme_ajax_close_notice',
    271         'messages_delete'               => 'bp_legacy_theme_ajax_messages_delete',
    272         'messages_markread'             => 'bp_legacy_theme_ajax_message_markread',
    273         'messages_markunread'           => 'bp_legacy_theme_ajax_message_markunread',
    274         'messages_send_reply'           => 'bp_legacy_theme_ajax_messages_send_reply',
    275     );
    276 
    277     /**
    278      * Register all of these AJAX handlers
    279      *
    280      * The "wp_ajax_" action is used for logged in users, and "wp_ajax_nopriv_"
    281      * executes for users that aren't logged in. This is for backpat with BP <1.6.
    282      */
    283     foreach( $actions as $name => $function ) {
    284         add_action( 'wp_ajax_'        . $name, $function );
    285         add_action( 'wp_ajax_nopriv_' . $name, $function );
    286     }
    287 }
    288 add_action( 'bp_after_setup_theme', 'bp_legacy_theme_register_actions', 20 );
    289 
    290 /**
    291271 * This function looks scarier than it actually is. :)
    292272 * Each object loop (activity/members/groups/blogs/forums) contains default
     
    371351    return apply_filters( 'bp_legacy_theme_ajax_querystring', $query_string, $object, $object_filter, $object_scope, $object_page, $object_search_terms, $object_extras );
    372352}
    373 add_filter( 'bp_ajax_querystring', 'bp_legacy_theme_ajax_querystring', 10, 2 );
    374353
    375354/**
  • trunk/bp-themes/bp-legacy/js/buddypress.js

    r6284 r6326  
    412412
    413413            /* Hide any error messages */
    414             jq( 'form#' + form + ' div.error').hide();
     414            jq( 'form#' + form.attr('id') + ' div.error').hide();
    415415            target.addClass('loading').prop('disabled', true);
    416416
     
    453453                            }
    454454                            );
    455                         jq( 'form#' + form + ' textarea').val('');
     455                        jq( 'form#' + form.attr('id') + ' textarea').val('');
    456456
    457457                        /* Increase the "Reply (X)" button count */
Note: See TracChangeset for help on using the changeset viewer.