Re: Reply to first item in activity stream fails
Is this the section (line 309+)? Sorry – I’ve never bothered to look at the JavaScript for BP.
` /* Activity comment posting */
if ( target.attr(‘name’) == ‘ac_form_submit’ ) {
var form = target.parent().parent();
var form_parent = form.parent();
var form_id = form.attr(‘id’).split(‘-‘);
if ( ‘activity-comments’ !== form_parent.attr(‘class’) ) {
var tmp_id = form_parent.attr(‘id’).split(‘-‘);
var comment_id = tmp_id[1];
} else {
var comment_id = form_id[2];
}
/* Hide any error messages */
jq( ‘form#’ + form + ‘ div.error’).hide();
form.addClass(‘loading’);
target.css(‘disabled’, ‘disabled’);
jq.post( ajaxurl, {
action: ‘new_activity_comment’,
‘cookie’: encodeURIComponent(document.cookie),
‘_wpnonce_new_activity_comment’: jq(“input#_wpnonce_new_activity_comment”).val(),
‘comment_id’: comment_id,
‘form_id’: form_id[2],
‘content’: jq(‘form#’ + form.attr(‘id’) + ‘ textarea’).val()
},
function(response)
{
form.removeClass(‘loading’);
/* Check for errors and append if found. */
if ( response[0] + response[1] == ‘-1’ ) {
form.append( response.substr( 2, response.length ) ).hide().fadeIn( 200 );
target.attr(“disabled”, ”);
} else {
form.fadeOut( 200,
function() {
if ( 0 == form.parent().children(‘ul’).length ) {
if ( form.parent().attr(‘class’) == ‘activity-comments’ )
form.parent().prepend(‘
‘);
else
form.parent().append(‘
‘);
}
form.parent().children(‘ul’).append(response).hide().fadeIn( 200 );
form.children(‘textarea’).val(”);
form.parent().parent().addClass(‘has-comments’);
}
);
jq( ‘form#’ + form + ‘ textarea’).val(”);
/* Increase the “Reply (X)” button count */
jq(‘li#activity-‘ + form_id[2] + ‘ a.acomment-reply span’).html( Number( jq(‘li#activity-‘ + form_id[2] + ‘ a.acomment-reply span’).html() ) + 1 );
/* Re-enable the submit button after 5 seconds. */
setTimeout( function() { target.attr(“disabled”, ”); }, 5000 );
}
});
return false;
}`