Customizing Easy Forms

Introduction

Easy Forms is an application developed in object oriented PHP under the MVC pattern. If you have programming skills, it will be easy to customize Easy Forms according to your requirements. However, this guide is intended for users who don't have programming knowledge.

Note: @app refers to the application root directory.

Site Settings (Google reCAPTCHA)

Important! To use reCAPTCHA component in the form builder, you must first add reCAPTCHA keys in the site configuration. Otherwise, reCAPTCHA will not operate. If you created the form before adding the keys, you must update the form.

By configuring the Site you may:

Changing the logo

The first thing to do to customize your application is change the logo. The logo is not an image but a text that you can modify by simply renaming the application.

To change the logo you must follow the next steps:

  1. Click on your username in the navigation menu.
  2. Click "Settings".
  3. Change the name to 'My Forms' or the name you prefer, better one short.
  4. Click "Update".

The page will reload and will show a message to let you know that the update has been successful. Now 'My Forms' will appear as the application logo.

Easy Forms - Changing the logo

How to enable GeoLocation?

In short, your must upload the GeoLite2 DB to your server and enable Google Maps.

1. Upload the GeoLite2 DBs

GeoLite2 databases are free IP GeoLocation databases and are needed to collect your users' geographical location. Therefore, you must:

  1. Download GeoLite2 City and GeoLite2 Country databases.
  2. Unzip the files and place them in the directory @app/components/analytics/enricher/GeoIP.
  3. Verify that the files match these paths:
    • @app/components/analytics/enricher/GeoIP/GeoLite2-City.mmdb
    • @app/components/analytics/enricher/GeoIP/GeoLite2-Country.mmdb

2. Add a Google Maps Api Key to the App

  1. Get a key for Google Maps JavaScript API
  2. Open the @app/config/params.php file.
  3. Add the Google Maps JavasCript Api key to 'Google.Maps.apiKey'.
  4. Save the file.

Note: The Google Maps Api Key is required by the Submission Manager to show you the sender information.

Configure access to your SMTP server

Send emails by using the PHP native function - mail() - suffer from many drawbacks in terms of Deliverability. Many anti spam filters end up blocking these emails. To avoid this problem, you must configure an SMTP account in the application to send all mail through it.

To enable the SMTP settings you must follow the next steps:

  1. Open the file @app/config/params.php.
  2. Change the value of 'App.Mailer.transport' to 'smtp'.
  3. Save the file.

The SMTP server authentication data can be the one that comes with your hosting plan or by using an external service, such as Hotmail, Yahoo, Gmail or other.

As an example, consider how to configure the SMTP server with a Google Apps account or Gmail.

To configure your SMTP server:

  1. In the navigation bar, click on your username and then click Settings
  2. In the lower left block, click Mail Server
  3. Please fill the fields with the following data:
    - Host: smtp.gmail.com
    - Port: 587
    - Encryption: TLS
    - Username: Your username on Google Apps or Gmail
    - Password: Your password on Google Apps or Gmail
    
  4. Click Update

Easy Forms - SMTP Server

Note: You can read more information in our Email Setup documentation.

Configure Asynchronous Email Notifications

Important! Asynchronous Email Notifications are sent by the Cron Job, so you must enable it first.

To enable asynchronous email notifications you must follow the next steps:

  1. Open the file @app/config/params.php.
  2. Change the value of 'App.Mailer.async' to 1.
  3. Save the file.

Note: This feature is especially useful if you are sending your emails vis SMTP.

How to configure your Cron Job?

To know your cron job command you must follow the next steps:

1. Click on your username in the navigation menu.
2. Click "Settings".
3. Click on "Performance".
4. Copy the Cron Job command.

To configure the cron job with cPanel, perform the following steps:

1. Go to your cPanel
2. Click on Cron Jobs
3. Go to Add New Cron Job section
4. Select: Common Settings: Once Per Minute (* * * * *)
5. Paste the Command (of the previous step)
6. Press Add New Cron Job button

Changing the number of rows

The Form Manager displays 5 rows by default, Submission Manager, User Manager and others. You can change this very easily.

