Support » Plugin: Grunion Contact Form » [Plugin: Grunion Contact Form] Plugin doesn't work without Akimet

  • I don’t use Akismet. I get the error:

    Fatal error: Call to undefined function akismet_http_post() in /home/cloudf2/public_html/blog/wp-content/plugins/grunion-contact-form/grunion-contact-form.php on line 497

    I will disable the code to Akimet manually, but it would be nice if it was part of the plugin feature.

Viewing 15 replies - 1 through 15 (of 15 total)
  • For anyone else who runs into this problem, I commented out the following code in grunion-contact-form.php:

    // $akismet_values = contact_form_prepare_for_akismet( $contact_form_values );
    	// $is_spam = contact_form_is_spam_akismet( $akismet_values );
    	// if ( is_wp_error( $is_spam ) )
    	//	return; // abort
    	// else if ( $is_spam )
    	//	$spam = '***SPAM*** ';

    This prevents the plugin from calling Akismet. Seems to do the trick. A more elegant solution would be if the plugin had a settings page where you could enable or disable this function.

    Plugin Author Joseph Scott

    (@josephscott)

    This had been reported in a previous thread – http://wordpress.org/support/topic/plugin-grunion-contact-form-fatal-error-call-to-undefined-function-akismet_http_post?replies=8

    I’ve already committed a fix for this in Grunion, so it will be part of the next release. You can see what I committed here http://plugins.trac.wordpress.org/changeset/325516

    I’m also having a problem with the plugin which seems much simpler.

    When you click submit / sent it redirects to:

    mydomain.com/contact/#contact-form-8 but then the page doesn’t load properly. I have never have “Contact Form 8” installed – if it is referring to that but the same page did use to have Contact Forms ][ running on it. Is there a clash?

    Plugin Author Joseph Scott

    (@josephscott)

    Anything clues in the error logs for the server? I’ve not used Contact Forms ][, but I wouldn’t rule out a possible conflict.

    Hi Joseph, Thanks for the quick reply but I don’t know how to access the error logs.

    [delete]I thought that it might be a permalinks problem. For example, does Grunion redirect back to the same page the contact form was on to …/page/#something and then an existing permalink redirects that[/delete]

    I have set it up on a test blog that uses the same hosting provider (Heart Internet Reseller [UK]) at http://www.accuratehosting.co.uk/testwordpressinstall/?page_id=2 And when it sends the email, it fails for some reason. On the other version, I use fancy permalinks. In both cases, the page stops loading half way through.

    Given the duplicate issue, perhaps it is a server issue. Do you know how I can get hold of the error logs?

    Follow up from above: I have just installed Clean-Contact as a replacement because I needed a contact page and this has worked on other sites hosted in the same way. Anyway…

    Because Askimet was not activated, the emails failed to send by Clean-Contact (although it told me via an error message). Might this have been a problem here too? Askimet is not running on either site and I don’t have an API key to test.

    Plugin Author Joseph Scott

    (@josephscott)

    That’s definitely possible. I’ve made some changes in the development version of Grunion to address situations where the Akismet plugin was not in use. You can grab the files from http://plugins.svn.wordpress.org/grunion-contact-form/trunk/ if you want to try it out. This is the development version, so use with extra caution.

    Thanks Joe. Downloaded the Files. That did the trick. message was sent straight away.

    Hi Joseph, had this issue crop up for me today, but looking through the code in grunion-contact-form.php I saw lines 539-540

    if ( function_exists( 'akismet_http_post' ) )
    		add_filter( 'contact_form_is_spam', 'contact_form_is_spam_akismet', 10, 2 );

    and felt that the spam check is optional and only on if Akismet is available, yet the function is always getting used because of line 390:
    $is_spam = contact_form_is_spam_akismet( $akismet_values );

    I thus changed line 390 to read:
    $is_spam = apply_filters( 'contact_form_is_spam', $result = false, $akismet_values );
    which preserves the default spam check as false

    This doesn’t fix the admin.php though because of lines 450
    contact_form_akismet_submit( 'spam', $akismet_values );
    and 410
    contact_form_akismet_submit( 'ham', $akismet_values );

    So I converted those to read
    do_action('contact_form_akismet', 'spam', $akismet_values );
    and
    do_action('contact_form_akismet', 'ham', $akismet_values );
    instead and changed the lines in grunion-contact-form.php at 539-540 to now read

    if ( function_exists( 'akismet_http_post' ) ) {
    		add_filter( 'contact_form_is_spam', 'contact_form_is_spam_akismet', 10, 2 );
    		add_action( 'contact_form_akismet', 'contact_form_akismet_submit', 10, 2 );
    	}

    It all seems to work great now, both Akismet off and on. I’ve submited these changes via a ticket at http://plugins.trac.wordpress.org/ticket/1275 I case they prove useful.

    Plugin Author Joseph Scott

    (@josephscott)

    Thanks for the patch.

    Can you take a look at Grunion -trunk and see if this is still needed.

    Yep, looked through trunk and it’d still have the same error when marking a feedback as spam or ham within the admin. Have updated the ticket with a new patch against trunk.

    Plugin Author Joseph Scott

    (@josephscott)

    Thanks for the updated patch, I’ll take a look at it and start testing.

    Plugin Author Joseph Scott

    (@josephscott)

    @david

    I committed a fix for this item, basically your patch with a few very small tweaks. This will be included in the next release.

    I used the comment-out fix that scworldnetter suggested and that fixed it for me. Looking forward to the update!

    Hi

    I am running Grunion 2.1, which I believe has the fix that allows it to send email if Askimet is disabled. However, I am not receiving email from it.

    Please can anyone suggest whether 2.1 will work with Askimet disabled and, if so, what else may be the reason for my problem?

    David

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘[Plugin: Grunion Contact Form] Plugin doesn't work without Akimet’ is closed to new replies.