Posted: 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.
anybody had a chance to look into this?
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.
It will be some work, but I think it’s doable.
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?
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?
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]:
$userid = $current_user->ID;
$new_user_id = $_POST[eng_id]; //This value is posted from the registration page
if($new_user_id <> $userid)
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:
////// CUSTOM RADIO BOOKING FORM ////////
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>”;
$retrieve_eng = mysqli_query($newcon,”SELECT a.display_name, a.id FROM cm_users AS a, company_engineer AS b WHERE a.id=b.engineer_wp_id AND b.company_wp_id=’$eng_id'”);
while($row = mysqli_fetch_array($retrieve_eng))
////////// 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.