We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6902
    • 126 Posts
    I just wanted a simple hook to replace line feeds/breaks with the
    tag on a simple contact form’s textarea so that the final email was more readable. Here’s my custom hook if anyone wants it! Be sure to insert it before the email hook so that the tags are added before the email gets sent.

    <?php
    
    //******************************************
    // Created by Darren Doyle, Dec. 2010
    //******************************************
    
    // ----- PURPOSE -----
    // Custom Formit Hook that replaces
    // all line feeds with a <br /> tag on
    // form fields to help make the email
    // output more readable.
    
    // Set this variable to an array containing
    // the names of the form fields to process.
    $fields = array('text');
    
    // process the field(s)
    foreach ( $fields as $field) {
    	$src = $hook->getValue($field);
    	$out = nl2br($src);
    	$hook->setValue($field, $out);
    }
    
    return true;