CGFEURegister/FrontEndUsers insert serial number on creation Topic is solved

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
webform
Power Poster
Power Poster
Posts: 458
Joined: Sat Nov 25, 2006 3:39 pm
Location: Copenhagen, Denmark

CGFEURegister/FrontEndUsers insert serial number on creation

Post 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.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1922
Joined: Mon Jan 29, 2007 4:47 pm

Re: CGFEURegister/FrontEndUsers insert serial number on creation

Post 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
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
webform
Power Poster
Power Poster
Posts: 458
Joined: Sat Nov 25, 2006 3:39 pm
Location: Copenhagen, Denmark

Re: CGFEURegister/FrontEndUsers insert serial number on creation

Post 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.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: CGFEURegister/FrontEndUsers insert serial number on creation

Post 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
webform
Power Poster
Power Poster
Posts: 458
Joined: Sat Nov 25, 2006 3:39 pm
Location: Copenhagen, Denmark

Re: CGFEURegister/FrontEndUsers insert serial number on creation

Post by webform »

Yes, you're right, Velden.

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

Return to “Modules/Add-Ons”