Not signed in ( Sign In)

Categories

Welcome, Guest

Want to take part in these discussions? Sign in if you have an account, or apply for one below

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

    •  
      CommentAuthorsimatao
    • CommentTimeMar 23rd 2010
     permalink
    Hi!

    I love my new flatpress blog. However, people contact me, expect a reply, but don't leave their email adresse. How do I have to change which files, in order to force people to enter their email, if they fill out the contact form?

    sorry, i am really bad in php.

    thanks guys!
    t
    •  
      CommentAuthorNoWhereMan
    • CommentTimeMar 29th 2010 edited
     permalink
    put this in a plugin:
    function plugin_email_contact($bool, $comment) {
    if (!$bool) return false;
    if (!isset($comment['email'])) return false;
    }
    add_filter('comment_validate', 'plugin_email_contact');
    •  
      CommentAuthorsimatao
    • CommentTimeMar 29th 2010
     permalink
    sorry bothering you...

    i am not familiar with flatpress yet.

    i created a folder in the plugin folder, made a force_email.php inside and pasted the code. obviously not what you intended me to do.

    put your code where?

    first of all, thanks for the help;-)
    •  
      CommentAuthorNoWhereMan
    • CommentTimeMar 29th 2010 edited
     permalink
    DISCLAIMER:

    1) I haven't tested this code
    2) this forces the email field to be not empty both for the comment form and the contact form

    create folder fp-plugin/emailcheck/
    create file fp-plugin/emailcheck/plugin.emailcheck.php
    with contents:
    <?php
    /*
    Plugin Name: EmailCheck
    Version: 1.0
    Plugin URI: http://wiki.flatpress.org
    Description: Force Email Check when posting comments or using contact form
    Author: NoWhereMan
    Author URI: http://www.flatpress.org
    */

    function plugin_email_contact($bool, $comment) {
    global $smarty;
    if (!$bool) return false;
    if (!isset($comment['email'])) {
    $smarty->append('error', "Please enter your email address, so that I may reply");
    return false;
    }
    return true;
    }
    add_filter('comment_validate', 'plugin_email_contact', 10, 2);



    now enable EmailCheck from the admin panel
    •  
      CommentAuthorsimatao
    • CommentTimeMar 29th 2010
     permalink
    gives me this:

    Warning: Missing argument 2 for plugin_email_contact() in /home/psychologie/schoernt/public_html/flatpress/fp-plugins/emailcheck/plugin.emailcheck.php on line 11


    Will the code generate a message like "Please enter your email address, so that I may reply"
    •  
      CommentAuthorNoWhereMan
    • CommentTimeMar 29th 2010
     permalink
    I have updated the code above, see if now it works for you
    •  
      CommentAuthorsimatao
    • CommentTimeMar 29th 2010
     permalink
    nope.
    crashed my site.. sorry.

    Notice: Undefined variable: smarty in /home/psychologie/schoernt/public_html/flatpress/fp-plugins/emailcheck/plugin.emailcheck.php on line 14

    Fatal error: Call to a member function append() on a non-object in /home/psychologie/schoernt/public_html/flatpress/fp-plugins/emailcheck/plugin.emailcheck.php on line 14
    •  
      CommentAuthorNoWhereMan
    • CommentTimeMar 29th 2010
     permalink
    ouch, sorry. I forgot one line; I hope now it works, otherwise I'll try and inspect it later
    •  
      CommentAuthorsimatao
    • CommentTimeMar 30th 2010
     permalink
    ;-)
    almost done

    the error message appears properly. just one mor thing: It doesn't post the entries any more......

    So if someone fills out everything correctly and pushes "send", nothing happens. no "message was sent successfully", no message beeing sent actually, and no comment is created.

    If you find a solution to that it will become one of my most favorite plugins :-D
    •  
      CommentAuthorNoWhereMan
    • CommentTimeMar 30th 2010
     permalink
    you're right. just add
    return true;
    at the bottom (code fixed above)
    •  
      CommentAuthorsimatao
    • CommentTimeMar 30th 2010
     permalink
    wow! You are truley the hero of fp ! ;-)

    Thanks for your patience!
    I am not sure if it was already before installing the plugin, that the tags Name, Email and Web appeared #behind# the entry fields on the comments site or if that happend throught the plugin. anyway, it's still readable and my buddies won't forget to enter their adress anymore.
    •  
      CommentAuthorsimatao
    • CommentTimeMar 30th 2010
     permalink
    uhm, and if i may ask you, is there an easy way to get rid of the WEB field, or would that require another "plugin"? if so, don't bother.