Home Forums Event Espresso Premium Posting custom values event registration form

Posting custom values event registration form

Posted: March 3, 2015 at 6:06 am

John Durbin

March 3, 2015 at 6:06 am


my question is regarding the registration form for an event. I need to make it dynamic, displaying different information depending on how the user is. Because all the events on our website are for members only, we always know which user is using the registration form.

I’ve already modified the registration_page_display template in order to change what registration form to display.

My next step is how to make the system process the information that is entered. The scenario is the following:

If I’m a child account, I will the see the standard un-touched EventEspresso registration form, so everything is fine.

If I’m the parent account, I will see a dropdown menu with all my children accounts. I want to be able to pick a child and register that child onto the event. The dropdown itself contains the WordPress user id for each child so that it could be used to retrieve all the user info and pass those to EventEspresso as the registrant details.

Which template(s) do I need to change in order to achieve this (if it’s at all possible in the first place)?

I’m running the latest version of WordPress and the latest version of EE3.

Thanks for the support.

John Durbin

March 4, 2015 at 3:34 am


anybody had a chance to look into this?

Many thanks!


March 4, 2015 at 3:58 am

Hi John,

In EE3, you could use any of the registration_page templates found here: /wp-content/plugins/event-espresso/templates. It just depends if you are using Multiple Event Registration or not.

Of course you will likely need a custom plugin or various functions to achieve what you are trying to do.

Personally I’d look to use AJAX and Javascript: add an empty dropdown and a function to grab the user id probably to a hidden form input. Then you can populate the dropdown via AJAX. Then on select you can use AJAX to grab the data of the child (another user I assume) and populate the form.

It will be some work, but I think it’s doable.

If you’re not comfortable with PHP and JavaScript I would recommend hiring a developer.

John Durbin

March 4, 2015 at 4:11 am

Thanks for the suggestion. Just to confirm, I’m not using Multiple Event Registration.

I still have one question. Because all the events are members-only, I’m also heavily relying on the event_member_rel, where every user_id is assigned to the event where they are registered to. If I simply fill the form with some details, no matter what I put there, the registration will be assigned to the user_id that is on the page at the moment (which in out case would probably be the company account, rather than the single engineer). Is there a way to pass the correct user_id as well to make sure that the correct relationship is then created?


  • Support Staff

March 5, 2015 at 4:10 am

Hi John,

It is possible yes.

Within the members plugin (‘espresso-members’) you will find user_vars.php which is where the current users details are pulled. You should be able to just override the user_id there, however that file is used within various places in EventEspresso, so just changing that file will have an effect globally.

What I would do is check if the user_id of the ‘correct’ user has been saved from the registration form, and if so replace the $user_id within that file with your custom id. EE will then use that to pull in and use the information for that user rather than the one currently logged in.

If the user_id has not been saved, continue to use the default setup.

Does that help?

John Durbin

March 5, 2015 at 5:30 am

Hi Tony,

thanks for the tip. I’ve made few changes and I think I’m almost there, but not quite.

Here is how I’ve modified the user_vars.php [the top section]:

global $current_user;
global $user_email;

$userid = $current_user->ID;

$new_user_id = $_POST[eng_id]; //This value is posted from the registration page

if($new_user_id <> $userid)
$userid = $new_user_id;
$user_info = get_userdata($userid);
$um_fname = $user_info->first_name;
$um_lname = $user_info->last_name;
$um_email = $user_info->user_email;
$userid = $userid;
$um_fname = $current_user->first_name;
$um_lname = $current_user->last_name;
$um_email = $user_email;

The code above has the following result: the booking is successful and gets assigned to the correct new $userid, but no other information is pulled, meaning that the booking is blank, with no first name, last name and email.

On the registration form I’ve made the following changes:


global $current_user;
$account_type = get_user_field(‘account_type’, $eng_id);

if($account_type == ‘company’)


echo “<i>(You can only register <b><u>ONE</u></b> engineer for every form. If the list is empty, you need to add engineers in your company <u><b> by clicking HERE</b></u>)</i></br></br>”;

// Check connection
if (mysqli_connect_errno())
echo “Failed to connect to MySQL: ” . mysqli_connect_error();

$retrieve_eng = mysqli_query($newcon,”SELECT a.display_name, FROM cm_users AS a, company_engineer AS b WHERE AND b.company_wp_id=’$eng_id'”);

while($row = mysqli_fetch_array($retrieve_eng))

echo “<label style=’font-size:20px’><input type=’radio’ name=’eng_id’ value='” . $row[id] . “‘>  ” . $row[display_name] . “</label>”;


////////// END OF CUSTOM RADIO BUTTONS //////////


echo event_espresso_add_question_groups( $question_groups, ”, NULL, FALSE, array( ‘attendee_number’ => 1 ), ‘ee-reg-page-questions’ );


The code above checks if the current user is a “company” or a “person”. If it’s a company is replacing the standard form with a list of names as a radio-button list. You pick one and the new $userid is posted as a replacement for the user_vars.php file. If instead the user is a “person”, the regular form is displayed.

The latter point has an additional issue. If now I log in as a regular user to make a reservation, I see the standard form, the reservation is successful but no relationship is created in the ‘events_member_rel’ table, so the user then won’t see the reservation under his account.

Do you have any idea of what I may be missing?

Many thanks for the support!

The support post ‘Posting custom values event registration form’ 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  John Durbin 4 years, 10 months ago ago

Topic Tags


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