Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This code is not supported by Event Espresso
- //This code is merely an example of how to use the filter FHEE__EE_Registration___generate_new_reg_code__new_reg_code
- function change_the_reg_id($new_reg_code, $this) {
- //EE doesn't store sequential ID's so let's make an option to hold the last one.
- $the_last_reg_id = get_option( 'my_current_reg_id' );
- //if the option is not set, then let's make it 1
- if( !isset($the_last_reg_id) ) {
- $the_last_reg_id = '1';
- }
- //otherwise lets increment it and then update the option.
- else {
- $the_last_reg_id = (int)$the_last_reg_id + 1;
- update_option( 'my_current_reg_id', $the_last_reg_id );
- }
- //modify the reg code with the new one and return it.
- $new_reg_code = $the_last_reg_id;
- return $new_reg_code;
- }
- add_filter('FHEE__EE_Registration_Processor___generate_reg_code__new_reg_code', 'change_the_reg_id', 10,2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement