Tips and cases of use for a successful WordPress website with calculated forms.
There are many situations where it is needed to keep some forms private, accessible only for some users or users' roles, and not public for everyone. Or situations where you want the users can access to their submitted information, or modify it. The "Users Permissions" add-on, distributed with the Developer and Platinum versions of the plugin, has the answer.
There are many situations where it is required to keep a form private, allowing the access only for some users. For example, you are developing a website for a Gym, and you need the users can enter their progresses, so, you need that only the logged users can access and populate the form, furthermore, you need they can check the information submitted previously. Summarizing, you need restrict the access to the forms, and to allow the access to the submissions.
To activate the "Users Permissions" add-on, you should go to the settings page of the plugin (through the menu option "Settings > Calculated Fields Form"), tick the "CFF - Users Permissions" checkbox, and then, press the "Activate/Deactivate addons" button:
Once the add-on is enabled, would appear a new section in the forms' settings to set the permissions.
The number of attributes can be scary, but they are very simple.
To restrict the access to the form only for registered users tick the "Registered users only" option in the form's settings. The "Anonymous users" option allows the access to both, the registered and anonymous users.
If you want a form can be submitted only once per user, tick the checkbox: "The form can be submitted only once per user". However, this restriction does not affect to users with administrator role. An administrator can submit the form as many times he want, however, the users with other roles can submit the form only once.
The add-on allows to restrict the access to the form by roles, or for specific users. There are two lists in the settings for selecting them: one list with the website's roles, and another list with the users. Returning to the initial example, the gym website, if there is a role called "athlete", and you want that only the athletes can enter their progresses, select the "athlete" role from the roles list.
The "Users Permissions add-on" allows to define other permissions, like the actions the users can take on their submissions. In particular, there are two actions: "Edit" and "Delete". If the users are granted editing permissions, in the submissions list would included an "Edit" link per row, and clicking on them the form would be loaded into a pop-up window with the information submitted previously. In a similar way, if the users can delete their submissions, would be included a "Delete" link per row.
Note: Actually, only the administrators can delete the submissions, the previous delete link will only set the submission in an inactive status.
The "Messages" section allows to define two error messages:
The text to display when an user tries to access the form, but he does not have sufficient privileges.
The text to display if the form has been configured to be submitted only once per user, and the current user has submitted the form previously.
In both cases the plugin will load the messages instead the forms.
The last attribute in the add-on settings is the "Summary". Through this attribute it is possible to define the way you want the submissions look. The summary attribute allows to combine HTML and fields tags, similar to the notification emails or thank you pages, to format the appearance of submissions. More information about the fields' tags visiting the following link:
The "Users Permissions" add-on includes a new shortcode:
This shortcode would be replaced with the list of submissions belonging to the registered user, you simply should insert it into the content of a page accessible by the users, and nothing more.
The list would include all submissions belonging to the registered user, no matter the form submitted. But if you want to include only the submissions belonging to the user but for a specific form, it is possible to include the "form" attribute in the shortcode with the form's id, as follows:
This section responds to a recurring question. Many times the users send me the following request:
I want that every time an user visit the page with the form, it be pre-filled with the information submitted previously by the user, or with the default values, if it is the first time the user access the form.
And YES, it is possible to achieve this behavior, but requires a specific combination in the add-on settings:
You must tick the checkbox that limits the form to be submitted only once per user.
And then, assign to the users the editing permissions.
and voilà!!! the magic is done.