Home Forums Event Espresso Premium Custom Registration ID

Custom Registration ID

Posted: February 4, 2019 at 1:17 pm


February 4, 2019 at 1:17 pm

I realise that this has been addressed before (in 2015) but I don’t see any queries (and resolutions) relating to it in 2018.
I wish to create a registration ID that is formatted as follows:
FAPSA2019-[unique incremental number]
How should one go about it?
Your response would be greatly appreciated.


  • Support Staff

February 4, 2019 at 7:48 pm


Was this the reply you saw from 2015?

If so, the way one would go about this in 2019 is roughly the same, but the filter from 2015 has been deprecated. So instead one would use:

Some example code follows:

You can add the above to a functions plugin, then activate the plugin to begin customizing the REG_code.


February 16, 2019 at 2:58 pm

Thanks so much for your response, Josh and apologies for only getting back now.
I was pushing to get another site launched.
I shall try the approach you mention and provide feedback.


February 16, 2019 at 3:17 pm

Josh, Thanks! It worked.
May I bug you once more, please. If I wanted to have the incrementing number to be three digits instead of one so, for example:
FAPSA2019-002 etc
How would I do that. I tried adding zeros but it doesn’t produce the desired effect.
Your help is greatly appreciated, thank you.


  • Support Staff

February 18, 2019 at 5:13 am

001 as an int will always be stored as 1 so you can’t just add them to the option, but what you can do is pad the value before returning it using str_pad()

So line 28 of Josh’s example could be:

return 'FAPSA2019-' . str_pad($unique_incr_num, 3, '0', STR_PAD_LEFT);

If $unique_incr_num = 1 then the above would output FAPSA2019-001

If $unique_incr_num = 12 then the above would output FAPSA2019-012

If $unique_incr_num = 123 then the above would output FAPSA2019-123

If $unique_incr_num = 1234 then the above would output FAPSA2019-1234


  • Support Staff

February 18, 2019 at 5:20 am

Also, rather than hardcoding the year into the string, you could use date('Y') to pull the current year.

return 'FAPSA' . date("Y") .'-' . str_pad($unique_incr_num, 3, '0', STR_PAD_LEFT);


February 18, 2019 at 6:20 am

Thanks, so much, Tony. I shall try this and revert.


The support post ‘Custom Registration ID’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  koopmanw 1 year ago ago

Topic Tags


This topic is:
Do NOT follow this link or you will be banned from the site!