add notify emails
This commit is contained in:
113
_ajax/send_notify.php
Normal file
113
_ajax/send_notify.php
Normal file
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
//ini_set('include_path', '../_class/');
|
||||
|
||||
include '../_class/class_user_parent.php';
|
||||
foreach (glob("../_class/*.php") as $filename) {
|
||||
//echo $filename;
|
||||
$skip = array(
|
||||
'../_class/class_user_parent.php',
|
||||
'../_class/class_Exception.php',
|
||||
);
|
||||
if (in_array($filename, $skip))
|
||||
continue;
|
||||
|
||||
include $filename;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
foreach ($_POST as $key => $value) {
|
||||
trigger_error($_SERVER['HTTP_HOST'], E_USER_NOTICE);
|
||||
}
|
||||
*/
|
||||
include('../_include/include_db_conn.php');
|
||||
|
||||
if (empty($_POST['uk_id'])) {
|
||||
echo json_encode(null);
|
||||
} else {
|
||||
$toNotify = new user_kid();
|
||||
$toNotify->set_user_data_by_id($_POST['uk_id']);
|
||||
|
||||
if (null === $toNotify->get_uk_parent_1()->get_up_email() || null === $toNotify->get_uk_parent_1()->get_up_name()) {
|
||||
echo json_encode('missing-data');
|
||||
} else {
|
||||
$email_template_id = $sql->single_variable('select et_id from email_template where et_name = \'below_zero\'');
|
||||
if (null !== $email_template_id) {
|
||||
$emailTemplate = new email_template();
|
||||
$emailTemplate->set_et_data_by_id($email_template_id);
|
||||
|
||||
$raw_subject = $emailTemplate->get_et_subject();
|
||||
$raw_message = $emailTemplate->get_et_message();
|
||||
//var_dump($toNotify_array);
|
||||
//foreach ($toNotify_array as $toNotify) {
|
||||
$personalizedSubject = $emailTemplate->personalize($raw_subject, array(
|
||||
'uk_name' => $toNotify->get_uk_name(),
|
||||
));
|
||||
|
||||
$personalizedMessage = $emailTemplate->personalize($raw_message, array(
|
||||
'notify_name' => $toNotify->get_uk_parent_1()->get_up_name(),
|
||||
'uk_name' => $toNotify->get_uk_name(),
|
||||
));
|
||||
|
||||
$mail = new PHPMailer(true); // Passing `true` enables exceptions
|
||||
try {
|
||||
//Server settings
|
||||
$mail->SMTPDebug = 4; // Enable verbose debug output
|
||||
$mail->isSMTP(); // Set mailer to use SMTP
|
||||
$mail->CharSet = PHPMailer::CHARSET_UTF8; // UTF-8
|
||||
$mail->Host = 'mail.livingsport.hu'; // Specify main and backup SMTP servers
|
||||
$mail->SMTPAuth = true; // Enable SMTP authentication
|
||||
$mail->Username = 'notify@livingsport.hu'; // SMTP username
|
||||
$mail->Password = 'dpDiKSqU0V'; // SMTP password
|
||||
$mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
|
||||
$mail->Port = 465;
|
||||
|
||||
//Recipients
|
||||
$mail->setFrom($emailTemplate->get_et_from_email(), $emailTemplate->get_et_from_name());
|
||||
// $mail->addAddress($toNotify->get_uk_parent_1()->get_up_email(), $toNotify->get_uk_parent_1()->get_up_name());
|
||||
$mail->addAddress('tricsusz@gmail.com', 'Tóth Richárd'); // TEST
|
||||
|
||||
|
||||
//Content
|
||||
$mail->isHTML(true); // Set email format to HTML
|
||||
$mail->Subject = $personalizedSubject;
|
||||
$mail->Body = $personalizedMessage;
|
||||
$mail->AltBody = 'Az Ön levelezője nem támogatja a HTML tartalom megjelenítését!';
|
||||
|
||||
//send mail
|
||||
$mail->send();
|
||||
//LOG SUCCESS
|
||||
email_log::create_email_log(
|
||||
$personalizedMessage,
|
||||
$personalizedSubject,
|
||||
$toNotify->get_uk_parent_1()->get_up_name(),
|
||||
$toNotify->get_uk_parent_1()->get_up_email(),
|
||||
$emailTemplate->get_et_id()
|
||||
);
|
||||
|
||||
//Update kids last noti date
|
||||
$sql->update_table('user_kid', array('uk_last_notification' => date('Y-m-d H:i:s')), array('uk_id' => $toNotify->get_uk_id()));
|
||||
|
||||
echo json_encode('success');
|
||||
|
||||
} catch (Exception $e) {
|
||||
//LOG ERROR
|
||||
email_log::create_email_log(
|
||||
$personalizedMessage,
|
||||
$personalizedSubject,
|
||||
$toNotify->get_uk_parent_1()->get_up_name(),
|
||||
$toNotify->get_uk_parent_1()->get_up_email(),
|
||||
$emailTemplate->get_et_id(),
|
||||
mysql_escape_string($e)
|
||||
);
|
||||
|
||||
echo json_encode(null);
|
||||
}
|
||||
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
212
_class/class_email_log.php
Normal file
212
_class/class_email_log.php
Normal file
@@ -0,0 +1,212 @@
|
||||
<?php
|
||||
|
||||
class email_log
|
||||
{
|
||||
private $el_id;
|
||||
private $el_message;
|
||||
private $el_subject;
|
||||
private $el_to_name;
|
||||
private $el_to_email;
|
||||
private $el_sent_date;
|
||||
private $el_exception;
|
||||
private $el_email_template_et_id;
|
||||
|
||||
public function set_el_data_by_id($_id)
|
||||
{
|
||||
global $sql;
|
||||
$el_data_assoc_array = $sql->assoc_array("select * from email_log where el_id = " . $_id);
|
||||
$el_data_array = $el_data_assoc_array[0];
|
||||
foreach ($el_data_array as $field => $value) {
|
||||
$function_name = "set_" . $field;
|
||||
$this->$function_name($value);
|
||||
if ('el_email_template_et_id' == $field) {
|
||||
$new_et = new email_template();
|
||||
$new_et->set_et_data_by_id($value);
|
||||
$this->set_el_email_template_et_id($new_et);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function create_email_log($_message, $_subject, $_name, $_email, $_et, $_exc = 'null', $_date = null)
|
||||
{
|
||||
global $sql;
|
||||
|
||||
if (null === $_date) {
|
||||
$_date = date('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
return $sql->insert_into('email_log', array(
|
||||
'el_message' => $_message,
|
||||
'el_subject' => $_subject,
|
||||
'el_to_name' => $_name,
|
||||
'el_to_email' => $_email,
|
||||
'el_email_template_et_id' => $_et,
|
||||
'el_exception' => $_exc,
|
||||
'el_sent_date' => $_date
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_el_id()
|
||||
{
|
||||
return $this->el_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $el_id
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function set_el_id($el_id)
|
||||
{
|
||||
$this->el_id = $el_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_el_message()
|
||||
{
|
||||
return $this->el_message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $el_message
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function set_el_message($el_message)
|
||||
{
|
||||
$this->el_message = $el_message;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_el_subject()
|
||||
{
|
||||
return $this->el_subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $el_subject
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function set_el_subject($el_subject)
|
||||
{
|
||||
$this->el_subject = $el_subject;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_el_to_name()
|
||||
{
|
||||
return $this->el_to_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $el_to_name
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function set_el_to_name($el_to_name)
|
||||
{
|
||||
$this->el_to_name = $el_to_name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_el_to_email()
|
||||
{
|
||||
return $this->el_to_email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $el_to_email
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function set_el_to_email($el_to_email)
|
||||
{
|
||||
$this->el_to_email = $el_to_email;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_el_sent_date()
|
||||
{
|
||||
return $this->el_sent_date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $el_sent_date
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function set_el_sent_date($el_sent_date)
|
||||
{
|
||||
$this->el_sent_date = $el_sent_date;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_el_exception()
|
||||
{
|
||||
return $this->el_exception;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $el_exception
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function set_el_exception($el_exception)
|
||||
{
|
||||
$this->el_exception = $el_exception;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_el_email_template_et_id()
|
||||
{
|
||||
return $this->el_email_template_et_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $el_email_template_et_id
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function set_el_email_template_et_id($el_email_template_et_id)
|
||||
{
|
||||
$this->el_email_template_et_id = $el_email_template_et_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -128,6 +128,11 @@ class user_kid extends user_parent {
|
||||
public function get_uk_shirt_size() {
|
||||
return $this->user_shirt_size;
|
||||
}
|
||||
|
||||
public function get_uk_is_active() {
|
||||
return $this->user_is_active;
|
||||
}
|
||||
|
||||
public function get_uk_shirt_size_name() {
|
||||
global $sql;
|
||||
if ($this->user_shirt_size) return $sql->single_variable("select shirt_name from shirt where shirt_id = " . $this->user_shirt_size);
|
||||
@@ -375,6 +380,11 @@ class user_kid extends user_parent {
|
||||
$city->set_school_city_data_by_id($value);
|
||||
$this->set_uk_address($city);
|
||||
}
|
||||
if ($field == 'uk_parent_1' && !empty($value)) {
|
||||
$parent = new user_parent();
|
||||
$parent->set_user_data_by_id($value);
|
||||
$this->set_uk_parent_1($parent);
|
||||
}
|
||||
//$this->set_ua_type(2); //kid típus beállítása
|
||||
}
|
||||
$this->set_login(true);
|
||||
|
||||
@@ -759,6 +759,10 @@ form#auto_filters > div > label {
|
||||
background-color: cadetblue;
|
||||
}
|
||||
|
||||
.notification-text.disabled {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.notification-text.in-progress {
|
||||
background-color: #f5ea16;
|
||||
}
|
||||
|
||||
17
_include/include_email.php
Normal file
17
_include/include_email.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
if ($this->is_id()) {
|
||||
|
||||
# EMAIL LOG RÉSZLETEK
|
||||
|
||||
$email_log = new email_log();
|
||||
$email_log->set_el_data_by_id($this->get_id());
|
||||
|
||||
$smarty->assign('email', $email_log);
|
||||
$smarty->display('email.tpl');
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
37
_include/include_emails.php
Normal file
37
_include/include_emails.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
if ($this->is_id()) {
|
||||
|
||||
# EMAIL LISTA (50 / oldal)
|
||||
|
||||
$all_emails_query = "SELECT count(DISTINCT el_id) FROM email_log";
|
||||
$emails_query = "SELECT * FROM email_log ORDER BY el_sent_date DESC LIMIT " . ($this->is_id() ? ($this->get_id() - 1) * 50 : "0") . ",50";
|
||||
$el_assoc_array = $sql->assoc_array($emails_query);
|
||||
$el_count = $sql->single_variable($all_emails_query);
|
||||
$next_link = true;
|
||||
|
||||
$el_array = array();
|
||||
foreach ($el_assoc_array as $key => $el) {
|
||||
$new_el = new email_log();
|
||||
$new_el->set_el_data_by_id($el['el_id']);
|
||||
$el_array[] = $new_el;
|
||||
}
|
||||
|
||||
$fold = $el_count > 50;
|
||||
|
||||
if ($el_count <= $this->get_id() * 50) {
|
||||
$next_link = false;
|
||||
}
|
||||
|
||||
$smarty->assign('el_array', $el_array);
|
||||
$smarty->assign('fold', $fold);
|
||||
$smarty->assign('next_id', $next_link ? $this->get_id() + 1 : false);
|
||||
$smarty->assign('previous_id', ($this->get_id() > 1 ? $this->get_id() - 1 : false));
|
||||
|
||||
$smarty->display('emails.tpl');
|
||||
} else {
|
||||
header("Location: /admin/emails/1");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
7
queries/20250525_email_logs.sql
Normal file
7
queries/20250525_email_logs.sql
Normal file
@@ -0,0 +1,7 @@
|
||||
INSERT INTO `setting` (`set_id`, `set_name`, `set_setting_type_st_id`) VALUES (NULL, 'Email küldés log', '3');
|
||||
|
||||
INSERT INTO `setting_value` (`setv_id`, `setv_set_date`, `setv_setting_set_id`, `setv_int`, `setv_varchar`, `setv_text`, `setv_date`) VALUES (NULL, '2025-05-24 15:18:09.000000', '6', NULL, 'emails', NULL, NULL);
|
||||
|
||||
CREATE TABLE `email_log` ( `el_id` int(11) NOT NULL, `el_email_template_et_id` int(11) NOT NULL, `el_to_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_hungarian_ci DEFAULT NULL, `el_to_email` varchar(255) CHARACTER SET utf8 COLLATE utf8_hungarian_ci DEFAULT NULL, `el_subject` varchar(255) CHARACTER SET utf8 COLLATE utf8_hungarian_ci DEFAULT NULL, `el_message` text CHARACTER SET utf8 COLLATE utf8_hungarian_ci, `el_sent_date` datetime DEFAULT NULL, `el_exception` text CHARACTER SET utf8 COLLATE utf8_hungarian_ci ) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
|
||||
INSERT INTO `email_template` (`et_id`, `et_name`, `et_title`, `et_deleted`, `et_message`, `et_subject`, `et_from_name`, `et_from_email`) VALUES (NULL, 'below_zero', 'Értesítés negatív egyenlegről', '0', 'Kedves {$notify_name}!<br>\r\n<br>\r\nNyilvántartásunk szerint {$uk_name} tollaslabda edzésdíj egyenlege 0 Ft alá csökkent.<br>\r\n<br>\r\nLiving Sport<br>\r\n<br>\r\nui.: Ez egy automatikusan generált üzenet, amelyre nem várunk választ.', 'Értesítés negatív egyenlegről', 'Living Sport', 'notify@livingsport.hu');
|
||||
37
template/templates/email.tpl
Normal file
37
template/templates/email.tpl
Normal file
@@ -0,0 +1,37 @@
|
||||
<div class="list">
|
||||
<div class="list_item">
|
||||
<label class="desc" id="title1" for="tr_duration">
|
||||
Címzett:
|
||||
</label>
|
||||
<div>{$email->get_el_to_name()}<br><{$email->get_el_to_email()}></div>
|
||||
</div>
|
||||
<div class="list_item">
|
||||
<label class="desc" id="title1" for="tr_duration">
|
||||
Tárgy:
|
||||
</label>
|
||||
<div>{$email->get_el_subject()}</div>
|
||||
</div>
|
||||
<div class="list_item">
|
||||
<label class="desc" id="title1" for="tr_duration">
|
||||
Kiküldés dátuma:
|
||||
</label>
|
||||
<div>{$email->get_el_sent_date()}</div>
|
||||
</div>
|
||||
<div class="list_item">
|
||||
<label class="desc" id="title1" for="tr_duration">
|
||||
Üzenet:
|
||||
</label>
|
||||
<div>{$email->get_el_message()}</div>
|
||||
</div>
|
||||
|
||||
{if $email->get_el_exception()}
|
||||
<div class="list_item">
|
||||
<label class="desc" id="title1" for="tr_duration">
|
||||
Üzenet:
|
||||
</label>
|
||||
<div>{$email->get_el_exception()}</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
||||
</div>
|
||||
75
template/templates/emails.tpl
Normal file
75
template/templates/emails.tpl
Normal file
@@ -0,0 +1,75 @@
|
||||
{if $fold}
|
||||
|
||||
<div class="navigator">
|
||||
<div class="previous">
|
||||
{if $previous_id}
|
||||
<a href="/admin/emails/{$previous_id}">
|
||||
{/if}
|
||||
<img src="/_image/previous.png" {if !$previous_id}class="grayscale" {/if}>
|
||||
{if $previous_id}
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="next">
|
||||
{if $next_id}
|
||||
<a href="/admin/emails/{$next_id}">
|
||||
{/if}
|
||||
<img src="/_image/previous.png" {if !$next_id}class="grayscale" {/if}>
|
||||
{if $next_id}
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/if}
|
||||
|
||||
<div style="overflow-x:auto;">
|
||||
<table class="email log">
|
||||
<tr>
|
||||
<th class="left">#ID</th>
|
||||
<th class="left">Címzett</th>
|
||||
<th class="left">Kiküldés dátuma</th>
|
||||
<th class="left">Tárgy</th>
|
||||
<th class="left">Üzenet</th>
|
||||
<th class="left">Hibaüzenet</th>
|
||||
</tr>
|
||||
{foreach $el_array as $log}
|
||||
<tr class="email-log{if $log->get_el_exception()} delete{else} tick{/if}" data-log-id="{$log->get_el_id()}">
|
||||
<td>#{$log->get_el_id()}</td>
|
||||
<td>{$log->get_el_to_name()}<br><{$log->get_el_to_email()}></td>
|
||||
<td>{$log->get_el_sent_date()}</td>
|
||||
<td>{$log->get_el_subject()}</td>
|
||||
<td>{$log->get_el_message()|truncate:50}</td>
|
||||
<td>{$log->get_el_exception()|truncate:50}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="navigator">
|
||||
<div class="previous">
|
||||
{if $previous_id}
|
||||
<a href="/admin/emails/{$previous_id}">
|
||||
{/if}
|
||||
<img src="/_image/previous.png" {if !$previous_id}class="grayscale" {/if}>
|
||||
{if $previous_id}
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="next">
|
||||
{if $next_id}
|
||||
<a href="/admin/emails/{$next_id}">
|
||||
{/if}
|
||||
<img src="/_image/previous.png" {if !$next_id}class="grayscale" {/if}>
|
||||
{if $next_id}
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('table.email.log tr.email-log').click(function() {
|
||||
window.location.href = '/admin/email/' + $(this).data('log-id');
|
||||
});
|
||||
</script>
|
||||
@@ -7,14 +7,67 @@
|
||||
|
||||
</div>
|
||||
|
||||
<input type="hidden" id="dev" value="{$dev}">
|
||||
|
||||
<div class="list half_width">
|
||||
{foreach $user_kids as $user}
|
||||
<a href="#" id="kid_{$user->get_uk_id()}">
|
||||
<div class="list_item">
|
||||
<a href="/preview/diary/{$user->get_uk_id()}" target="_blank" id="kid_{$user->get_uk_id()}">
|
||||
<div class="list_item{if !$user->get_uk_is_active()} passive{/if}">
|
||||
<img src="/_image/shuttlecock.png">
|
||||
{$user->get_uk_name()}
|
||||
{if $user->get_uk_last_notification() && $page_id >= 2}
|
||||
<span style="font-size: 14px; font-weight: normal; font-style: italic;">({$user->get_uk_last_notification()})</span>
|
||||
{/if}
|
||||
{if $user->get_uk_balance() < 0 && $page_id >= 2}
|
||||
{if $user->get_uk_parent_1() == null}
|
||||
<span class="float_right notification-text disabled">Értesítő e-mail</span>
|
||||
{else}
|
||||
<span class="float_right notification-text" id="{$user->get_uk_id()}" >Értesítő e-mail</span>
|
||||
{/if}
|
||||
{/if}
|
||||
<span class="float_right">{$user->get_uk_balance()|number_format:0:'':' '} Ft</span>
|
||||
</div>
|
||||
</a>
|
||||
{/foreach}
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var clickFunction = function(event) {
|
||||
if ($('#dev').val() > 0) {
|
||||
return false;
|
||||
}
|
||||
event.preventDefault();
|
||||
$(event.target).off('click', clickFunction)
|
||||
$(event.target).addClass('in-progress');
|
||||
$(event.target).html('Küldés folyamatban...');
|
||||
|
||||
$.post("/_ajax/send_notify.php",
|
||||
{
|
||||
uk_id: event.target.id,
|
||||
},
|
||||
function(data, status){
|
||||
var pdata = JSON.parse(data);
|
||||
|
||||
if (null == pdata) {
|
||||
//error
|
||||
$(event.target).removeClass('in-progress');
|
||||
$(event.target).addClass('fail');
|
||||
$(event.target).html('Küldés sikertelen');
|
||||
}
|
||||
else if ('missing-data' == pdata) {
|
||||
$(event.target).removeClass('in-progress');
|
||||
$(event.target).addClass('fail');
|
||||
$(event.target).html('Hiányzó adatok!');
|
||||
}
|
||||
else {
|
||||
$(event.target).removeClass('in-progress');
|
||||
$(event.target).addClass('success');
|
||||
$(event.target).html('Kiküldve');
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
$('.notification-text:not(.disabled)').on('click', clickFunction);
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user