Tag Archives: plugin

Help me alpha test BuddyPress Forum Attachments

Now that bbPress is integrated into the Very Fabric of BuddyPress, there’s some demand for useful bbPress plugins to be ported over to BP. One of the most useful is _ck_’s excellent bb-attachments, which allows users to add attachments to their forum posts. I have spent a bit of time in the last few days porting it over to BP. If anyone out there is running a BP+bbPress setup (I think it should work in any recent version of BP, but I’ve only tested in BP 1.1) and would like to help me to test what is I think a functional BP version of the plugin, please do so. Here are the details.

  1. Download the plugin bb-attachments.php.zip
  2. Unzip and upload to your WPMU plugin directory. Activate it.
  3. You’ll have to make a few changes/additions to your theme files to make it work. In your BP theme directory, go to groups/single/forum/topic.php. On line 9, after the ‘template_notices’ hook, add
    [code language=’html’][/code]
    Next: After line 61, which reads
    [code language=’html’][/code]
    insert the following line
    [code language=’html’][/code]
    Next: On line 26, replace
    [code language=’html’]

    [/code]
    with
    [code language=’html’]

    [/code]
  4. In the same theme directory, open edit.php and index.php. Find the <form> tags, as described in the last part of the previous step, and replace them with the alternative <form> tag (with the enctype specified)
  5. Follow steps 1 and 2 from here. Step 5 on that page (the “optional settings”) you can do as well, and those settings might take some tweaking for certain filetypes to be allowed.
  6. Start uploading!

A few caveats:

  • I have not tested any of the AWS abilities. It’s possible that they will still work, as the AWS functionality is more or less abstracted from the specific bbPress hooks.
  • Inline images are not yet supported. I’m working on it.
  • Things look a little bit ugly with the default BP 1.1 theme. I haven’t done much to make it pretty. I’m happy to take aesthetic suggestions, if you have any.

Thanks in advance for your help. Please leave any comments here in this post’s thread.

New BuddyPress / bbPress plugin: Group Forum Subscription

BuddyPress and bbPress can be plugged into each other such that BuddyPress groups get their own discussion forums, which are powered by bbPress. Adding Burt Adsit’s bpGroups means that private and hidden groups can have their discussion forums private too. But a major hurdle is email notification: Certain kinds of BP communities simply won’t get rolling if there’s no easy way for users to get email notification of new discussions. There are solutions out there to assuage this problem within bbPress (notably Thomas Klaiber’s Post Notification, which served as the inspiration for the mechanics of my own plugin), but email notification remains hidden in bbPress favorites, instead of in an out-front toggle.

Group forum notification is coming in a future version of BuddyPress, but it’s important enough that I needed it now.

