19 Responses

  1. Greg January 25, 2010 / 2:51 pm

    I am unable to get your plugin WPMU Block Spam By Math to work on a WPMU fresh install, have any suggestions?

  2. tekkguy January 27, 2010 / 5:33 pm

    Have you thought about setting this plugin up to work with buddypress?

    This is the one type of plugin I’m missing for buddypress … the Captcha just isn’t cutting it!

    • James February 8, 2010 / 6:35 pm

      Actually I’ve never used Buddypress but I’m hoping to look at the problem with WPMU 2.9.1 this week so I’ll try and give it a go with BP as well.

  3. Bedo February 15, 2010 / 9:05 am

    @Gid, how did you managed to set up your forum section? I am getting desperate with the styling of BBpress. I would appreciate your help admin@ecoflare.eu

    btw. this plugin works for me! (WPMU 2.9.1)

  4. James February 15, 2010 / 11:53 am

    I’ve updated this plugin to work with the Buddypress default theme. Be sure to read the update under the installation instructions as there is a manual edit you have to make to one of the theme files for this to work.

    As noted, Im not a big Buddypress user but on a generic install with WPMU and the latest BPress it appears to work. If you run into a problem, just post it here.

    I’ve also tested this on WPMU and it seems to work fine.

  5. Avanthu March 15, 2010 / 6:52 am

    Thanks James

    Its works like a charm! Now my Buddypress site is powered with your preety plug-in

  6. Bedo March 24, 2010 / 7:32 am

    Hi James,
    back again.. The plugin used to work as you described in the manual.
    However as soon I did an upgrade to wpmu 2.9.2 and Buddypress it stopped. Any plans to upgrade it? I use a child theme, but tried to copy the registration page to my child, to be able to do changes you suggest.

    The math request does appear on the registration page, but is not verified with the submitting, so basically you can leave it empty and Buddypress will give you a name anyway.
    I will try to have a look how the Super-CAPTCHA plugin is doing it. But nowadays are captha’s easy to read by robots..
    That’s why I like your more 😉

  7. James March 26, 2010 / 10:26 am

    Bedo, I’ve updated the plugin using BP 1.2.3. BP added a new hook in their core that makes my manual edit no longer necessary. It also makes their process a little cleaner than it was. If you’ve updated to BP 1.2.3 (I assume the change is in 1.2.2 as well) then you no longer need the old default theme (and this plugin will no longer work with it). Switching to the new default theme and updating this plugin to v1.2 should take care of the problem. Let me know if there is still an issue.

  8. Bedo March 29, 2010 / 3:16 am

    Hi James, it is working like a charm! Thank you! 🙂

  9. deano April 6, 2010 / 8:49 pm

    HI. I wanted to change addition to subtraction. I have changed the plus sign to a minus sign and of course the html message. trying to register with a wrong number I can still register.
    here is my code:
    Plugin Name: WPMU-Block-Spam-By-Math
    Plugin URI: http://www.jamespegram.com/wpmu-block-spam-by-math/
    Description: This plugin protects your WPMU signup process against spambots with a simple math question. This plugin is based on the Block-Spam-By-Math plugin created by Alexander Grau. This only protects the new blog creation process and the new user creation process. If you wish to have individual blog protection use the regular Block-Spam-By-Math plugin on individual blogs.
    Author: James Pegram (based on the work by Alexander Grau)
    Version: 1.1
    Author URI: http://www.jamespegram.com

    /* Copyright 2009

    James Pegram (email : jwpegram [make-an-at] gmail [make-a-dot] com)
    Alexander Grau (email : alex [make-an-at] grauonline [make-a-dot] de)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

    if ( !class_exists( ‘wpmuBlockSpamByMath’ ) ) {
    class wpmuBlockSpamByMath {

    // Constructor
    function wpmuBlockSpamByMath() {

    // WPMU specific actions/filters
    add_action(‘wpmu_options’, array( &$this, ‘blockspam_site_admin_options’));
    add_action(‘update_wpmu_options’, array( &$this, ‘blockspam_site_admin_options_process’));
    add_action(‘wp_head’, array( &$this, ‘blockspam_stylesheet’) );
    add_action( ‘signup_extra_fields’, array( &$this, ‘wpmu_add_hidden_fields’ ) );
    add_action( ‘bp_before_registration_submit_buttons’, array( &$this, ‘wpmu_add_hidden_fields’ ) );

    add_filter(‘wpmu_validate_user_signup’, array( &$this, ‘wpmu_validate_user_signup’ ) );
    add_filter(‘bp_before_current_signup_step’, array( &$this, ‘wpmu_validate_user_signup’ ) );
    add_filter(‘signup_blogform’, array( &$this, ‘wpmu_add_hidden_blogfields’ ) );

    // We don’t want this filter applied if we’re outside of the initial MU signup process (ie: don’t apply it to the wp-ativate function calls).
    if ($_POST[‘stage’] != ‘validate-user-signup’) { remove_filter(‘wpmu_validate_user_signup’,array( &$this, ‘wpmu_validate_user_signup’ ) ); }

    // Initialize plugin
    function init() {
    if ( function_exists( ‘load_plugin_textdomain’ ) ) {
    load_plugin_textdomain( ‘wpmu-block-spam-by-math’, PLUGINDIR.’/’.dirname(plugin_basename(__FILE__)) );

    // Protection function for submitted comment form
    function wpmu_validate_user_signup( $content ) {
    return $content;

    // Add hidden fields to the signnup form
    /* function wpmu_add_hidden_fields() {
    $mathvalue0 = rand(2, 15);
    $mathvalue1 = rand(2, 15);
    echo ‘IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) 🙂 ‘;
    echo “What is $mathvalue0 + $mathvalue1 ?”;
    echo ”;
    echo ”;
    echo ‘Please leave these two fields as-is: ‘;
    echo “”;
    echo “”;
    echo ”;

    //add to the constractor values for this …
    //or change + to minus altogether
    // Add hidden fields to the signnup form

    function wpmu_add_hidden_fields() {
    $mathvalue0 = rand(10, 20);
    $mathvalue1 = rand(1, 10);
    echo ‘IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) 🙂 ‘;
    echo “What is $mathvalue0 – $mathvalue1 ?”;
    echo ”;
    echo ”;
    echo ‘Please leave these two fields as-is: ‘;
    echo “”;
    echo “”;
    echo ”;

    // Pass the hidden fields to the blog form
    function wpmu_add_hidden_blogfields() {
    if ( !empty( $_POST[‘mathvalue0’]) && !empty($_POST[‘mathvalue1’] ) && !empty($_POST[‘mathvalue2′])) {
    echo “”;
    echo “”;
    echo “”;

    function blockspam_stylesheet() {

    .mu_register .error {font-size: 12px; margin:5px 0; }
    .mu_register #spambot {font-size: 12px; margin:10px 0; }
    #spambot {clear:both; font-size: 12px; margin:10px 0;}


    // If from WPMU wp-signup check for hidden fields and kick an error instead of dieing.
    function wpmu_check_hidden_fields() {

    // Get values from POST data
    $val0 = '';
    $val1 = '';
    $val2 = '';
    if ( isset( $_POST['mathvalue0'] ) ) {
    $val0 = $_POST['mathvalue0'];
    if ( isset( $_POST['mathvalue1'] ) ) {
    $val1 = $_POST['mathvalue1'];
    if ( isset( $_POST['mathvalue2'] ) ) {
    $val2 = $_POST['mathvalue2'];

    // Check values
    //if ( ( $val0 == '' ) || ( $val1 == '' ) || ( intval($val2) != (intval($val0) + intval($val1)) ) ) {
    if ( ( $val0 == '' ) || ( $val1 == '' ) || ( intval($val2) != (intval($val0) – intval($val1)) ) ) {

    $error = get_site_option('blockspam_error');
    echo '’ . $error . ”;


    function blockspam_site_admin_options_process() {
    update_site_option( ‘blockspam_error’ , $_POST[‘blockspam_error’] );

    function blockspam_site_admin_options() {

    <?php _e('spammers … get a life! ‘) ?>
    <?php _e('You can really do better things in life.‘) ?>

  10. deano April 6, 2010 / 8:59 pm

    sorry i forgot to mention I use ordPress MU 2.9.2 and buddypress. thanks for the great plugin I hope to get this to work.
    p.s. I think it might have started with a non-working install from the beginning because there was spam coming through, and now I see that i can register whether or not the answer is correct.

  11. anton April 20, 2010 / 2:33 am

    I’m running bp 1.2.3 and the latest wpmu version with a custom theme and a custom registration page eg “http://mysite.com/create-an-account”.

    On the submit page, it results in a blank page. No error. Just a blank page. Is this something to do with the custom theme I’m using instead of the default bp 1.2.3 theme? Any workaround this?

    • James April 21, 2010 / 7:51 am

      I’m not sure offhand but it sounds as though one of the hooks is missing. You are using the latest version of the plugin correct? If you want to send me your theme I’ll take a look at it. You can email it to jwpegram at gmail dot com.

  12. James January 10, 2011 / 5:33 pm

    For those still having issues with this plugin, I’ve uploaded a new version to wordpress.org that has been tested with WordPress 3.0.4 and Buddypress 1.2.7 (using the BP default theme).

    If you still have problems just hang on, I’e got an entirely new plugin coming that handles all the functions of both this and the original block-spam-by-math plugin just updated for the WP 3.x series. Should be available in a few days.

  13. Samit Koyom January 25, 2011 / 10:22 am

    Thank James it pretty plugin I try to used in my blog.

  14. GG March 14, 2011 / 5:40 pm

    btw, activatin plugin on latest wp breaks nav_menu.php

Comments are closed.