Added part of backend but problems with Joomla code compatibility found.

Somehow the password must be handled specially (also because of the hashing) which causes problems at the moment.
This commit is contained in:
2019-04-12 15:56:00 +02:00
parent 5c93c0b74c
commit cc9695b292
21 changed files with 643 additions and 10 deletions

View File

@@ -0,0 +1,41 @@
<?php
use Joomla\CMS\Factory;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Form\FormRule;
use Joomla\Registry\Registry;
// No direct access.
defined('_JEXEC') or die;
class JFormRuleClubUserName extends FormRule
{
public function test(\SimpleXMLElement $element, $value, $group = null, Registry $input = null, Form $form = null)
{
// Get the database object and a new query object.
$db = Factory::getDbo();
$query = $db->getQuery(true);
// Build the query.
$query->select('COUNT(*)')
->from('#__club_users')
->where('user = ' . $db->quote($value));
// Get the extra field check attribute.
$userId = $input->get('id');
$query->where($db->quoteName('id') . ' <> ' . (int) $userId);
// Set and query the database.
$db->setQuery($query);
$duplicate = (bool) $db->loadResult();
if ($duplicate)
{
return false;
}
return true;
}
}