Migrating custom code from Quform 1.x

CSS classes

DescriptionOld version (1.x)New version (2.x)
Outermost form wrapper (all forms).iphorm-outer.quform
Outermost form wrapper (specific form ID).iphorm-outer-1.quform-1
The <form> tag (all forms).iphorm.quform-form
The <form> tag (specific form ID).iphorm-1.quform-form-1
Form inner wrapper (all forms).iphorm-inner.quform-form-inner
Form inner wrapper (specific form ID).iphorm-inner-1.quform-form-inner-1
Wrapper around all elements (all forms).iphorm-elements.quform-elements
Wrapper around all elements (specific form ID).iphorm-elements-1.quform-elements-1
Element wrapper (all forms).iphorm-element-wrap.quform-element
Element wrapper (specific element ID).iphorm_1_1-element-wrap.quform-element-1_1
Element wrapper type.iphorm-element-wrap-text.quform-element-text
Element spacer.iphorm-element-spacer.quform-spacer
Element input wrapper.iphorm-input-wrap.quform-input
Element field class (of the same type).iphorm-element-text.quform-field-text
Element field class (specific element ID).iphorm_1_1.quform-field-1_1

Data types

  • The Date element value is now a string in the format YYYY-MM-DD instead of array('day' => DD, 'month' => MM, 'year' => YYYY)
  • The Time element value is now a string in the format HH:MM (always 24h format) instead of array('hour' => HH, 'minute' => MM, 'ampm' => 'am|pm')

Getting form values

Old version:

1
$form->getValue('iphorm_1_1');
$form->getValue('iphorm_1_1');

New version:

1
$form->getValue('quform_1_1');
$form->getValue('quform_1_1');

Dynamic default value

The name of the hook has changed from:

1
iphorm_element_value_parameter
iphorm_element_value_parameter

To:

1
quform_element_value_parameter
quform_element_value_parameter

Hooks

iphorm_pre_display

The name has changed.

Old version:

1
2
3
4
5
function my_pre_display($form)
{
    // Custom code
}
add_action('iphorm_pre_display_1', 'my_pre_display');
function my_pre_display($form)
{
    // Custom code
}
add_action('iphorm_pre_display_1', 'my_pre_display');

New version:

1
2
3
4
5
function my_pre_display(Quform_Form $form)
{
    // Custom code
}
add_action('quform_pre_display_1', 'my_pre_display');
function my_pre_display(Quform_Form $form)
{
    // Custom code
}
add_action('quform_pre_display_1', 'my_pre_display');

Where the number 1 is the form ID.

iphorm_pre_process

The name has changed, there are now 2 arguments, and should use add_filter.

Old version:

1
2
3
4
5
function my_pre_process($form)
{
    // Custom code
}
add_action('iphorm_pre_process_1', 'my_pre_process');
function my_pre_process($form)
{
    // Custom code
}
add_action('iphorm_pre_process_1', 'my_pre_process');

New version:

1
2
3
4
5
6
7
function my_pre_process(array $result, Quform_Form $form)
{
    // Custom code
 
    return $result;
}
add_filter('quform_pre_process_1', 'my_pre_process', 10, 2);
function my_pre_process(array $result, Quform_Form $form)
{
    // Custom code

    return $result;
}
add_filter('quform_pre_process_1', 'my_pre_process', 10, 2);

Where the number 1 is the form ID.

iphorm_post_process

The name has changed, there are now 2 arguments, and should use add_filter.

Old version:

1
2
3
4
5
function my_post_process($form)
{
    // Custom code
}
add_action('iphorm_post_process_1', 'my_post_process');
function my_post_process($form)
{
    // Custom code
}
add_action('iphorm_post_process_1', 'my_post_process');

New version:

1
2
3
4
5
6
7
function my_post_process(array $result, Quform_Form $form)
{
    // Custom code
 
    return $result;
}
add_filter('quform_post_process_1', 'my_post_process', 10, 2);
function my_post_process(array $result, Quform_Form $form)
{
    // Custom code

    return $result;
}
add_filter('quform_post_process_1', 'my_post_process', 10, 2);

Where the number 1 is the form ID.

iphorm_upload_path

The name has changed and there are now 3 arguments.

Old version:

1
2
3
4
5
6
7
function my_upload_path($path, $element)
{
    // Custom code
 
    return $path;
}
add_filter('iphorm_upload_path_1', 'my_upload_path');
function my_upload_path($path, $element)
{
    // Custom code

    return $path;
}
add_filter('iphorm_upload_path_1', 'my_upload_path');

