+49 69 83008980 service@xqueue.com

Benötigen Sie Hilfe?

WordPress Plugin – Using Forms

Sie sind hier:
< Alle Themen

 

Specifying Forms

The plugin allows to select predefined and custom forms. Predefined forms are located inside the plugin folder: “wp-content/plugins/xqueue-maileon/views“. They will be overwritten with each update of the plugin, thuy, they should not be changed. Instead they should be copied, renamed and then they should be uploaded to the folder for custom forms, which is inside the uploads folder: “wp-content/uploads/xqueue-maileon/views“. these forms will not be overwritten or changed by the plugin in any case.
Since version 2.10 it is also possible to use (child) theme templates as forms. The available forms can be seen in the settings of the plugin:

WordPress Plugin – Using Forms IMG 01


Please be aware: when loading a template by it’s filename, the plugin will search in the following order:

1. Child theme folder
2. Theme folder
3. Uploads folder
4. Plugin views folder
Forms are specified in the shorttag as attribute “template”.
Example:

Error: 
Template not found 'my-own-template.php' (location: '/home/wp/disk/wordpress/wp-content/uploads/xqueue-maileon/views/my-own-template.php').
Please correct your template name in [maileon-contact ... template="my-own-template.php"]

In this example, the file would be loaded from “wp-content/uploads/xqueue-maileon/views/my-own-template.php“.
 

Standard Forms

The plugin ships with a set of default forms, which are placed in the folder “wp-content/plugins/xqueue-maileon/views“. They are mainly meant for demonstration purposes, e.g. how to show simple forms, dropdowns, Address Check, or reCaptcha. The currently available files can be seen in the plugin configuration on the API-Settings page:

WordPress Plugin – Using Forms IMG 02


If no template is specified, the standard form will be used. It provides input fields for the email address, first name and last name.

Custom Forms

If you wish to add a custom form to use more fields in your form or use a different styling, just add your template to “wp-content/uploads/xqueue-maileon/views” (you might need to create that folder first). A basic template as described above can be found in file ‚maileon-contact-form.php‘, a version extended by gender selection is shipped with the plugin as example in ‚\wp-content\plugins\xqueue-maileon\views\maileon-contact-form-custom-sample.php‘. You can take a copy of those files and edit it according to your wishes.

Again, you can check available templates in the configuration settings:

WordPress Plugin – Using Forms IMG 03


To extend the standard form, just add new input fields according to the following scheme for the name of the field:

Standard fields have to start with “standard_” followed by the standard field name (see previous link). E.g. for the last name use “standard_LASTNAME”.

Custom fields have to start with “custom_” followed by the custom field name (capitalization!). E.g. for the field “myCustomField” use “custom_myCustomField”.
You can then use the attribute ‚template‘ to select the file:


 

Profile-Update-Forms

Since version 2.7.0 the plugin also supports profile update pages using the shortcode.

Fehlende Parameter.

The shortcode supports the template attribute with the same naming scheme for fields in the form as the registration pages, including standard and custom form parameters. As URL parameters the contact ID must be passed as parameter ‚cid‘ and the checksum as ‚cs‘. In Maileon the URL on the profile update page would for example look like “…/profile-update?cid=[[CONTACT|ID]]&cs=[[CONTACT|CHECKSUM]]“.
 

Prefill Data

In order to prefill a form, the script analyzes the form and collects all fields with names starting with standard_ or custom_ and requests the corresponding data from Maileon. It then provides the data in the template as PHP array $form_data. To prefill some field make sure to set its value to the matching array value, e.g. for last name use:

<?= (!empty($form_data[ 'standard_LASTNAME' ])?$form_data[ 'standard_LASTNAME' ]:"")?>

Example for the whole field:

<input id="maileon_contact_form_lastname" type="text" class="input et_pb_contact_name" value="<?= (!empty($form_data[ 'standard_LASTNAME' ])?$form_data[ 'standard_LASTNAME' ]:"")?/>" name="standard_LASTNAME">

 

(Child) Theme Templates

Inhaltsverzeichnis

Bleiben Sie Up-to-Date und profitieren Sie von spannenden News und Aktionen.

Maileon ist ein Produkt der XQueue GmbH

Newsletter Pop-Up