Script URL:
Version of script:
Hosting company:
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:
Write your message below:
Hi,
first of all I would like to thank you for the work you do.
I would need the user to enter their first and last name when submitting a ticket, in previous versions I solved this using code, see link below.
viewtopic.php?f=13&t=6977&p=29010&hilit ... ame#p29010
But in the new version 3.5.1, it will obviously need to be edited elsewhere
Thanks
Require first and last name
Moderator: mkoch227
Re: Require first and last name
It's a bit more complicated because customer accounts have been introduced.
Do you plan on using customer accounts or keeping them disabled?
Do you plan on using customer accounts or keeping them disabled?
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
-
- Posts: 33
- Joined: Thu Dec 02, 2021 1:05 pm
Re: Require first and last name
Hi, we would like to use customer accounts.
Re: Require first and last name
You will need to force full names at registration time then.
In register.php, just below add
(similar, but not same code as before)
In register.php, just below
Code: Select all
$name = hesk_input(hesk_POST('name'));
Code: Select all
if ( ! strpos($name, ' ')) {
$hesk_error_buffer['name'] = 'Please enter your full name';
}
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Re: Require first and last name
And can I use the following code after the line?
Or would this be a more accurate option?
P.S. That's it, my second option actually gave me the ability to restrict registration without using my conditions.
Code: Select all
$name = hesk_input(hesk_POST('name'));
Code: Select all
function space_word_count($str)
{
return count(preg_split('/\s+/', $str));
}
if ( ! strpos($tmpvar['name'], ' ')) {
$hesk_error_buffer['name'] = $hesklang['enter_your_full_name'];
}
else
if (space_word_count($tmpvar['name'])<3) {
$hesk_error_buffer['name'] = $hesklang['enter_your_full_name'];
}
else
if ( ! strpos($tmpvar['name'], '.') !==true) {
$hesk_error_buffer['name'] = $hesklang['enter_your_full_name'];
}
Code: Select all
function space_word_count($str)
{
return count(preg_split('/\s+/', $str));
}
if (strpos($name, ' ') === false || space_word_count($name) < 3 || strpos($name, '.') !== false) {
$hesk_error_buffer['name'] = $hesklang['enter_your_full_name']; // $hesklang['enter_your_full_name'] it is necessary to add to your translation text file so that the message is displayed
}
P.S. That's it, my second option actually gave me the ability to restrict registration without using my conditions.
Re: Require first and last name
Depending on how much you wish to complicate your customer's life 
Use whatever works for you. It can be as simple as checking that there is an empty space in the name, or as complex as verifying the number of words, their length, composition, ...

Use whatever works for you. It can be as simple as checking that there is an empty space in the name, or as complex as verifying the number of words, their length, composition, ...
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools