__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
/**
* @package DPCalendar
* @copyright Copyright (C) 2020 Digital Peak GmbH. <https://www.digital-peak.com>
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
*/
namespace DigitalPeak\Component\DPCalendar\Administrator\Booking\Stages;
defined('_JEXEC') or die();
use Joomla\CMS\Application\CMSApplicationInterface;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Form\Form;
use Joomla\CMS\User\UserHelper;
use Joomla\Component\Users\Site\Model\RegistrationModel;
use Joomla\Database\DatabaseInterface;
use League\Pipeline\StageInterface;
class CreateUser implements StageInterface
{
public function __construct(
private readonly CMSApplicationInterface $application,
private readonly DatabaseInterface $db,
private readonly RegistrationModel $model
) {
}
public function __invoke($payload)
{
$data = [];
// Do not create when state is not active and previous state was active as well
if ($payload->item->state != 1 || ($payload->oldItem && $payload->oldItem->state == 1)) {
return $payload;
}
// Only create the user when respective setting is set and user_id is not set
if (ComponentHelper::getParams('com_dpcalendar')->get('booking_registration', 1) != 2 || $payload->data['user_id']) {
return $payload;
}
// Check if there is a user with the email already
$query = $this->db->getQuery(true)
->select('id')->from('#__users')
->where('email = ' . $this->db->quote($payload->data['email']));
$this->db->setQuery($query, 0, 1);
if ($this->db->loadResult()) {
return $payload;
}
$this->application->getLanguage()->load('com_users', JPATH_SITE);
Form::addFormPath(JPATH_SITE . '/components/com_users/forms');
$data['name'] = $payload->data['name'];
$data['email1'] = $payload->data['email'];
$data['username'] = $payload->data['email'];
$data['password1'] = UserHelper::genRandomPassword();
$data['requireReset'] = 1;
if (!$this->model->register($data)) {
$this->application->enqueueMessage($this->model->getError(), 'warning');
}
$this->db->setQuery($query, 0, 1);
$payload->item->user_id = $this->db->loadResult();
return $payload;
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| AdjustCustomFields.php | File | 1023 B | 0664 |
|
| AssignUserGroups.php | File | 1.15 KB | 0664 |
|
| CollectEventsAndTickets.php | File | 2.68 KB | 0664 |
|
| CreateOrUpdateTickets.php | File | 3.7 KB | 0664 |
|
| CreateUser.php | File | 2.13 KB | 0664 |
|
| FetchLocationData.php | File | 1.41 KB | 0664 |
|
| SendInviteMail.php | File | 2.45 KB | 0664 |
|
| SendNewBookingMail.php | File | 4.67 KB | 0664 |
|
| SendNotificationMail.php | File | 3.33 KB | 0664 |
|
| SendPaidBookingMail.php | File | 3.31 KB | 0664 |
|
| SendWaitingListMail.php | File | 3.03 KB | 0664 |
|
| SetupForMail.php | File | 3.17 KB | 0664 |
|
| SetupForNew.php | File | 11.61 KB | 0664 |
|
| SetupForUpdate.php | File | 1.82 KB | 0664 |
|
| SetupLanguage.php | File | 1.45 KB | 0664 |
|