Description
Process a contact form submissionHandle the contact form submission
- Check for required fields
- Perform spam checking
- Send email, copying user if required
- Display "thank you" message
- $email_to
- ( mixed ) required –
- bw_akismet_check() – Perform an Akismet check on the message, if it’s activated
- bw_array_get() – Return the array[index] or array->index (for an object) or a default value if not set
- bw_display_messages() – Display the messages
- bw_get_message() – Return the sanitized message text
- bw_get_subject() – Return the sanitized message subject
- bw_issue_message() – Issue a message for a particular field
- bw_send_email() – Build and send an email with fields substituted by default
- bw_thankyou_message() – Display a "thank you" message
- oik_require() – Invoke require_once on an oik include file or other file
- p_() – Output a paragraph of translated text
- retlink() – Return a well formed link
Usage
_bw_process_contact_form_oik( $email_to );Parameters
Returns
voidSource
File name: oik/shortcodes/oik-contact-form.phpLines:
1 to 40 of 40
function _bw_process_contact_form_oik( $email_to ) { $message = bw_get_message(); $valid = bw_validate_contact_fields(); if ( $email_to && $valid ) { oik_require( "includes/oik-contact-form-email.php" ); $fields = array(); $subject = bw_get_subject(); $fields['comment_content'] = $message; $fields['comment_author'] = bw_array_get( $_REQUEST, bw_contact_field_full_name( 'name'), null ); $fields['comment_author_email'] = bw_array_get( $_REQUEST, bw_contact_field_full_name( 'email'), null ); $fields['comment_author_url'] = null; $fields['comment_type'] = 'oik-contact-form'; $fields['subject'] = $subject; $send = bw_akismet_check( $fields ); if ( $send ) { // We only need the Message field once. $message = bw_get_contact_fields(); $message .= "<br />\r\n"; $message .= retlink( null, get_permalink() ); $fields['message'] = $message; $fields['contact'] = $fields['comment_author']; $fields['from'] = $fields['comment_author_email']; $sent = bw_send_email( $email_to, $subject, $message, null, $fields ); } else { $sent = true; // Pretend we sent it. } bw_thankyou_message( $fields, $send, $sent ); } else { $sent = false; $text = __( "Invalid. Please correct and retry.", "oik" ); bw_contact_issue_message( null, "bw_field_required", $text ); $displayed = bw_display_messages(); if ( !$displayed ) { p_( $text ); } } return( $sent ); }View on GitHub View on Trac
Invoked by
Calls
1 to 11 of 11
