Support

Home Forums Event Espresso Premium Consecutive Numeric ID for each attendee

Consecutive Numeric ID for each attendee

Posted: March 5, 2015 at 9:04 am

Viewing 6 reply threads


richipum

March 5, 2015 at 9:04 am

I read in this forum https://eventespresso.com/topic/event-specific-attendee-id-number/ the same problem that I have. I need a unique, consecutive numeric ID that automatically populates for each attendee for event. are there any solution yet?

WP version: 4.1
EE Version: 4.6.13P


Lorenzo Orlando Caum

  • Support Staff

March 5, 2015 at 9:24 am

Hello,

Try this sample coding:

https://gist.github.com/Apina/d0ce690b8af1cad64135

It can be added to your child theme’s functions.php file (do not include the opening php tag) or a site specific plugin:

https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/


Lorenzo


richipum

March 5, 2015 at 10:20 am

This code does’t work, fatal error in a site specific plugin, I think there is something wrong in the code. And I need consecutive numeric ID, and I think this code give a numeric random ID

<?php
/*
Plugin Name: Dorsales
Description: Site specific code for myweb
*/
/* Begin Adding Functions Below This Line; Do not include an opening PHP tag as this sample code already includes one! */
//create a new reg ID e.g. business-1598
$new_reg_code = “business-” . rand(1000, 10000);

//send the new reg code back to be used.
return $new_reg_code;
}
add_filter(‘FHEE__EE_Registration___generate_new_reg_code__new_reg_code’,’change_reg_code’, 10, 2);
/* Stop Adding Functions */


richipum

March 6, 2015 at 2:31 am

Are there any way to assign consecutive ID numbers to attendees in each event?


Dean

March 6, 2015 at 6:33 am

Hi,

Yep that code was very broken, not sure how that happened. I’ve updated the code, plus updated the filter: https://gist.github.com/Apina/d0ce690b8af1cad64135

The only way to assign consecutive ID’s would be to store the data somewhere. One way would be to add a custom meta field to the event, check for it in the function, update it by one, use it in the ID, then update the new figure back in the custom meta field.

This has the advantage of being event specific.

If you needed something more site wide, you could do something similar but use a WP option instead.

Useful PHP snippets: https://eventespresso.com/wiki/useful-php-code-snippets/


richipum

March 6, 2015 at 8:56 am

Thanks, the code now works perfect, but i don’t know how to do a custom field that auto-increment in each attendee. I think this could be very useful for many people that use event espresso for sport events.


Dean

March 13, 2015 at 5:08 am

Hi,

I added another example to the above Gist.

It still will have issues due to registration abandonment, but it’s a basic example of how to achieve incremental reg id’s.

If you need it taking further, I would recommend contacting a PHP developer for assistance.

Viewing 6 reply threads

The support post ‘Consecutive Numeric ID for each attendee’ 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