Buddypress: Automatic refresh activity stream

I’m working on a solution to automatic refresh the activity stream on a buddypress website.

The easiest way would be to replace the existing activty stream through the new loaded html code. Unfortunately, the page flickers. Also if the user reply to an update, his text will disappear.

Okay, I only should add the new updates. So I’ve added a var “existing_ids” to my javascript and pass the IDs to my php script via AJAX. My php script return only the updates where the ID is not in the list.

This works fine. But still having the problems with replies/comments to existing posts. My current solution check, if the update has comments and also write them into a var “ids_with_comments”. My php script checks, if the ID does not exists yet on the page OR the ID is not in the var “ids_with_comments” AND now has comments. The JavaScript which handle the response checks, if this is an existing update, but with new comments. It will replace the update. Only if the user is currently replying to this update, the script will do nothing. So I prevent to override the textarea.

The current scripts a part of my theme. I’ve packed the files to Theme, which is using the bp-default templates. Here you can  download the current version of my automatic-refresh theme.

Dieser Beitrag wurde unter JavaScript, PHP / MySQL, Plugins, Wordpress abgelegt und mit , , verschlagwortet. Setze ein Lesezeichen auf den Permalink.

4 Antworten auf Buddypress: Automatic refresh activity stream

  1. :-) Sandra sagt:

    Wow, du schreibst sogar in Englisch ;-)

  2. Markus sagt:

    Der Link geht leider nicht mehr, gibt es das noch irgendwo? Ich versuche auch sowas ähnliches umzusetzen und wollte mir das Theme mal gern ansehen.

  3. Florian sagt:

    Danke für den Hinweis. Der Link funktioniert wieder.

  4. Markus sagt:

    Hey super. Danke für die schnelle Reaktion.

Hinterlasse eine Antwort

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind markiert *

*

Du kannst folgende HTML-Tags benutzen: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>