Support

Home Forums Pre-Sales Custom Registration ID

Custom Registration ID

Posted: July 16, 2013 at 3:20 am


Frank Rakete

July 16, 2013 at 3:20 am

Is there any possibility to change the registration ID to a custom one? Saw that some already asked that but I like to know whether it`s possible or you are planning to add this feature in a futur version?


Dean

July 16, 2013 at 4:14 am

Hello Frank,

No this isn’t possible to do. It is not on our roadmap as yet, though I have added it to our feature request list.


Frank Rakete

July 16, 2013 at 5:27 am

Hello Dean,

thanks for your answer.

I think this feature could gain your profit, because a lot of event managers are working with their special own registration ids and thats one reason not to use your plugin.

We will see, what my customer says…


Josh

  • Support Staff

July 16, 2013 at 10:18 am

Hi Frank,

While Dean is correct that there isn’t a configurable feature of Event Espresso that builds custom registration ID (like an option), there is a filter that is in place that allows for building custom registration IDs without modifying core Event Espresso code. It’s basically a WordPress filter that allows you to remove the built-in function that generates a unique ID and replace it with something else.

If you’re not too familiar with WordPress filters, there is a nice discussion you can read up on here:
http://wordpress.org/support/topic/fliters-vs-actions-from-a-newbe

So as an example, a developer can remove the filter that Event Espresso uses to generate a unique registration ID with a function like this:

// remove default registration id filter
function my_remove_registration_id_filter() {
	remove_filter('filter_hook_espresso_registration_id', 'espresso_build_registration_id', 10);
}
add_filter ('filter_hook_espresso_registration_id', 'my_remove_registration_id_filter', 9 );

Then it’s possible to build a new custom function to replace the standard registration ID:

function my_custom_registration_id(){
	$id = uniqid();
        // for the sake of an example, we'll convert the unique ID to be letters from the alphabet, which would make for something similar to an airline's reservation code
	return strtr($id, '01234567890', 'abcdefghij');
}

Then you can add your new filter:

add_filter('filter_hook_espresso_registration_id', 'my_custom_registration_id', 10, 1);


Dean

July 17, 2013 at 3:26 am

Thanks Josh, thats a great way of doing it!


Frank Rakete

July 19, 2013 at 6:48 am

Hello Josh,

thanks for your workarround!

In which files do I have to make these changes? custom-function.php?


Dean

July 19, 2013 at 6:52 am

Correct, custom-function.php, just add the 3 code blocks to the bottom of the file.

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.

Event Espresso