Tag Archives: WPMu

Safely delete spam comments across a large WP network

I’m currently working on a university WordPress network that’s been running for four or five years (an MU veteran!) and has almost 5000 blogs, most of which are defunct (because they’re from previous semesters). Akismet is activated across the network, so there’s not much of a public spam problem. However, even spam comments are stored in the database, and some of the blogs have tens of thousands of spam comments sitting in their tables. I’m going to implement a couple of tricks to keep this from happening in the future (a lightweight honeypot for non-logged-in users, tell Akismet to auto-delete spam comments on old posts). But for now, I’ve got to clean up this mess, because the very large comment and commentmeta tables are causing resource issues.

I wrote a simple script that gradually cycles through all the blogs on the network and deletes comments that have been marked as spam by Akismet. Here it is, with some comments afterward:

Notes:

  • The number of blogs is hardcoded (4980)
  • The ‘qw_delete_in_progress’ key is a throttle, ensuring that only one of these routines is running at a time. You might call this the poor man’s poor man’s cron.
  • I’ve limited it to 10 comments per pageload, but you could change that if you wanted
  • Put it in an mu-plugins file. When it’s finished running (check the ‘qw_delete_next_blog’ flag in the wp_sitemeta table – it’s done if it’s greater than the total number of blogs on the system), be sure to remove it, or at least comment out the register_shutdown_function line.

Use at your own risk – I’m posting here primarily for my own records :)

BuddyPress Group Email Subscription

Email Options on settings page

Email Options on settings page

Authors: Deryk Wenaus, Boone Gorges, David Cartwright

BuddyPress Group Email Subscription allows group members to receive email notifications for all types of group activity, especially forum posts. Each user can choose how they want to subscribe to the group.

EMAIL SUBSCRIPTION LEVELS: There are 5 levels of email subscription options:

  1. No Email – Read this group on the web
  2. Weekly Summary Email – A summary of new topics each week
  3. Daily Digest Email – All the day’s activity bundled into a single email
  4. New Topics Email – Send new topics as they arrive (but don’t send replies)
  5. All Email – Send all group activity as it arrives

DEFAULT SUBSCRIPTION STATUS: Group admins can choose one of the 5 subscription levels as a default that gets applied when new members join.

DIGEST AND SUMMARY EMAILS: The daily digest email is sent every morning and contains all the emails from all the groups a user is subscribed to. The digest begins with a helpful topic summary. The weekly summary email contains just the topic titles from the past week. Summary and digest timing can be configured in the back end.

EMAILS FOR TOPICS I’VE STARTED OR COMMENTED ON: Users receive email notifications when someone replies to a topic they create or comment on (similar to Facebook). This happens whether they are subscribed or not. Users can control this behaviour in their notifications page.

Email options on group pages

Email options on group pages

TOPIC FOLLOW AND MUTE: Users who are not fully subscribed to a group (ie. maybe they are on digest) can choose to get immediate email updates for specific topic threads. Any subsequent replies to that thread will be emailed to them. In an opposite way, users who are fully subscribed to a group but want to stop getting emails from a specific (perhaps annoying) thread can choose to mute that topic.

ADMIN NOTIFICATION: Group admins can send out an email to all group members from the group’s admin section. The email will be sent to all group members regardless of subscription status. This feature is helpful to quickly communicate to the whole group, but it should be used with caution.

SPAM PROTECTION: To protect against spam, you can set a minimum number of days users need to be registered before their group activity will be emailed to other users. This feature is off by default, but can be enabled in the admin.

The plugin is fully internationalized.

NOTE TO PLUGIN AUTHORS: If your plugin posts updates to the standard BuddyPress activity stream, then group members who are subscribed via 3. Daily Digest and 5. All Email will get your updates automatically. However people subscribed as 2. Weekly Summary and 4. New Topic will not. If you feel some of your plugin’s updates are very important and want to make sure all subscribed members them, then you can filter ‘ass_this_activity_is_important’ and return TRUE when $type matches your activity. See the ass_this_activity_is_important() function in bp-activity-subscription-functions.php for code you can copy and use. An example: adding a new wiki page would be considered important and should be filtered in, whereas a comment on a wiki page would be less important and should not be hooked in.

BuddyPress Group Email Subscription has been downloaded 72,987 times. Are you using this plugin? Consider a donation.

Version history

2.3 – May 12, 2010
Initial release

