Page 1 of 1

CGFEURegister/FrontEndUsers insert serial number on creation

Posted: Sun Dec 13, 2020 9:12 pm
by webform
I'm building a membership website and new members can sign up on the website. Each new member should be assigned an unique membership number.

Is it somehow possible to insert an unique serial number in a FEU field on creation in frontend via CGFEURegister/FrontEndUsers like "Unique Integer Field" in FormBuilder?
Or maybe i have to create an UDT to fetch last Membership Number in FEU and +1 in a hidden field?

I know the practical thing would be to just use the FEU ID as membership number. But the ID isn't visible in FEU in backend, and membership administrators need to know and see the membership number for each member.

Re: CGFEURegister/FrontEndUsers insert serial number on creation

Posted: Sun Dec 13, 2020 9:51 pm
by Jo Morg
I'm assuming that you are using FEU 3.x, which I have never used, but the concept should be similar. I use a UDT on a hidden field in the registration form replacing the field where you want to insert the code, :

Code: Select all

$length = 10;
$string = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$ts = date("His");
$ds = date("Ymd");

$tk = '';
for ($i = 0; $i < $length; $i++)
{
  $index = rand(0, strlen($string) - 1);
  $tk .= $string[$index];
}

$code = 'FEU::' . $tk . '::' . $ds . '::' . $ts;

return $code;
That should return a unique code mainly because the date and time of the registration are part of the code, and should add to the entropy

Re: CGFEURegister/FrontEndUsers insert serial number on creation

Posted: Mon Dec 14, 2020 2:01 am
by webform
Cool! Thanks! ;D

Yes, it is FEU 3.x but i guess it should be similar. I'll play around with it and see if i can get it to work.

Re: CGFEURegister/FrontEndUsers insert serial number on creation

Posted: Fri Dec 18, 2020 4:18 pm
by velden
I know the practical thing would be to just use the FEU ID as membership number. But the ID isn't visible in FEU in backend, and membership administrators need to know and see the membership number for each member.
I do think the user's id is available in the admin template(s). So if they aren't displayed now, you could consider creating a custom admin template for the specific admin actions.
(e.g. templates\admin_userlist.tpl)

https://docs.cmsmadesimple.org/customiz ... -templates

Re: CGFEURegister/FrontEndUsers insert serial number on creation

Posted: Sat Jan 09, 2021 4:14 pm
by webform
Yes, you're right, Velden.

{$entry->id} was available in the admin_userlist.tpl template.