For that:

  1. Open the file @app/config/params.php.
  2. Change the value of 'GridView.pagination.pageSize' to `10 or the number of rows you want.
  3. Save the file.

When you return to the app it will display the number of rows you have defined.

Easy Forms - Changing the number of rows

Limit Access to the Login Page to Specific IP Addresses

Securing your site is important. After all, it means you are protecting not only your personal information and data, but also any information your users collect on your site.

To limit the access to the login page to one or multiple static IP addresses:

  1. Open the following file: @app/config/params.php
  2. Add one or more IP Addresses to the 'App.User.validIps' key
  3. Save the file

That's it! When an unauthorized visitor tries to access that page, he’ll see an 404 error - Page Not Found.

Note: If you're not sure which is your IP address, just ask Google. Just enter “What is my IP” and Google will tell you.

Compress the Forms' Uploaded Images automatically

You can reduce the images weight that users upload with your forms in a very simple way, just follow these steps:

  1. Open the file @app/config/params.php.
  2. Change the value of 'Form.Uploads.imageCompression' to 70 or the compression number you want (between 0 and 99).
  3. Save the file.

Note: This feature is especially useful if your forms allow users to upload pictures from their mobile devices and you need to save hosting space.

Change language

Easy Forms comes with the English language by default. However, it let each user change the whole application language very easily, allowing them to see it in their own language.

Change the application language for a user

  1. Go to the User Manager
  2. Click on the "Actions" button of the User to update
  3. Click "Update"
  4. Change the language to Spanish
  5. Click "Save"

From now on, if your user accesses the application, he will see the interface in Spanish.

Note: Keep in mind that at any moment your user can change the application language. For this, he will only need to update the field Language on his User Profile.

Change the default application language

  1. Open the configuration file @app/config/web.php.
  2. Find the line: 'language' => 'en-US’, and replace 'en-US' for another language you have translated, to Spanish for example: ‘es-ES’.

When you reload the application you will see that the application default language is Spanish.

Easy Forms - Change the default application language

Add a new language

To add a new language to the application, you basically need two things:

  1. Translate English strings to the new language.
  2. Add the new language to the list of languages supported by the application.

1. Translate strings

To translate strings you must do the following:

  1. Locate the @app/messages folder and create a new folder which name include the ISO language code (in lowercase) and the ISO country code (in uppercase), separated by a hyphen. For example, Brazilian Portuguese, 'pt-BR'.
  2. Then copy the file app.php from the 'es-ES' folder and paste it into your new folder. Let's say in 'pt-BR'.
  3. Then translate strings from English to the new language (To continue our example, replace strings in Spanish to Portuguese).
  4. Save the file and the application will be translated to the new language.

2. Add new language to the application

To add your new language:

  1. Open the file @app/helpers/language.php
  2. Add the line "pt-BR" => Yii :: t ('app', 'Portuguese'), to suportedLanguage() method.
  3. Save the file

Following the example, the method should end like:

public static function supportedLanguages()
{
    return array(
        "en-US" => Yii::t('app', 'English'),
        "es-ES" => Yii::t('app', 'Spanish'),
        "pt-BR" => Yii::t('app', 'Portuguese'),
    );
}

From now on, when you enter the application, you can change the language to portuguese from your User Profile.

Easy Forms - Add new language to the application

Note: Keep in mind that the text you type in the source code must be in English.

Additional Step

As added the 'Portuguese' string to the application, it is recommended to translate this string in both Spanish and Portuguese:

  1. Open the file @app/messages/es-ES/app.php and add ‘Portuguese’ => ‘Portugués’,.
  2. Open the file @app/messages/pt-BR/app.php and add ‘Portuguese’ => ‘Português’,.

How to enable DEBUG mode

To enable DEBUG mode you must remove the // characters (lines 3 and 4) in the @app/index.php file. Then, you will be able to see the error message and stack trace.

Important! After fix any issue or make any customization but before deployed to production, you must comment out the same two lines.

How to fix issues about File Permissions

For the application's correct operation you must ensure that some files or directories have the proper file permissions:

  • Runtime directory: chmod -R 0777 @app/runtime
  • Assets directory: chmod -R 0777 @app/assets
  • Static Files directory: chmod -R 0777 @app/static_files
  • Database configuration file (The install script needs write permission): chmod 0777 @app/config/db.php

If the files' owner is the web server. Then, set the file permissions to 0755. For example, if you use an FTP client such as Filezilla:

1. Open your FTP client
2. Right-click on 'runtime' directory and click on 'File permissions...'
3. Write 755
4. Check 'Recurse into subdirectories' and 'Apply to all files and directories'
5. Press ok
6. Repeat the same steps with the 'assets' and 'static_files' directories.
7. Right-click on the 'config/db.php' file and click on 'File permissions...'
8. Write 755 and Press ok

Note: If you have trouble setting permissions, get in touch with our support team and we will be more than happy to help you.