New version:

1
2
3
4
5
6
7
function my_upload_path($path, Quform_Element_File $element, Quform_Form $form)
{
    // Custom code
 
    return $path;
}
add_filter('quform_upload_path_1', 'my_upload_path', 10, 3);
function my_upload_path($path, Quform_Element_File $element, Quform_Form $form)
{
    // Custom code

    return $path;
}
add_filter('quform_upload_path_1', 'my_upload_path', 10, 3);

Where the number 1 is the form ID.

iphorm_pre_validate

The name has changed, there are now 2 arguments, and should use add_filter.

Old version:

1
2
3
4
5
function my_pre_validate($form)
{
    // Custom code
}
add_action('iphorm_pre_validate_1', 'my_pre_validate');
function my_pre_validate($form)
{
    // Custom code
}
add_action('iphorm_pre_validate_1', 'my_pre_validate');

New version:

1
2
3
4
5
6
7
function my_pre_validate(array $result, Quform_Form $form)
{
    // Custom code
 
    return $result;
}
add_filter('quform_pre_validate_1', 'my_pre_validate', 10, 2);
function my_pre_validate(array $result, Quform_Form $form)
{
    // Custom code

    return $result;
}
add_filter('quform_pre_validate_1', 'my_pre_validate', 10, 2);

Where the number 1 is the form ID.

iphorm_post_validate

The name has changed, there are now 2 arguments, and should use add_filter.

Old version:

1
2
3
4
5
function my_post_validate($form)
{
    // Custom code
}
add_action('iphorm_post_validate_1', 'my_post_validate');
function my_post_validate($form)
{
    // Custom code
}
add_action('iphorm_post_validate_1', 'my_post_validate');

New version:

1
2
3
4
5
6
7
function my_post_validate(array $result, Quform_Form $form)
{
    // Custom code
 
    return $result;
}
add_filter('quform_post_validate_1', 'my_post_validate', 10, 2);
function my_post_validate(array $result, Quform_Form $form)
{
    // Custom code

    return $result;
}
add_filter('quform_post_validate_1', 'my_post_validate', 10, 2);

Where the number 1 is the form ID.

iphorm_pre_send_notification_email / iphorm_pre_send_autoreply_email

The names have changed, the arguments have changed, the $mailer object no longer needs to be returned, it should use add_action and the number in the hook should be the notification unique ID. Code using the old autoreply hook should use this new hook too.

Old version:

1
2
3
4
5
6
7
function my_pre_send_notification_email($mailer, $form, $attachments)
{
    // Custom code
 
    return $mailer;
}
add_filter('iphorm_pre_send_notification_email_1', 'my_pre_send_notification_email', 10, 3);
function my_pre_send_notification_email($mailer, $form, $attachments)
{
    // Custom code

    return $mailer;
}
add_filter('iphorm_pre_send_notification_email_1', 'my_pre_send_notification_email', 10, 3);

New version:

1
2
3
4
5
function my_pre_send_notification(PHPMailer $mailer, Quform_Notification $notification, Quform_Form $form)
{
    // Custom code
}
add_action('quform_pre_send_notification_1_1', 'my_pre_send_notification', 10, 3);
function my_pre_send_notification(PHPMailer $mailer, Quform_Notification $notification, Quform_Form $form)
{
    // Custom code
}
add_action('quform_pre_send_notification_1_1', 'my_pre_send_notification', 10, 3);

Where the number 1_1 is the notification unique ID.

iphorm_upload_absolute_path

The name has changed and there are now 3 arguments.

Old version:

1
2
3
4
5
6
7
function my_upload_absolute_path($path, $element)
{
    // Custom code
 
    return $path;
}
add_filter('iphorm_upload_absolute_path_1', 'my_upload_absolute_path', 10, 2);
function my_upload_absolute_path($path, $element)
{
    // Custom code
 
    return $path;
}
add_filter('iphorm_upload_absolute_path_1', 'my_upload_absolute_path', 10, 2);

New version:

1
2
3
4
5
6
7
function my_upload_absolute_path($path, Quform_Element_File $element, Quform_Form $form)
{
    // Custom code
 
    return $path;
}
add_filter('quform_upload_absolute_path_1', 'my_upload_absolute_path', 10, 3);
function my_upload_absolute_path($path, Quform_Element_File $element, Quform_Form $form)
{
    // Custom code

    return $path;
}
add_filter('quform_upload_absolute_path_1', 'my_upload_absolute_path', 10, 3);

