This command was a huge help thank you!! :D
You are welcome!
This command was a huge help thank you!! :D
You are welcome!
I have gone a little further but it seems that I'm stuck again somewhere.
Because I am going to have some users in database like this:
example1@example.com
example2@example.com
example3@example.com etc
I ask for my user to type his email, let's say it's example@example.com and I find the 3 records above. I have already managed to make an array with all these "similar" email addresses.
Is there any way to show some details to my user for these 3 emails?
Like a radiobox that gives my customer the ability to choose one user profile and continue to the site as this user.
A full example of this:
My user types "example@example.com", hits continue button, I search for how many alike email addresses exist and I show them to him and wait to pick one. Then, I ask for password and login the user as the one that he finally picked, let's say as the user with the email address "example2@example.com
Thanks!
I have gone a little further but it seems that I'm stuck again somewhere.
Because I am going to have some users in database like this:
example1@example.com
example2@example.com
example3@example.com etc
I ask for my user to type his email, let's say it's example@example.com and I find the 3 records above. I have already managed to make an array with all these "similar" email addresses.
Is there any way to show some details to my user for these 3 emails?
Like a radiobox that gives my customer the ability to choose one user profile and continue to the site as this user.
A full example of this:
My user types "example@example.com", hits continue button, I search for how many alike email addresses exist and I show them to him and wait to pick one. Then, I ask for password and login the user as the one that he finally picked, let's say as the user with the email address "example2@example.com
Thanks!
You can use such selectbox to show e-mails:
- {__("select_email")} - {foreach from=$emails item="email" key="id"} {$email} {/foreach}
Why on earth would you want anything but an exact match on email addresses?
Are you going to display everyone's gmail address for anyone who uses gmail to choose from?
I strongly recommend you review your privacy and security needs as it relates to customers. If I enter tonyb@gmail.com as my email address and I see tonyb2003@gmail.com and tonybk@gmail.com I'm going to be out of there in a nanosecond. You simply can't display other similar addresses for someone to choose from. It's a huge privacy and security issue.
You can use such selectbox to show e-mails:
- {__("select_email")} - {foreach from=$emails item="email" key="id"} {$email} {/foreach}
Thanks!
A select box appears when the my_changes.my_emails dispatch is called but can you explain me how to populate the box with options?
Why on earth would you want anything but an exact match on email addresses?
Are you going to display everyone's gmail address for anyone who uses gmail to choose from?
I strongly recommend you review your privacy and security needs as it relates to customers. If I enter tonyb@gmail.com as my email address and I see tonyb2003@gmail.com and tonybk@gmail.com I'm going to be out of there in a nanosecond. You simply can't display other similar addresses for someone to choose from. It's a huge privacy and security issue.
I understand what you are talking about and that's something I will change the way I do it.
Thanks!
A select box appears when the my_changes.my_emails dispatch is called but can you explain me how to populate the box with options?
You need to assign the $emails variable to the template. It should have such structure:
$emails = array( '0' => "user1@example.com", '1' => "user2@example.com", '2' => "user3@example.com" )
You need to assign the $emails variable to the template. It should have such structure:
$emails = array( '0' => "user1@example.com", '1' => "user2@example.com", '2' => "user3@example.com" )
Everything is cool if I hardcode the choices inside the tpl file that shows the form.
But, what if I want to pass some data from the database into the selectbox as choices?
I have to create a new mode into my_changes.php file or another file?
Everything is cool if I hardcode the choices inside the tpl file that shows the form.
But, what if I want to pass some data from the database into the selectbox as choices?
I have to create a new mode into my_changes.php file or another file?
Yes, you need to create a new mode, form the e-mails array and assign it to the new template.
Tygh::$app['view']->assign('emails', $emails);
Yes, you need to create a new mode, form the e-mails array and assign it to the new template.
Tygh::$app['view']->assign('emails', $emails);
I create a mode called my_users but for some reason my head is stuck.
When users types in email and this mail exists many times on db, I show him the select box. Where should I create the array? In the my_users mode or before and pass it through session??
This is the array:
$emails = db_get_array("SELECT email FROM ?:users WHERE fmail = '$fmail'");
I create a mode called my_users but for some reason my head is stuck.
When users types in email and this mail exists many times on db, I show him the select box. Where should I create the array? In the my_users mode or before and pass it through session??
This is the array:
$emails = db_get_array("SELECT email FROM ?:users WHERE fmail = '$fmail'");
In the my_users mode. Please, show me the $emails array you get.
Array ( [0] => Array ( [email] => test@test.com ) [1] => Array ( [email] => email@email.com ) )
Array ( [0] => Array ( [email] => test@test.com )[1] => Array ( [email] => email@email.com )
)
It is better to use db_get_fields function:
$emails = db_get_fields("SELECT email FROM ?:users WHERE email = ?s", $email);
It is better to use db_get_fields function:
$emails = db_get_fields("SELECT email FROM ?:users WHERE email = ?s", $email);
db_get_felds reuturns only one record, not the two of them that exists. :/
$emails = db_get_fields("SELECT email FROM ?:users WHERE email = ?s", $fmail); fn_print_die($emails);
I get this:
Array ( [0] => test@test.com )
db_get_felds reuturns only one record, not the two of them that exists. :/
$emails = db_get_fields("SELECT email FROM ?:users WHERE email = ?s", $fmail); fn_print_die($emails);I get this:
Array ( [0] => test@test.com )
Yes, because there can be only one user with such e-mail. Try to use LIKE instead of '='.
Yes, because there can be only one user with such e-mail. Try to use LIKE instead of '='.
I fixed it. I change the SELECT command to my needs, I forgot that.
Thanks!
I managed to show the info I want in a radiobox, because the selectbox is not what I needed but I have this problem now.
As I said, the
$emails = db_get_fields("SELECT email FROM ?:users WHERE fmail = ?s", $fmail);
returns to me 2 records which means for me that there are Two users.
I show them to radiobox, BUT: even though the radiobox shows 2 cells, I have the info from both users in every cell.
My form is this:
{foreach from=$emails item=“email” key=“id”}
{/foreach}
{foreach from=$emails item=“email” key=“id”} |
{include file=“buttons/button.tpl” but_text=__(“choose”) but_name=“dispatch[my_changes.my_pass]” but_role=“select” but_meta=“ty-btn__primary”}
{capture name="mainbox_title"}{__("choose_user")}{/capture}Any ideas?
I managed to show the info I want in a radiobox, because the selectbox is not what I needed but I have this problem now.
As I said, the
$emails = db_get_fields("SELECT email FROM ?:users WHERE fmail = ?s", $fmail);returns to me 2 records which means for me that there are Two users.
I show them to radiobox, BUT: even though the radiobox shows 2 cells, I have the info from both users in every cell.
My form is this:
{foreach from=$emails item=“email” key=“id”}
{/foreach}
{foreach from=$emails item=“email” key=“id”}
- {$firstname} {$lastname}
- {$afm}
- {$email}
- {$eidos_pelath}
- {$uid}
{/foreach}
{include file=“buttons/button.tpl” but_text=__(“choose”) but_name=“dispatch[my_changes.my_pass]” but_role=“select” but_meta=“ty-btn__primary”}
{capture name="mainbox_title"}{__("choose_user")}{/capture}Any ideas?
I found what was responsible for the duplicates. The
{foreach from=$emails item="email" key="id"}
inside the .