Skip to:
Content
Pages
Categories
Search
Top
Bottom

MediaWiki edits -> BP activity streams


  • Boone Gorges
    Keymaster

    @boonebgorges

    I’m working on a project, the CUNY Academic Commons, where we’ve worked out single sign-on for WPMu and MediaWiki. On top of this shared user authentication, I wrote a MediaWiki extension that takes MediaWiki page edits (limited to one update per 24 hours for a given author/page combination) and feeds them into the BP activity streams.

    It’s a very cool addition for our project – makes the action going on in the wiki much more visible, both in the sitewide feeds and on individual profile pages.

    The extension can be found here if you’re interested.

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

  • r-a-y
    Keymaster

    @r-a-y

    Nice job, Boone!

    There’s probably going to be a few people interested in this!


    Dolugen
    Participant

    @dolugen

    Wow, it’s awesome. I was thinking for days of this very same concept for my buddypress based wiki, here comes the solution :) Good work!


    21cdb
    Participant

    @21cdb

    Awesome!


    nicolagreco
    Participant

    @nicolagreco

    I’ve written a complete integration for MediaWiki in BuddyPress (activity, groups, user page, buddybar included)

    On september i’ll release it, i hope you can wait and try it :)


    flynn
    Participant

    @flynn

    Boone,

    Thank you for your code, the single sign on worked brilliantly!

    I’m building a Game Studies social site for the new media field (hopefully new media academics, ludologists, etc will take to it) for the University of Wyoming, and a wiki was a major concern. the WP wiki plugins aren’t up to the task, so this really helps.

    Few questions if I may.

    When I enable the site wide update plugin, my mediawiki page goes blank. Thoughts?

    Also, how did you manage to make CUNY look so integrated, a mediawiki theme I suppose? I’ve never themed (or worked with really) mediawiki, is there a good theme site where I might be able to download something to modify, or is it a group up kind of thing?

    Thanks for your hard work!

    @Nicola:

    I’ll look into your plugin when it comes out, but will it do anything more/different as Boone’s code is rather complete in what it does. Also, beta?


    flynn
    Participant

    @flynn

    Ok, visual integration.

    I made a theme that calls WP’s header / footer. Install it into your media wiki skins dir and change skin in LocalSettings.php to “dusk” and you should be good to go.

    Basically the theme does this:

    wiki header stuff

    <?php require(‘../wp-config.php’); $single = 1; $siteurl = get_settings(‘siteurl’); ?>

    Wiki content stuff

    <?php get_footer(); ?>

    It’s not classy, but it works… well, for me. To work with your site it may take some CSS tweaking, namely, width and background info most of which is in “main.css” around line 350.

    I’ll update the zip as I make changes. I don’t really plan to make this a supported thing, but as I hack a solution together, I might as well share it.

    http://thegsn.org/Extra/Archive.zip


    Alex
    Participant

    @hempsworth

    On the activity output, could the ‘7 seconds ago’ message be wrapped around a:

    <span class="timesince">

    Like the other activity outyputs. It would make skinning this so much easier!


    Boone Gorges
    Keymaster

    @boonebgorges

    @Flynn – Glad you got the single sign-on working! The visual integration really just came from an excessive amount of CSS elbow grease. I’m a bit embarrassed to say that our solution for sitewide navigation isn’t as elegant as yours – the WP nav is hardcoded into the MediaWiki template. We were in a rush to get the thing together (and frustrated with the less-than-ideal theming structure of MW!) and it never occurred to us. I’ll definitely look into using includes to make this work.

    As for the activity plugin – it’s hard to know from just the blank screen just what’s wrong. If you’re getting the problem even without saving pages, then it’s unlikely that it’s a problem with the code (since it is only hooked when a wiki page save is complete). A couple possibilities:

    • You might want to take a look to make sure that there is a close ?> in the MW extension. I had to leave it out of the MW documentation page because of the way the MW knowledgebase renders PHP (I guess?). If MW isn’t detecting an end to the extension, it could cause a panic.
    • Where did you place the require_once line in your LocalSettings.php? My system was finicky; I only got the plugin to activate correctly when I made it the second to last require_once in the config file (just before the WP redirection extension code). So you might try playing around with the location of this file.
    • Make sure as well that the line in LocalSettings.php is pointing to the right location – [MW-directory]/extensions/buddypress-activity/buddypress-activity.php, or whatever alternative location you’ve chosen on your system.

    Hope that helps at least a little!

    @Hempsworth – It’s funny that you mention the class=timesince – I must have spent three hours trying to get that to work one way or the other. The problem is that the timesince span tags are added in the individual BP components (groups, blogs, wire, etc). To get wiki functions to work the same way I would have to abandon the quick-n-dirty activity hack that I employed and actually build entire wiki BP classes. Maybe one day! In the meantime, you might try this even quicker-n-dirtier hack that I mention in the Usage section of the extension page. The preg_replace code I give there goes in BuddyPress core, around line 226 and 230 (ish) of [wp-install-directory]/wp-content/plugins/buddypress/bp-activity/bp-activity-templatetags.php. This hack will only apply to new wiki activity – not the stuff that you’ve already posted – so make sure to make a new wiki edit to test.


    flynn
    Participant

    @flynn

    @Boone,

    Thanks for the tips, I had been messing with it some and noticed that my error in the activity stream was completely PEBKAC… I miss-typed like four things…

    [cough]

    Anyway…

    I’ll leave the theme up and post updates on the GSN and Twitter once the site is properly launched. As for now, I’m glad you guys may get some use out of it :D


    flynn
    Participant

    @flynn

    Update-

    I know this is a dead thread, but the code is all still functional, and it’s a good tip for people, so I’m just going to append the latest update of the wiki/WPMU integration theme.

    More info, change log, and download here: http://aaron.dighumanities.org/2009/10/19/mediawiki-wpmu-deep-style-integration-update/


    Boone Gorges
    Keymaster

    @boonebgorges

    Very cool, Flynn. Thanks so much for sharing.


    LPH2005
    Participant

    @lph2005

    I hate to dredge up an old thread – but – is work being done on this for WP 3.0 and BP 1.2.4.1?

    @flynn – the server is temporarily unavailable; theme link isn’t available.

    @boonebgorges – have you tried your extension with BP 1.2.4.1?

    @nicolagreco – did you ever release anything?

    Today seemed like a good day to try to get my MediaWiki footer integrated into BuddyPress footer – and just started looking around. Any tips from anyone would be great!


    LPH2005
    Participant

    @lph2005

    It looks like the INSERT into db does not align for WP 3.0. So I modified the mysql_query statement

    Also, I changed the lines with $wpmudp to ($wpmudp, $link) in which $link was added as:

    $link = mysql_connect(‘localhost’, ‘db’, ‘db_password’);
    if (!$link) {
    die(‘Not connected : ‘ . mysql_error());
    }

    This allowed the extension to attach to the proper database (my mediawiki is on a different host, with different user and password).

    The only thing incorrect is the time. And I’m working on a solution for it.

    See this thread for how I modified the query statement:
    https://buddypress.org/community/groups/creating-extending/forum/topic/db-inserts-into-bp_activity


    Mark
    Participant

    @markhahnel

    @boonebgorges @LPH2005 Great work on this guys,

    I’m bringing up errors on file uploads after activating the extension as detailed on the mediawiki extension page:

    Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/collabbo/public_html/figshare.com/figures/extensions/buddypress-activity/buddypress-activity.php on line 61

    Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/collabbo/public_html/figshare.com/figures/extensions/buddypress-activity/buddypress-activity.php on line 68

    Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/collabbo/public_html/figshare.com/figures/extensions/buddypress-activity/buddypress-activity.php on line 75
    Table ‘collabbo_figures.wp_bp_activity’ doesn’t exist

    Lines 61, 68 and 75 are as follows:

    ‘$resultarray = mysql_fetch_array($result);’
    ‘$bpresultarray = mysql_fetch_array($bpquery);’
    ‘$checkRecentArray = mysql_fetch_array($checkrecent);’

    WP 3.0.1 bp1.2.6

    Any ideas and help would be much appreciated. Thanks


    Mark
    Participant

    @markhahnel

    Mini bump ^


    LPH2005
    Participant

    @lph2005

    The last line of Boone’s script is the insert statement. You have collabbo_figures.wp_bp_activity as the database table. Have you tried to strip out that first part and just use wp_bp_activity ?

    ‘if ($seconds_between > 86400) {
    mysql_select_db($wpmudp, $link) or die(mysql_error());
    mysql_query( “INSERT INTO `wp_bp_activity` (`user_id`,`component`, `type`, `action`, `content`, `primary_link`, `item_id`, `secondary_item_id`, `date_recorded`, `hide_sitewide`, `mptt_left`, `mptt_right`) VALUES ( ‘$user_id’, ‘blogs’, ‘new_blog_post’, ‘$contentdesc’, ‘$WikiEdit $pagedesc’, ‘$articleURL’, ‘1’, ”, FROM_UNIXTIME($time1), ‘0’, ‘0’, ‘0’ )”) or die(mysql_error()); // insert into bp activity stream
    }’


    Mark
    Participant

    @markhahnel

    Thanks a lot @LPH2005 , I’ll check that out.


    Mark
    Participant

    @markhahnel

    Hi @LPH2005 – I made that change and this happened. Any ideas?


    Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/collabbo/public_html/figshare.com/figures/extensions/buddypress-activity/buddypress-activity.php on line 61

    Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/collabbo/public_html/figshare.com/figures/extensions/buddypress-activity/buddypress-activity.php on line 68

    Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/collabbo/public_html/figshare.com/figures/extensions/buddypress-activity/buddypress-activity.php on line 75

    Warning: mysql_select_db() expects parameter 2 to be resource, null given in /home/collabbo/public_html/figshare.com/figures/extensions/buddypress-activity/buddypress-activity.php on line 81
    Table ‘collabbo_figures.wp_bp_activity_sitewide’ doesn’t exist’


    LPH2005
    Participant

    @lph2005

    Check to see if the table collabbo_figures.wp_bp_activity_sitewide actually exists. Let us know.


    Mark
    Participant

    @markhahnel

    Ok I realised a problem I have – my wpmu database is ‘collabbo_figshare’ and the mediawiki is ‘collabbo_figures’ but when I put the correct database name in I get this:

    Access denied for user ‘collabbo_figures’@’localhost’ to database ‘collabbo_figshare’

    Any ideas?


    Mark
    Participant

    @markhahnel

    @boonebgorges @LPH2005

    Hey guys,

    Down to just one error ‘Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/collabbo/public_html/figshare.com/figures/extensions/buddypress-activity/buddypress-activity.php on line 75’

    Line 75 is ‘$checkRecentArray = mysql_fetch_array($checkrecent);’

    Any ideas what I need to do?


    Mark
    Participant

    @markhahnel

    Mini bump^

Viewing 22 replies - 1 through 22 (of 22 total)
  • The topic ‘MediaWiki edits -> BP activity streams’ is closed to new replies.
Skip to toolbar