Where the number 1 is the form ID.

iphorm_plugin_name

The name has changed.

Old version:

1
2
3
4
5
function my_quform_name()
{
    return 'Forms';
}
add_filter('iphorm_plugin_name', 'my_quform_name');
function my_quform_name()
{
    return 'Forms';
}
add_filter('iphorm_plugin_name', 'my_quform_name');

New version:

1
2
3
4
5
function my_quform_plugin_name()
{
    return 'Forms';
}
add_filter('quform_plugin_name', 'my_quform_plugin_name');
function my_quform_plugin_name()
{
    return 'Forms';
}
add_filter('quform_plugin_name', 'my_quform_plugin_name');

iphorm_success_message

The name has changed, there are 3 arguments and the number in the hook should be the confirmation unique ID.

Old version:

1
2
3
4
5
6
7
8
function my_success_message($message, $form)
{
    // Custom code example
    $message = 'This is a success message.';
 
    return $message;
}
add_filter('iphorm_success_message_1', 'my_success_message', 10, 2);
function my_success_message($message, $form)
{
    // Custom code example
    $message = 'This is a success message.';

    return $message;
}
add_filter('iphorm_success_message_1', 'my_success_message', 10, 2);

New version:

1
2
3
4
5
6
7
8
function my_success_message($message, Quform_Confirmation $confirmation, Quform_Form $form)
{
    // Custom code example
    $message = 'This is a success message.';
 
    return $message;
}
add_filter('quform_confirmation_message_1_1', 'my_success_message', 10, 3);
function my_success_message($message, Quform_Confirmation $confirmation, Quform_Form $form)
{
    // Custom code example
    $message = 'This is a success message.';

    return $message;
}
add_filter('quform_confirmation_message_1_1', 'my_success_message', 10, 3);

Where the number 1_1 is the confirmation unique ID.

iphorm_success_redirect_url

The name has changed, there are 3 arguments and the number in the hook should be the confirmation unique ID.

Old version:

1
2
3
4
5
6
7
8
function my_success_redirect_url($url, $form)
{
    // Custom code example
    $url = 'http://www.example.com/thank-you';
 
    return $url;
}
add_action('iphorm_success_redirect_url_1', 'my_success_redirect_url', 10, 2);
function my_success_redirect_url($url, $form)
{
    // Custom code example
    $url = 'http://www.example.com/thank-you';

    return $url;
}
add_action('iphorm_success_redirect_url_1', 'my_success_redirect_url', 10, 2);

New version:

1
2
3
4
5
6
7
8
function my_success_redirect_url($url, Quform_Confirmation $confirmation, Quform_Form $form)
{
    // Custom code example
    $url = 'http://www.example.com/thank-you';
 
    return $url;
}
add_action('quform_confirmation_redirect_url_1_1', 'my_success_redirect_url', 10, 3);
function my_success_redirect_url($url, Quform_Confirmation $confirmation, Quform_Form $form)
{
    // Custom code example
    $url = 'http://www.example.com/thank-you';

    return $url;
}
add_action('quform_confirmation_redirect_url_1_1', 'my_success_redirect_url', 10, 3);

Where the number 1_1 is the confirmation unique ID.

PHP classes

Old class (1.x)New class (2.x)
iPhormQuform_Form
iPhorm_CaptchaQuform_Captcha
iPhorm_ElementQuform_Element
iPhorm_Element_CaptchaQuform_Element_Captcha
iPhorm_Element_CheckboxQuform_Element_Checkbox
iPhorm_Element_DateQuform_Element_Date
iPhorm_Element_EmailQuform_Element_Email
iPhorm_Element_FileQuform_Element_File
iPhorm_Element_Groupend(removed)
iPhorm_Element_GroupstartQuform_Element_Group
iPhorm_Element_HiddenQuform_Element_Hidden
iPhorm_Element_HoneypotQuform_Element_Honeypot
iPhorm_Element_HtmlQuform_Element_Html
iPhorm_Element_MultiQuform_Element_Multi
iPhorm_Element_PasswordQuform_Element_Password
iPhorm_Element_RadioQuform_Element_Radio
iPhorm_Element_RecaptchaQuform_Element_Recaptcha
iPhorm_Element_SelectQuform_Element_Select
iPhorm_Element_TextQuform_Element_Text
iPhorm_Element_TextareaQuform_Element_Textarea
iPhorm_Element_TimeQuform_Element_Time

Still having trouble? Head over to the forums.

Forums