BP External Activity

BP External Activity allows admins to import data from an arbitrary RSS feed into their BuddyPress sitewide activity stream. For example, you might use the plugin to add activity items for edits on a MediaWiki installation.

The plugin imports RSS feeds every hour. You may find that you need to decrease your Simplepie cache time to make it work:

add_filter( 'wp_feed_cache_transient_lifetime', create_function('$a', 'return 600;') );

reduces the RSS cache to ten minutes, for example. Put that in your bp-custom.php file if you are having problems with the plugin.

At the moment, the plugin uses the Author field from the RSS feed to look for a matching author in your WP database. If it doesn’t find one, it uses the unlinked text ‘A user’, as in ‘A user edited the wiki page…’.

Instructions

  1. Upload the bp-external-activity directory to your WP plugins folder and activate
  2. Open loader.php and replace the sample feed data with your own. Read the inline documentation carefully.

Future versions of the plugin will have a real admin interface (no PHP knowledge necessary), more sophisticated matching of feed authors with BP members, and the ability to attach feeds to groups.

Thanks to Andy Peatling, whose External Group Blogs served as the inspiration for a good part of the code.

Download the plugin here.

BP External Activity has been downloaded 1,067 times. Are you using this plugin? Consider a donation.

Version history

1.0 – May 25, 2010
Initial release