This set of plugins, called Group Forum Subscription, fixes that. Features:

  • Users can subscribe to individual discussion topics from within BuddyPress
  • Users can subscribe to topics on a group-by-group basis – that is, one can subscribe to all existing and future topics associated with a particular BuddyPress group
  • Users are automatically unsubscribed from a group’s discussions when they leave the group
  • Administrators can subscribe all users to the appropriate forums with a single click (potentially handy for first-time setup
  • Administrators can toggle whether email notification is turned on by default.
  • Administrators can determine whether the topic links in the notification emails will point to bbPress or to the BuddyPress forum interface

Installation instructions

  1. Download the package
  2. Upload the BuddyPress plugin bp-group-forum-subscription.php to the plugins directory of your main WPMU blog and activate it
  3. If you prefer for the members of your community to use the BuddyPress posting interface for discussions, add the following hook: [sourcecode language=”php”][/sourcecode] immediately after [sourcecode language=”php”]
    [/sourcecode] in /[your bp theme dir]/groups/forums/topic.php
  4. If you plan for your users to use bbPress for forum reading and posting, upload the bbPress trigger plugin bb-group-forum-subscription.php to [bbpress-install-dir]/my-plugins/ and activate it through the bbPress admin screen. Please note: the bbPress plugin changes the (IMO somewhat opaque) “Add to favorites” link on each topic page to a more straightforward Subscribe/Unsubscribe. If you like this change, open up [bbPress-theme-dir]/topic.php, and change
    [sourcecode language=”php”]user_favorites_link();[/sourcecode]
    to
    [sourcecode language=”php”]user_favorites_link( array(‘mid’ => __(‘Subscribe to this discussion’)),array(‘mid’ => __(‘Unsubscribe from this discussion’)));[/sourcecode]

You can configure the plugin on the admin page (Group Forum Subscription under Dashboard Settings. Members of your BP community can tinker with their subscriptions either on the individual topic pages (in bp or bbpress) or on their BP Settings > Notification page (where they can subscribe/unsubscribe to entire groups).

I’m in the process of setting up BuddyPress 1.1, which was just released today. Once I’ve got a dev instance of it up and running, I will do the necessary fixes to make the plugin run on the new version. (I don’t think it will be too hard, given the number of craptastic workarounds I had to do in this version because of the absence of all the nice 1.1 hooks.) Stay tuned.

Sitewide Tag Suggestion, Part II, Sort of

If you are interested in the Sitewide Tag Suggestion plugin that I blogged about a few weeks ago, you might like to know that I have finally found some time to write up some proper instructions and implement the changes on the CUNY Academic Commons. If you’re interested, you can download the bugger from the Commons dev blog, and let me know what you think.

Automated and redundant Wordpress backup via email

The WordPress worm that was going around a few days ago got me thinking about backups. A lot of people harp about how you really ought to be backing up your data, but backing up something like Wordpress is a little more complicated than backing up local data, especially if you don’t know how to set up cron jobs. And even if you do, this only protects you from certain kinds of problems (malware, database corruption and the like), not catastrophic hardware failure (since it’s likely that you’re keeping the backups on the same physical machine).

backup

So I set myself up with with a very simple but apparently quite effective solution for Wordpress backups. Three parts:

  • The WordPress Database Backup plugin is a spiffy little plugin that lets you schedule snapshots of your entire WP database, with the option to include additional tables created by third-party plugins. Most importantly for my purposes, the plugin allows you to schedule backups to be emailed to yourself.
  • The plugin zips the database dump and sends it as an attachment to my Gmail address. I created a Gmail filter that takes all emails from that address, marks them as read, and archives them. That means that every day I have an up-to-date snapshot of my Wordpress installation on Gmail’s servers, instead of on the server where my blog is hosted.
  • Once a month or so (more frequently when the web interface goes down), I open up Thunderbird on my laptop, which grabs copies of all old mail via IMAP. Now I have copies of my WP database on my computer as well.

This is probably an obvious system that other people have implemented, but I haven’t seen many people write about it. Hope it helps someone.

New BuddyPress plugin: Enhanced BuddyPress Widgets

I just posted at the CUNY Academic Commons Dev blog about a new plugin I’m releasing for BuddyPress. The plugin adds two new widgets to your BP/WP install – Groups and Members – which duplicate the functions of the core widgets of the same name, with the added feature that users can choose whether the default view will be Newest, Active, or Popular.

If I can think of other ways in which those widgets could be enhanced, I might add them to the plugin in the future. If you can think of some ways, please let me know.

Why are you still reading this? Go download the plugin already, and enjoy having my name on your WordPress plugins page yet again.

Sitewide Tag Suggestion in Wordpress MU 2.8+

A recent project of mine has been to improve the “Choose from the most popular tags” button that’s built into the Wordpress edit post screen. The default behavior is to find the most frequently used tags from the current blog. My goal is to add a link that lets you select from frequently used tags across the entire Wordpress MU installation. It’s an idea that Matt Gold gave me. Aside from being kind of gimmicky and neat, such a feature might facilitate the emergence of a more unified folksonomy in a community. In other words, the ability to see what tags other people are using for their posts makes it more likely that I’ll use the same tags that you use when we post about similar things. In this way, we can avoid having people tagging their posts “Wordpress”, “WP”, “Wrdprss” as if these were different things.

It looks like the developer of Simple Tags is going to be working this sort of functionality into an upcoming version, but it’s not nearly as fun to just use someone else’s version if you can hack one out yourself.

Sitewide Tag Suggestion

Sitewide Tag Suggestion

I got it working through a series of hacks and plugins. I’ll describe some of the details below, enough so that you should be able to get a similar setup on your own system. A caveat: I can only attest to the setup (I’ll call it Sitewide Tag Suggestions, or STS) on WPMU 2.8.2, the sandbox version I’m running. The only production version I’ve got access to – the CUNY Academic Commons – is running a version of 2.7. Between 2.7 and 2.8 there were pretty significant changes to the way that the admin AJAX works, and I haven’t yet figured out how to make these changes stick on 2.7. (Moreover, I’m wary of sinking a bunch of time into retrofitting an outdated version of WPMU.)

STS starts off with the plugin WordPress MU Sitewide Tags, which I blogged about recently. Conceptually, the idea is simple. Sitewide Tags creates a blog that aggregates all posts from across the installation. From the tags blog one can then collect tags that reflect all sitewide activity. To make STS work, then, one simply has to duplicate the core WP tag suggester, altering it to pull the most popular tags from the tags blog, rather than from the current blog.

I managed to get some of the key functionality into a standalone plugin. You can download the plugin here. A quick rundown of this plugin’s contents:

  • get_terms_custom is really the heart of STS. It’s a modification of WP core’s get_terms (in wp-includes/taxonomy.php) that allows for an additional argument: blog_id. This allows you to pull taxonomy terms (like tags and categories) from any blog on a WPMU install.
  • sitewidte_tags_selection is the PHP function that writes to the header of the WP admin screen the jQuery function tagCloud2. tagCloud2 is the function that listens for the user to click on the “Choose from the most popular sitewide tags” link, and then posts the AJAX request for the proper tags.

STS has two more parts, one of which could probably be moved into the plugin proper, and one of which probably has to remain a core hack. I’ll cover them in turn.

  1. tagCloud2 sends an AJAX request to the server with the action name ‘get-tagcloud2’ (can you tell that there was a lot of cutting and pasting from the core?). The code for the AJAX response is put into wp-admin/admin-ajax.php. It’s basically a copy of the get-tagcloud function already in admin-ajax.php. That means you should copy everything between case 'get-tagcloud' : and break; roughly lines 568-600, making the following changes:

    • change ‘get-tagcloud’ to ‘get-tagcloud2’;
    • the line that declares the variable $tags,
      [sourcecode language=”php”]$tags = get_terms( $taxonomy, array( ‘number’ => 45, ‘orderby’ => ‘count’, ‘order’ => ‘DESC’ ) );[/sourcecode]
      must be replaced with the corresponding get_terms_custom declaration:
      [sourcecode language=”php”]$tags = get_terms_custom( $taxonomy, array( ‘number’ => 45, ‘orderby’ => ‘count’, ‘order’ => ‘DESC’, ‘blog_id’ => 28 ) );[/sourcecode]
      Don’t forget to replace “28” with the blog_id of your tags blog.

    I am well aware that there are ways to add ajax responses in plugins, i.e. without hacking the core, but for the life of me I couldn’t get it to work. I imagine part of the problem is that back in tagCloud2, I’m replicating the core’s ajax syntax, while a plugin’s syntax has to be more explicit about where’s it’s sending its requests. (That’s what wp_ajax_ is for, I think.) So I’m chalking this one up to my own ineptitude and the fact that I have no idea how to work computers.

  2. Finally, you’ve got to add some markup to the edit post page itself so that STS can actually be used. It’s possible of course to use WP’s hooks to add fields to the edit post page, but I really wanted to include the link right underneath the core “Choose from the most used tags” link. So I put the link in a core file, wp-admin/edit-form-advanced.php. Right after the code for the most used tags link, I added my own:
    [sourcecode language=”php”]

    [/sourcecode]
    Be sure that each instance of tagcloud is changed to reflect the new ajax call (in my case, tagcloud2).

I think that STS has some potential to be really cool, especially if used in a community that is large enough for rich folksonomies to emerge. If you’ve got any suggestions about how to make it better, or how to fix any of my stupid errors, please don’t hesitate to leave a comment!

Removing previous comment edits from BuddyPress activity – a plugin

Another BuddyPress plugin for you. This one makes sure that you don’t get multiple versions of the same comment in your activity streams when a comment is edited. Sounds like a small thing, but it was kind of a bear to program. Anyway, check it out at the CUNY Academic Commons Dev Blog.

Making Sitewide Tags work

Cross-posted at the CUNY Academic Commons Development blog

Sitewide Tags is a cool plugin by Donncha O Caoimh that pulls blog posts from all over a WordPress Multi-User installation – like the one here on the CUNY Academic Commons – into a supplementary catch-all blog. The power of this plugin is that, with all sitewide blog posts aggregated into one place, you can begin to see the kinds of topics and trends that emerge from the community of bloggers. More specifically, Sitewide Tags allows you to create a tag cloud that reflects blogging activity across the entire community. (See the tag cloud at Wordpress.com for a sense of what this looks like.)

I’ve got Sitewide Tags up and running here on the Commons – see our tag cloud (scroll down the page) and our aggregated blog. Getting things running seamlessly took a bit of tinkering though, and I thought it might be useful to share some of the tinkering here.

Read on for more of this (unexpectedly!) long process.

Continue reading