Importing Ning users into WP

Today Ning announced that it would be ending its free social networking service. I tweeted something to the effect that this event is a wake-up call: When you use closed-source, third-party hosted solutions for something as valuable as community connections, you are leaving yourself open to the whims and sways of corporate boards. It’s not that Ning is evil or anything – it goes without saying that they need to make a profit – but their priorities are importantly different from those of their users. In the same way that Ning moves from a freemium model to a paid model, Facebook could start selling your crap, Twitter could crash, Tumblr could go out of business, etc.

All this is a good argument to be using software solutions that are more under your control. Like – drumroll – WordPress and BuddyPress.

Enough moralizing. I whipped together a plugin this afternoon called Import From Ning that will allow you to get a CSV export of your Ning community’s member list (the only content that Ning has a handy export feature for, alas) and use it to import members into a WordPress installation.

As of right now, it does not have any BuddyPress-specific functionality. But the data that it does import – display name, username, email address – are enough to populate at least the beginnings of a BuddyPress profile. The next thing to add is the auto-import of certain profile fields. I might try to do this tomorrow. The plugin is based on DDImportUsers – thanks!

Instructions:

  • Download the zip file and unzip into your WP plugins directory
  • Look for the Import from Ning menu under Dashboard > Users (unless you’re running a recent trunk version of BuddyPress, in which case it will be under the BuddyPress menu)
  • Follow the instructions on that page

Download the plugin here.

Big new version of Invite Anyone for BuddyPress

My BuddyPress function Invite Anyone has always been misleadingly named. It expanded on BuddyPress’s default setup, which only allows members to send group invitations to people who they’re friends with, by allowing individuals to send invitations to anyone in the entire installation. This only qualifies as inviting anyone on a, er, very austere ontology of personhood. The new version of Invite Anyone, version 0.4, adds a new tab to BuddyPress profile tabs that allows invitation both to groups and to the site in general via email. It’s a big update, both in terms of features and in terms of sheer code (pretty sure the number of lines of code is close to triple what it was before).

And now you know what I did on my spring break.

If you know what’s good for you, you will Check It Out.

Group Forum Subscription for BuddyPress

This plugin allows users to subscribe to email notifications of forum activity in their BuddyPress groups.

Use of this plugin for versions of BuddyPress 1.2 and higher is not recommended. New plugins, such as Group Activity Notifications, are more general (encompassing all group activity instead of just forums) and are built with BP 1.2 in mind. I encourage you to use that plugin instead, as this plugin will not be officially supported for new versions of BuddyPress.

Download the plugin here.

Group Forum Subscription for BuddyPress has been downloaded 7,704 times. Are you using this plugin? Consider a donation.

Other posts about this plugin can be found here, here, here, here, here, and here.

Version history

0.1
Initial release
0.2
Bug fixes
1.0
Compatibility with BP 1.1
Bug fixes
1.1
Quite a few bug fixes, especially with BP 1.1 compatibility
1.2
Post reply bugfix for IE
Updated readme information for installation with older versions of BP
Resolved issues some users were having with PHP errors
Moved stable tag away from trunk. Use trunk at your own risk!
1.3
Localization complete. Shipped with four translations: French, German, Russian, Spanish
Dashboard menu moved under BuddyPress section
Forum Subscription notification block added to BP’s forum index.php pages
Forum subscription notification block removed for non-logged-in users
Fixed bug that subscribed non-confirmed users to forums created in standalone bbPress
Admins can choose whether posters receive notifications of their own posts (off by default; not togglable in standalone bbPress)
1.4
Fixed bug that prevented members of large groups from being subscribed to new topics
Fixed bug that kept email headers/footers from being translated
Fixed bug that kept subscribing banned members in bbPress standalone
Fixed bug that didn’t check to see if members wanted automatic subscription for a given group in bbPress standalone
Added topic title to bbPress standalone email
Fixed bug that kept admin_menu from hooking correctly for some users installing BP in non-standard location
1.4.1 – March 27, 2010
Loader file added to prevent crashes when BP is upgraded
Duplicate notifications menu functions removed to ensure interoperability with BP 1.2 bp-default

Forum Attachments for BuddyPress

This plugin ives members the ability to upload attachments on their posts.

