Skip to:
Content
Pages
Categories
Search
Top
Bottom

Activity Post/Reply To Not Working

  • Hi, I’m using BuddyPress 1.2.8 with WordPress 3.1.3, and when I use the factory default BuddyPress theme (1.2.7), everything works great :)

    But, when I activate the BuddyBase theme (a free BuddyPress theme from BuddyBoss), everything works, except for the Activity area. In the Activity area if I try to post an update or reply to any activity items…nothing happens :(

    I tried to follow what was happening with FireDebug and in Chrome by watching the Network tab, and basically the Post button always calls wp-load.php with some POST variables (obviously an Ajax request to update the activity list). I guess this is supposed to somehow invoke remote Ajax functions in BuddyBase theme PHP files, but it doesn’t appear to be working.

    The result coming back from the wp-load.php AJAX calls is always status 200 (OK) with an empty string, no error message, no content…just nothing :(

    As I say, with the default BuddyPress theme it works fine, so it seems pretty clear that the BuddyBase theme isn’t handling the Ajax stuff properly via wp-load.php.

    How can I start debugging this? If someone can point me to some kind of flow of operations that gets the Ajax call from wp-load.php to the actual handling functions, maybe I can try to debug and fix this. It may not even be that big a bug…but I don’t know where to start putting some error_log() statements to try and follow the control flow.

    How does the wp-load.php connect to the actual Ajax handling functions for Activity updates?

    Thanks for any help/pointers. We like the BuddyBase theme, I’d like to fix it and continue using it. This is the only spot where it seems to not work so well.

Viewing 8 replies - 1 through 8 (of 8 total)

  • Brajesh Singh
    Participant

    @sbrajesh

    Hi,
    Look for the post request. You will see some variable as action:”post_update” or something similar. Then look into your themes ajax.php(most probably in _inc/ajax.php) for a hook wp_ajax_{the action_name} , i.e. wp_ajax_post_update in this case. There will be a function attached to that. You can put your debug code in that function.

    rest is correct on your setup. The request will always go to wp-load.php, so that is right. Just investigate the attached function for debugging.

    Cool, thank! I’m trying that now…

    I’m going to try this suggestion

    {quote}
    Brajesh Singh said 5 hours, 36 minutes ago:

    Hi,
    Look for the post request. You will see some variable as action:”post_update” or something similar. Then look into your themes ajax.php(most probably in _inc/ajax.php) for a hook wp_ajax_{the action_name} , i.e. wp_ajax_post_update in this case. There will be a function attached to that. You can put your debug code in that function.
    {quote}

    find . | xargs fgrep

    ./_inc/global.js
    ./_inc/ajax.php

    (basically the Ajax related code)

    From the ajax code in BuddyBase theme, no hits not being invoked. So I went back to the BuddyPress plugin, and added some erro_log calls to bp-activity.php…that got his, so the Ajax frame work is working, just not connecting to the theme.

    From the stack trace of bp-activity, it looks like wp-load.php leads to wp-settings.php, which loads up bp-loader.php…I imagine bp-loader.php is what brings in any necessary BuddyPress stuff.

    Anyways, I confirmed that bp-activity.php (in the BuddyPress plugin, not the BuddyBase theme) is calling:

    add_action( ‘wp’, ‘bp_activity_action_post_update’, 3 );

    So the activity handler should be getting called…but it doesn’t. I put some logging in that function (bp_activity_action_post_update), and its not getting called. :(

    The ‘wp’ hook seems like the place I would expect this to run; its Ajax so the theme/template isn’t actually needed, it just neesd th POST data. So the logic seems right.

    At least the API reference says wp is used for POST processing:

    https://codex.wordpress.org/Plugin_API/Action_Reference

    I guess I need to dig around find where WordPress is invoking any wp hooks, and then try to see why its not invoking this POST handler.


    Brajesh Singh
    Participant

    @sbrajesh

    Hi,
    It seems you went in a little different direction. The
    `
    add_action( ‘wp’, ‘bp_activity_action_post_update’, 3 );
    `
    Is used for the time when javascript is disabled. Please have a look at bp-default/_inc/ajax.php and the line

    add_action(‘wp_ajax_post_update’,’bp_dtheme_post_update’);

    this is used by bp-default for posting update in ajax mode. I hope you can find something similar in your theme.

    yeah, when I started looking through the wp hook, it became more clear that the bp-activity.php stuff is not the right place to look. It seems to get called for displaying the stream, not for updating it.

    thanks for the tip, I’m going to go look at that now…

    Ok, so in the working default BuddyPress theme the Ajax handler works great:

    bp_dtheme_post_update traceback:

    #0 bp_dtheme_post_update() called at [:]

    #1 call_user_func_array() called at
    [wp-includes/plugin.php:395]

    #2 do_action() called at
    [wp-content/plugins/buddypress/bp-core.php:2026]

    #3 bp_core_add_ajax_hook() called at [:]

    #4 call_user_func_array() called at
    [wp-includes/plugin.php:395]

    #5 do_action() called at
    [wp-settings.php:298]

    #6 require_once(/home2/capacoac/public_html/artsbeta/wp-settings.php) called at
    [wp-config.php:91]

    #7 require_once(/home2/capacoac/public_html/artsbeta/wp-config.php) called at
    [wp-load.php:30]

    When doing a normal status update it seems to flow normally:

    top of bp_dtheme_post_update in bp-theme-default…
    . content=james
    . object=
    . calling bp_activity_post_update (no object)…
    . calling user func tag=wp_default_styles

    My status update was “james”. So all working well for the default BuddyPress theme.

    Now with BuddyBase activated none of that entire call chain happens and neither does it happen from the default buddy base theme. its like ajax.php is no longer being loaded.

    To verify I put an error_log call at the top of the BuddyBase copy of _inc/ajax.php, just to indicate that _its_ version of ajax.php was being loaded…and its not. For some reason the BuddyBase theme is not having its version of ajax.php loaded.

    I’m not really sure hwo to verify how the theme tells WordPress/BuddyPress to load that file, but I guess I have another lead to track down….

    sigh, I found the problem….in theme template for BuddyBase, my line to require TEMPLATEPATH.”_inc/ajax.php” was commented out.

    The phrase “did you plug it in” comes to mind :(

    I think what happened was that while earlier working on the theme I had some problems with overlapping function calls and I commented it out to rsolve conflicting function re-defs. I later did a clean install of all my plugins etc, but forgot to actually start with a clean copy of BuddyBase (the theme itself).

    I just tested and its working now, no problems ::)

    Thanks for the tips, I’m a lot more familiar with WP innards now :)

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Activity Post/Reply To Not Working’ is closed to new replies.
Skip to toolbar