Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Activity stream user id & scope ignored when using AJAX in custom theme

  • Apologies in advance for the wall of text.

    I’m working on a heavily customized site that’s being reworked to include BuddyPress. I was brought on to this project several months after it started, and I don’t have access to the original developer. I’ve been able to integrate BP fine, fixing bugs as they came up, with one exception: the activity stream isn’t working quite right when using AJAX.

    Here’s an outline of what’s happening:

    User Profile > Activity > Personal: On first page load, displays only that user’s activity and obeys whichever drop-down filter was last chosen. Using the drop-down to change/remove the filter sends the request through AJAX and displays a response, but the response is no longer unique to that user. The drop-down filter is obeyed, but it displays applicable activity from every registered user.

    User Profile > Activity > Mentions: Correct on page load, then it’s no longer user-specific after choosing a different filter. It also ignores the “Mentions” scope and loads all activity from all users that fits the filter.

    User Profile > Activity > Friends: Same as Personal tab. On page load it is correctly displaying activity from that user’s friends, after choosing a filter it includes all users.

    This website has passed through so many different hands for over a year, and as such the code is very complex and custom. BP Template Pack v1.1.3 was originally used as the basis for any BuddyPress templates in the theme. I’m not looking for someone to fix my problem for me, I’m just looking for any input anyone has on AJAX activity stream requests and exactly how the query works. I get lost after tracing it back through the 6th or 7th theme/plugin file. I’m also confused as to why the “bp-activity-scope” cookie is always set to null on a fresh BP install using the default BP theme, and somehow the Mentions/Friends/etc. scopes still work.

    Side note that may or may not be part of the problem: I’m using `wp-admin/admin-ajax.php` for the `ajaxurl` variable instead of `wp-load.php` (the BP default). I couldn’t get AJAX to work at all using `wp-load.php`.

    Does anyone have any insight?

    Website information is below.

    1. WordPress version: 3.2.1
    2. WordPress is installed on a subdomain, and is not multisite
    3. WordPress is installed in root
    4. This issue happened long after upgrading to 3.2.1 (i.e. upgrade to 3.2.1 isn’t relevant to issue)
    5. WordPress was functioning properly before adding BuddyPress
    6. BuddyPress version: 1.5
    7. Since I started on this project, I’ve upgraded BP to 1.5. The issue wasn’t discovered until long after the upgrade, but it wasn’t being tested for right away, so it’s possible the upgrade caused the problem.
    8. Active plugins:

    Advertising Manager v3.4.19
    Akismet v2.5.3
    BuddyPress v1.5
    BuddyPress Activity Plus v1.2.1.9
    BuddyPress Album v0.1.8.11
    BuddyPress Template Pack v1.1.3
    Disqus Comment System v2.66
    Front-end Editor v2.1.3
    Google Analyticator v6.1.3
    Gravity Forms v1.5.2.8
    Gravity Forms + Custom Post Types v2.1
    Image Widget v3.2.8
    Members v0.2
    Quick Flickr Widget v1.2.10
    Regenerate Thumbnails v2.2.0
    W3 Total Cache v0.9.2.4
    WordPress Importer v0.5

    9. The site’s theme is heavily customized, with template files from bp-template-pack version 1.1.3
    10. No WordPress core files have been modified, but one modification has been made to BP core files
    11. There are a lot of custom functions in bp-custom.php
    12. The site is not running bbPress
    13. This error appears in the log when I trigger the issue (I need to obscure domain & IP address):

    2011/11/09 17:19:20 [crit] 20565#0: *6552 connect() to unix:/tmp/php-cgi.socket failed (2: No such file or directory) while connecting to upstream, client: 67.***.**.2, server: domain.com, request: “POST /wp-admin/admin-ajax.php HTTP/1.1”, upstream: “fastcgi://unix:/tmp/php-cgi.socket:”, host: “prod.domain.com”, referrer: “http://prod.domain.com/members/abarrett/”

    14. Amazon EC2 hosts the server
    15. Server is running nginx

Viewing 1 replies (of 1 total)
  • I found the solution. (I didn’t actually solve it in 2 hours – there were a good 16 hours poured into this issue before my post.) Two very important things.

    1. Be sure to include the `_inc/ajax.php` file – from the BP default theme – BEFORE the ‘init’ action. The action hook ‘after_setup_theme’ will work.

    2. Retain `wp-load.php` as the AJAX url in `global.js`.

    After these two steps (and 18 hours of frustratingly trying everything else) it worked like a charm.

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Activity stream user id & scope ignored when using AJAX in custom theme’ is closed to new replies.
Skip to toolbar