WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7 Modules
[resolved] Sending all fields with content - code provided (2 posts)

  1. hitolonen
    Member
    Posted 1 year ago #

    Using the "Send all fields" feature on a project and wanted to send only the fields that have content and also change "Field-Name" to "Field Name". Thought someone might appreciate the codes.

    Find:

    foreach($post as $k => $v) {
    		if(is_array($v)) {
    			$v = implode(', ', $v);
    		}
    		if($html) {
    			$postbody .= "<dt style='font-size:1.2em;'><font size='3'><strong>{$k}</strong>:</font></dt><dd style='padding:0 0 .5em 1.5em; margin:0;'>{$v}</dd>";
    		} else {
    			$postbody .= "{$k}: {$v}\n";
    		}
    	}

    Replace:

    foreach($post as $k => $v) {
    		if(is_array($v)) {
    			$v = implode(', ', $v);
    		}
    		if($html) {
    		$k2 = str_replace("-", " ", $k);
    		if (!empty ($v))
    			$postbody .= "<dt style='font-size:1.2em;'><font size='3'><strong>{$k2}</strong>:</font></dt><dd style='padding:0 0 .5em 1.5em; margin:0;'>{$v}</dd>";
    		} else {
    		$k2 = str_replace("-", " ", $k);
    		if (!empty ($v))
    			$postbody .= "{$k2}: {$v}\n";
    		}
    	}

    http://wordpress.org/extend/plugins/contact-form-7-modules/

  2. Zack Katz
    Member
    Plugin Author

    Posted 1 year ago #

    I've added this in version 1.3 - thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.