About us:
We are a company who produces a guide for motorhome tourists, an follows a concept launched by France Passion, France. Our customers come from countries in Europe.
Site:
swedestops.nu
The planned use of WP and Toolset
We are going to have an application that can be used from PC, smartphone or tablet, but must be restricted to our customers.
What the customers get:
The customer receives a membership card with a code, distributed physically or by SMS.
Login routine:
By register/login the code, and if it is correct (already in our database) the customer will come to a registration form, where some information will be requested. Such as:
• First Name
• Last Name
• E-mail
• Phone
• Registration number of the motorhome
Tests performed:
We have tried to use a login form where only the code was asked for. However, doing so, any code can be entered to the system, as the were no codes in the system to be compared with.
Issue:
We would like to have the correct codes already registered in our system, so they can be compared with those entered by our customers . We are looking for a conditional function connected to the first form for registering the code.
Hi there,
Toolset works in the context of the Custom Post Types and Custom Fields.
Now what you want is not a built-in functionality in Toolset and it will need custom PHP coding which is outside of our support scope.
But I will give you the summary of what needs to be done:
- Create a form
- Use a Generic Input field to place a field in the form for the customer to add the code:
https://toolset.com/course-lesson/adding-generic-fields-to-forms/
- Now it is time to add a custom code to compare the entered code with the code in the database.
- Add the code in the functions.php file of your theme or in the custom code section of Toolset:
https://toolset.com/documentation/programmer-reference/adding-custom-code/using-toolset-to-add-custom-code/
- Use the Toolset forms API to add the code against the cred_form_validate hook:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_form_validate
- Check the example of the hook to know how to retrieve the content of the generic field in question inside the hook.
- Also, retrieve the data that you have in the database however you added in the database, if it is a custom field you can use the Toolset fields API:
https://toolset.com/documentation/customizing-sites-using-php/functions/
- Compare the value of the generic field and the data that you retrieved from the database. If they do not match return the error as the example shown in the validate hook.
If it is too complicated for you to implement you can consider hiring a developer for that here:
https://toolset.com/contractors/
Thanks.
Thanks for your guiding on how to solve the problem. Right now I have to wait som time to try finish the issue. Will be back later.