Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Extending ajax parameters

@henrywright

Moderator

2nd thoughts, there is a way of doing this without requiring changes to the core.

bp_legacy_theme_new_activity_comment() is the function where your comment form’s data is passed. You could write your own function in either a plugin or your theme’s functions.php which handles your custom data separately. You’d just need to hook it to your own custom action then write your own ajax call.

Something like:

$.ajax({
    type: 'POST',
    url: ajaxurl,
    dataType: 'json',
    data: {
        'action': 'yourcustomaction',
        'security': for_the_nonce_check,
        'str': $( '#yourform' ).serialize()
},...

Then in your PHP script:

function my_function() {
    // Do some processing just like bp_legacy_theme_new_activity_comment() does and pass whatever back to your JS
}
add_action( 'wp_ajax_yourcusomaction', 'my_function' );
Skip to toolbar