- Getting Started
- Field Types
- Email Notifications
-
Integrations
- MailerLite
- Create User Accounts with Convert Forms
- MailChimp
- HubSpot
- GetResponse
- AcyMailing
- Content App
- Webhooks Addon
- Facebook Meta Pixel
- Google Adwords
- Sync submissions with your favorite app
- Drip Ecommerce CRM
- Google Analytics
- Constant Contact
- SalesForce Web-to-Lead
- IContact
- Zoho CRM
- Elastic Email
- Zoho Campaigns
- Zapier
- ConvertKit
- Brevo (Sendinblue)
- Campaign Monitor
- AWeber
- ActiveCampaign
-
Functionality
- Scroll the Page to the Top When a Long Form is Submitted
- Display Submissions Count for a Specific Form
- Populate Drop Down, Radio Buttons or Checkboxes with a CSV File
- Automatically Delete Submissions Older Than X Days
- Silently POST Submitted Data to Any API or URL
- Automatically Save Each Submission to a JSON file
- Authenticate and Login a User with a Custom Joomla Form
- Auto-Populate a Form Field with an Article Data
- Add a placeholder text to a Dropdown
- Create Multilingual Forms in Joomla
- Create a custom Joomla User Registration Form
- Redirect User to a URL After Form Submission
- Export and Import Forms across different Websites
- Export Form Submissions to CSV
- Convert Forms
- Styling and Customization
- Payment Forms
- Advanced Features
- Developers
- Troubleshooting and Support
-
Spam, Security & Compliance
- Enforcing a Custom Password Policy in Convert Forms
- Add Cloudflare Turnstile to your Joomla Form
- Implement the Iubenda Consent Database in Joomla with Convert Forms
- Add Custom Validations to Fields and Forms
- Add Math Captcha to your Form
- Prevent a Field From Saving in the Database
- Add hCaptcha to your Form
- Enable Double Opt-in
- Allow Form Submissions in Specific Date Range
- Ensure a Unique Value is Entered Into a
- Block Form Submissions Containing Profanity (Bad Words)
- Block Email Addresses or Email Domains
- Native Convert Forms Anti-spam Protection with Honeypot
- Add reCAPTCHA to your Form
- Create GDPR Compliant Forms
Authenticate and Login a User with a Custom Joomla Form
Would you like to create your own Login form, authenticate your users and redirect them to a specific page? The following PHP snippet will allow you to easily create a login form.
Setup
To get started, your form needs some fields that can be found below:
Field Label | Field Type | Field Name |
---|---|---|
Username | Textbox | username |
Password | Password | password |
Then, copy the code shown below and place it into the PHP Scripts -> Form Process area of your form.
// The field representing the username
$username = $post['username'];
// The field representing the password
$password = $post['password'];
// The message that will appear when both fields are not filled
$fill_fields = 'Please enter a username and password';
// The message that will appear when a user does not exist given its username
$user_does_not_exist = 'User does not exist';
// The message that will appear when an invalid password is given.
$invalid_password = 'Invalid password';
// Message that appears when Joomla cannot validate the user
$login_failed = 'Login Failed';
// Do not edit below
if (empty($username) || empty($password))
{
throw new Exception($fill_fields);
}
$query = $db->getQuery(true)
->select('id, password')
->from('#__users')
->where('username=' . $db->quote($username));
$db->setQuery($query);
if (!$result = $db->loadObject())
{
throw new Exception($user_does_not_exist);
}
// Validate login credentials
if (JUserHelper::verifyPassword($password, $result->password, $result->id))
{
$credentials = [
'username' => $username,
'password' => $password
];
//perform log in
$response = $app->login($credentials);
if (!$response)
{
throw new Exception($login_failed);
}
}
else
{
throw new Exception($invalid_password);
}
Frequently Asked Questions
Passwords are visible in the submissions list, how do I ensure no passwords are stored on my site?
You should read here on preventing the submission from being stored on your site.
How can I redirect the user after they have successfully logged-in?
To redirect the user after they have successfully logged-in, you will need to go to Submission > Successful Submission Action > Redirect user > Redirect URL > Enter your redirect URL.
How can I display a Logout link once a user is logged-in?
Once a user is logged-in there is no point in still showing the login form so a replacement would be to display a Logout link instead. To do so go to Behavior > PHP Scripts > Form Display and add the following PHP snippet:
$user = JFactory::getUser();
if ($user->id) {
$userToken = JSession::getFormToken();
$formLayout = '<a href="' . JRoute::_('index.php?option=com_users&task=user.logout&' . $userToken . '=1') . '">Logout</a>';
}
This will display a link "Logout" which will allow your users to log out of your site. You may customize it to fit your needs.