27 thoughts on “BP External Activity

  1. Pingback: Teleogistic / New BuddyPress plugin: BP External Activity

  2. Christopher Rogers

    I am trying to load the RSS feed to a twitter search. When I change the PHP file and activate the plugin the activity feed is populated with the tweets and everything looks good, but at the bottom of the page this is displayed:

    Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, ‘_bp_external_activity_refetch’ was given in /home1/rogersen/public_html/reformsymposium/wp-includes/plugin.php on line 395

    I am using WP 3.0, set up for multi-user with BP 1.2.5.2. I altered the loader.php file to read:

    $external_activity_feeds = array(
    array(
    ‘feed_url’ => ‘http://search.twitter.com/search.atom?q=%23rscon10′,
    ‘feed_action’ => ‘Tweeted’,
    ‘component’ => ‘Tweets’,
    ‘type’ => ‘tweet’,
    ‘show_text’ => __( ‘Show Tweets’, ‘bp-external-activity’ )
    ),
    );

    This would really enhance my site so I surely will donate. Thanks in advance.

    Reply
  3. Boone Gorges Post author

    Hi Christopher – Try commenting out lines 120 and 121 of bp-external-activity.php. That will almost certainly stop the error. (You should also comment out line 114 alert( “hi” ); – that was for testing and I meant to remove it, oops) The only trick is to make sure that the feeds are still refreshing regularly. Monitor your site over the course of a few hours after making these changes and see if it’s still working properly.

    Reply
  4. Aditya Mahesh

    Has the groups feature been created? Is there a way to manage the activity feed of certain groups using RSS?

    Reply
  5. Porsche Heritage

    Hi,

    I was wondering if the variables are completely arbitrary?

    array(
    ‘feed_url’ => ‘http://news.search.yahoo.com/news/rss?p=Porsche&ei=UTF-8&fl=0&x=wrt’,
    ‘feed_action’ => ‘%s edited the wiki page %s’,
    ‘component’ => ‘wiki’,
    ‘type’ => ‘wiki_edit’,
    ‘show_text’ => __( ‘Show Wiki Edits’, ‘bp-external-activity’ )
    ),
    array(
    ‘feed_url’ => ‘http://api.bing.com/rss.aspx?Source=News&Market=en-US&Version=2.0&Query=porsche’,
    ‘feed_action’ => ‘%s posted the link %s on Delicious’,
    ‘component’ => ‘delicious’,
    ‘type’ => ‘new_delicious_link’,
    ‘show_text’ => __( ‘Show Delicious Links’, ‘bp-external-activity’ )
    ),

    Reply
  6. Boone Gorges Post author

    What do you mean by “completely arbitrary”? If you leave them as they are, then activity items will show up that say “A user edited the wiki page X”, where X is the item from the RSS feed.

    Reply
  7. Porsche Heritage

    Ah, gotcha – gotcha! cool! Thank You soo much.. got it working! Im also trying to muck with it a bit so that it will pull news excerpt and post it. Thanks again!

    Reply
  8. stwc

    Hey boone — I’m back into Buddypress after going away for a while for a new project. Thanks for this plugin!

    I’m not using Groups on this project, but I see (or rather saw, when the error popped up and I looked at the code ;-) ) that there are dependencies on group stuff.

    Is that essential for some reason (if I understand, this is for the global activity stream, yeah), or can I strip it out in some clever way?

    Thanks!

    Reply
  9. stwc

    I had a bash at it myself — rather than writing the last update time to groupmeta, I’m using

    update_site_option(bp_external_activity_lastupdate, gmdate( “Y-m-d H:i:s” ));

    and get_site_option to grab it.

    All seems well — I think all we’d need to do is just use the BP check for whether groups are enabled to generalize it (assuming the site_meta table is a good place to keep the timestamp)….

    Reply
  10. Mark Hahnel

    Hey Boone,

    Im having the same problem as Ipstenu and Christopher, lines 120 and 121 do not seem the correct lines to edit out. Which lines should we be taking out to avoit the error message.

    Thanks,

    Mark

    Reply
  11. stwc

    I’m pretty sure (but wait for Boone to confirm) that those of you with the _bp_external_activity_refetch problem just need to get rid of the leading underscore — I think it’s a typo!

    Reply
  12. stwc

    BTW Boone, I’ve now got the plugin working on my groups-disabled site. There’s an occasional bit of wonkiness, but if you’d like me to send you the code for you to laugh at and possibly use for a future, groups-optional version, just let me know.

    Reply
  13. stwc

    (I would share it here, but I am still a seat-of-the-pants PHP coder, and wouldn’t want people to use it unreviewed in case it’s doing something terrible or dumb that I haven’t noticed yet).

    Reply
  14. Charl

    Hi Boone.

    Has there been any head-way regarding the plugin. Ive had a look at YD BuddyPress Feed Syndication (http://wordpress.org/extend/plugins/yd-buddypress-feed-syndication/) and not enjoying working with the plugin though it does whats on the box. Dont want to work with a plugin containing encryted code.. removable but stil..

    I alse had a look at the External Blogs Plugin (http://bp-tricks.com/featured/allow-users-to-add-their-rss-feed-to-their-profile-with-the-external-blogs-plugin/) which seems to only import the 1st feed then stops working on the dev seems to have stopped.

    Let me know? and thanks for the hard work.

    Reply
  15. kapil

    Your plugin is outdatad please update it according to latest buddypress and wordpress version…

    PLEASE TELL ME WILL YOU UPDATE IT OR NOT.

    Reply
  16. Talkchan

    “I’m pretty sure (but wait for Boone to confirm) that those of you with the _bp_external_activity_refetch problem just need to get rid of the leading underscore — I think it’s a typo!”

    Just wanted to say, this fix resolved the issue for me.

    The plugin is exactly what I wanted and it works perfectly (for me). I thank you very much for making this plugin.

    It works for wordpress & buddypress at the time of me making this post.

    I am not using the bbpress forums, I am using simple:press forums and it pulls activity from it just fine.

    If you are using this plugin and you edit the RSS feed as per the instructions, be sure to change the ‘wiki_feed’ and everything else (as per the instructions) or you WILL pull in feeds from elsewhere.
    It is weird I know but if you do end up with feeds from somewhere else, simply use wordpress admin to delete them. Trying to delete them via buddypress (on your website, not the wordpress back end admin) will not work. It will seem to deletthe postit but it will still be there.

    Unrelated: Kapil, please be respectful and not post in all caps. The plugin works fine and doesn’t need updating with the exception of a really simple bug fix. It still works for the latest BP & WP and you can see it in action on my website, which allows anonymous posting, so you don’t even need to register to try it. talkchan.org

    Your comment may not appear straight away in the activity feed, but that is to do with cron and how it functions. Keep in mind, with the exception of a few donations, the author is not paid or compensated for making a plugin unless they are selling it. It can be stressful and unrewarding to maintain a plugin, please try to refrain from being so aggressive in the future.

    Reply
  17. Derrick Sobodash

    Installed this on BuddyPress 1.7.2, but when I go to the Activity page I get the following error:

    Fatal error: Call to undefined function groups_get_groupmeta() in /public_html/##CENSOR###/wp-content/plugins/bp-external-activity/bp-external-activity.php on line 106

    Seems odd. The BuddyPress Codex doesn’t mention anything about groups_get_groupmeta() being deprecated. Any ideas?

    Reply

Leave a Reply