It’s a port of a plugin originally created for bbPress by _ck_. See the original plugin page here: http://bbpress.org/plugins/topic/bb-attachments/. _ck_ is not supporting this plugin anymore. Insofar as the code works, it is thanks to her; insofar as it does not, it is my fault.

Installation

  • Upload to plugin directory and activate
  • If you’d like to change the default settings (as described in step 5 here http://bbpress.org/plugins/topic/bb-attachments/installation/), you may do so by editing forum-attachments-for-buddypress-bp-functions.php
  • Create a directory ‘bb-attachments’ one level above your WP root and make sure that it is writeable by the server. So if your WP installation is at /home/html/, create a directory /home/bb-attachments.
  • I use a JavaScript trick to make uploads possible. If you are confident that most of your users will have JS enabled, you do not need to do anything else.
  • If you want to make uploads possible for users with JS turned off, you will need to alter the <form> tags on your theme’s forum files: groups/single/forum/topic.php and groups/single/forum.php. Change
    <form action="" method="post" id="forum-topic-form" class="standard-form">

    to

    <form action="" method="post" id="forum-topic-form" class="standard-form" enctype="multipart/form-data">
  • If you have an unusual setup (in particular, if your WP_PLUGIN_URL is somewhere other than /wp-content/) you may have to play with the path settings in download.php and image.php to make things work correctly.

Read an older comment thread about this plugin.

Download the plugin here.

Forum Attachments for BuddyPress has been downloaded 9,665 times. Are you using this plugin? Consider a donation.

Translation credits

  • Russian – slaFFik

Version history

0.1
Initial release
0.2 – March 19, 2010
BuddyPress 1.2 compatible
Removed the need for custom theme hooks
Enabled inline images
Improved download process to avoid header conflicts
0.2.1 – March 19, 2010
Corrected redirect after deleting attachments
Removed header requirements causing errors on some Apache setups
0.2.2 – March 22, 2010
Corrected typo that was causing redirect conflicts with certain forum-related plugins

New BuddyPress plugin: BP Group Management

Another day, another plugin for BuddyPress. In BP < 1.2, it was impossible for site admins to manage group membership in groups where they weren't also the local admin. This is good in a lot of situations, but in some applications of BP it can be a pain - the system administrator needs more power in order to correct problem, wreak havoc, and so on. In BP 1.2+ the situation is better - admins can manage groups more - but it's still not all that easy to see everything in one place. This plugin rectifies the situation by allowing site admins to manage the members of groups across their BP installation from a single screen.

Read more about it.

BP Group Management

This plugin creates an admin panel at Dashboard > BuddyPress > Group Management. On this panel, site admins can manage BP group membership by banning, unbanning, promoting and demoting current members of any group, adding new members to any group, and deleting groups.

Requires BP 1.2 or higher. If you’re running a 1.1.x version of BP, a mostly functional version of the plugin can be downloaded by clicking here. Tested fairly thoroughly on BP 1.1.3; please test before running in a production environment.

I consider this version to be something of a beta release. If you find problems with the plugin, please let me know by leaving a comment below.

Download the plugin here.

BP Group Management has been downloaded 24,961 times. Are you using this plugin? Consider a donation.

Translation credits

  • Italian – Luca Camellini
  • Turkish – gk
  • German – Tom

Version history

0.1 – March 4, 2010
Initial release
0.2 – March 7, 2010
Fully localizable
Avatar bug fixed (thanks for pointing it out, anointed!)
Hooks added for additional group actions
0.3 – March 8, 2010
Pagination on group list allows you to see all groups (thanks, Andy!)
Group avatars added (thanks, Andy!)
Italian translation included (thanks, Luca!)
0.3.1 – March 16, 2010
Turkish translation added (thanks, gk!)
German translation added (thanks, Tom!)
Sitewide roster altered to include all members, not just members active on BP
0.4 – March 21, 2010
Added plugin settings page
Member list is now paginated (defaults to 50 per page)
Admin can now specify how many groups or members to show per page
Group Actions menu added to Members and Delete pages
Links to Group Admin page added throughout

New BuddyPress plugin: BP Import Blog Activity

I wrote a BuddyPress plugin today that is very ugly. It imports activity into BuddyPress from blog posts and comments that occurred before you had BuddyPress installed. It’s ugly because it’s sloppily coded and extremely inefficient and likely to hit PHP memory limits every time you run it. But it does the job, so I thought I’d post it and share it with others.

Read more about it, along with a bunch of warnings, here.