id user = number

agostino87 05 Oct, 2016
Hi, i have a "custom code" to find the user id, the code is

<?php
$user = JFactory::getUser();
$form->data['codiceca'] = $user->id;
?>


Now I want to display in a textbox an associated number. the numbers and accounts to be associated are 30.

example
id = 650 numer 4000
id = 651 numer 4050

any suggestions ? thanks
GreyHead 05 Oct, 2016
Hi agostino87,

Something like this?
<?php
$juser = \JFactory::getUser();
$id = $juser->id;
$form->data['codiceca'] = $id * 30;
?>

Bob
agostino87 05 Oct, 2016
thanks greyhead,

not exactly, this code multiplies by 30 the user id
I rather want to associate with the number id a fixed number
then the code is

<?php
$juser = \JFactory::getUser();
$id = $juser->id;
$form->data['codiceca'] = $id = 30;
?>


But I want to add 30 combinations
example
id = 4000 number 50
id = 4350 number 51

I do not know how to put the condition if user id is 4000 enter the numer 50, if user id is 4350 then enter 51, etc ...
GreyHead 05 Oct, 2016
Hi agostino87,

Then you have to look up the information from somewhere - typically a database table, though you could also use a data array in an Custom Event. You could include that from a file if that helps.

Bob
This topic is locked and no more replies can be posted.