Support

Home Forums Custom Files Add-on (EE3) Creating custom registration ID, How to count number of people registered? EE3

Creating custom registration ID, How to count number of people registered? EE3

Posted: February 27, 2017 at 6:34 am


garryarif

February 27, 2017 at 6:34 am

Hi, I have followed the guides and searched the forum on how to create custom ID but cannot find the solution.
I’m trying to create a series of registration ID, in the same order as people register first, second, and so on.. starting from 20000 (2001,2002,2003, and so on) for each registrant.

How can i count / show total number of people registered on each event(s) in eventespresso version 3?

I have commented out and implemented the folowing function, but it does not work:

———————————————————————————–

remove_filter(‘filter_hook_espresso_registration_id’, ‘espresso_build_registration_id’, 10);

function my_custom_registration_id($x){

$id = uniqid();

global $wpdb;

$event_id = $_POST[‘event_id’];

$registration_table = $wpdb->prefix.’esp_registration’;

$count = $wpdb->get_var(“SELECT COUNT(REG_ID) FROM $registration_table WHERE EVT_ID=’$event_id'”);

// debugging stuff
//var_dump($count);
//print “

";
//print_r($count);
//print"

“;
//echo “<br>”;
//wp_die();

$firstid =””;

$lastid =””;

$firstid = 1;

$lastid = $count;

$newid=””;

$newid = $lastid + $firstid + 6000;

//$id = substr($x[‘event_id’], 0, 3) .’-‘.’6′.’-‘.substr($x[‘fname’], 0, 5) .’+’. substr($x[‘lname’], 0, 5);

$id = substr($x[‘event_id’], 0, 3) .’-‘.$newid;

return $id;

}

add_filter(‘filter_hook_espresso_registration_id’, ‘my_custom_registration_id’, 10, 1);

  • This topic was modified 7 years, 1 month ago by  Tony. Reason: code formatting
  • This topic was modified 7 years, 1 month ago by  Tony.


Tony

  • Support Staff

March 1, 2017 at 4:16 am

Hi there,

There is a lot of issues with the code you’ve posted.

The filter you are using is for EE3, but the table (and related columns) your trying to select ‘esp_registration’ is an EE4 table.

You mentioned you are using EE3 but you need to double check which version you are using as currently your mixing sections from both versions.

The registration ID within Event Espresso is an important value and should not really be changed unless you understand the changes you are making, are you working with a developer to work through these changes?

The support post ‘Creating custom registration ID, How to count number of people registered? EE3’ 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