Skip to:
Content
Pages
Categories
Search
Top
Bottom

Integrating AJAX Activity Stream with custom markup

  • @marcella1981

    Participant

    WordPress: 4.0 BuddyPress: 2.1 My site: http://www.pixelcoder.co.uk/

    I’ve been building my own personal theme and with the latest release of BuddyPress the pagination no longer works.

    Now seems to be the time to ajaxify the Activity Streams in this theme, thing is… I don’t have a clue how to do it.

    I have custom markup in place within activity-loop.php and entry.php, so it’s not going to work. Also I don’t load buddypress.js in my theme.

    I read this article http://bpdevel.wordpress.com/2014/06/09/changes-to-bp_has_activities-queries-in-bp-2-1/ but I didn’t really understand it.

    Would be ever so grateful if someone could give me some pointers as to how to integrate this functionality.

    Many thanks!

Viewing 9 replies - 1 through 9 (of 9 total)
  • @marcella1981

    Participant

    *bump*

    @hnla

    Participant

    Also I don’t load buddypress.js in my theme.

    Well that’s going to be a bit of an issue then, why are you not enqueueing the BP primary js file? This file handles a lot of BP JS functionality without wish your site experience is going to be pretty flat.

    I think you need to explain your approach to your theme in respect of BP integration as I can’t really think of a good reason to not use the file, overload and modify, is an option but to leave out altogether…

    @marcella1981

    Participant

    There’s no real reason, other than knowing exactly what my theme is doing and what it’s outputting in each scenario. I appreciate it’s a little idiosyncratic but it’s just how I do it.

    If I do let buddypress.js by default, how would I make it sing nicely with this theme which is shrouded with custom markup?

    Appreciate any help offered, @hnla thank you.

    @hnla

    Participant

    You’re asking questions impossible to answer.

    We can’t second guess what issues might arise when allowing BP js to run, add it back in and see what transpires, it’s a far more logical approach to see what actual issues need addressing than trying to guess at what may arise.

    @henrywright

    Moderator

    Take a look at this tutorial:

    Load Next WordPress Posts With AJAX

    It’s a good attempt at explaining how AJAX can be used to load more WordPress posts. The solution isn’t 100% perfect for you a) because it applies to WordPress posts and not BuddyPress activity items and b) the query is slightly off if a new post happens to be published between initial page load and load more button click.

    *But* it should give you a good starting point to gain understanding on how AJAX *might* be used to load more items into the DOM.

    @r-a-y

    Keymaster

    The bpdevel post says you need to add 'count_total' => 'count_query' to your bp_has_activities() call if you want to keep pagination.

    So in your activity-loop.php, try adding '&count_total=count_query' to bp_has_activities().

    @shanebp

    Moderator

    @r-a-y

    [off topic – If you’ve a spare moment, lol…]
    re: the use of count_total

    It might be a factor in this bbpress ticket re Activity entries:
    https://bbpress.trac.wordpress.org/ticket/2690

    https://buddypress.org/support/topic/bbpress-post-edit-causes-multiple-activity-entries/

    @r-a-y

    Keymaster

    @shanebp – You’re definitely on point about the activity changes and bbPress. If you don’t have time to create a patch on the bbPress ticket, let me know and I’ll do it.

    @shanebp

    Moderator

    @r-a-y – Thanks for the patch.
    And sorry to everyone else re these hijack posts.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Integrating AJAX Activity Stream with custom markup’ is closed to new replies.
Skip to toolbar