How to use the calculated field of an extra field?

Hello!

I try to set up a Membership module that allows me to have all the necessary data to be able to use them in a site. One of the things I’m trying to do is to make sure that each new member has a unique identifier for each entry on the form. So I use the calculated field of a custom attribute. I had initially thought of using uuid, but could not do it directly in Dolibarr. I am therefore faced with two solutions:

  • the nickname is unique. But I can’t get that username back. I don’t know what object to use, how to use it, etc… (I tried $object->login but this doesn’t work)
  • Or I use the uniqid function of php. However, the value changes every time I update Dolibarr.

So I have two questions for you:

  • How can I retrieve a user’s unique login to change it to md5()?
    Or
  • Is it possible to freeze a value of a field calculated at registration to prevent the uniqid from changing?

Thanks in advance!

Hi @ItsWidee,

I would suggest you use the rowid (incremental number you have in the URL to define your member), you can be sure it will be unique.

Best regards,