Support

Home Forums Event Espresso Premium Run a report on a registration question

Run a report on a registration question

Posted: June 11, 2019 at 8:36 am


Vernon

June 11, 2019 at 8:36 am

How can I run a report of a question in my registration? For example I have a question were you referred? Wanting to know how many new people were referred.


Josh

  • Support Staff

June 11, 2019 at 10:06 am

This is possible, although if the answer to the question is either Yes or No, you may end up with mixed results in the search.

Here’s how to add the feature:

1) Add the following code snippet to a site specific plugin:

https://github.com/eventespresso/ee-code-snippet-library/blob/master/admin/jf_ee_add_answers_to_registration_search.php

Not sure how to add a site specific plugin? You follow this guide:
https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/

2) Then, ideally your question’s answer should be something like Yes I was referred

Then with that code in place, you can go to Event Espresso > Registrations and type Yes I was referred into the search field and the search will return a list of results that match.


Vernon

June 13, 2019 at 9:50 am

Question I have is a Yes No then a text field:
Are you a first time attendee*
Yes No
If referred, who referred you
(text field)

What would I use for a search query?

This is the code I put into the plug in:
<?php
/*
Plugin Name: EEA Search
Description: Form Search
//* Please do NOT include the opening php tag, except of course if you’re starting with a blank file
add_filter(
‘FHEE__Registrations_Admin_Page___get_where_conditions_for_registrations_query’,
‘my_custom_search_field_reg’,
10,
2
);
function my_custom_search_field_reg( $where, $request ) {
if (isset($request[‘s’])) {
$search_string = ‘%’ . sanitize_text_field($request[‘s’]) . ‘%’;


Josh

  • Support Staff

June 13, 2019 at 10:01 am

You could do a search for “Yes”, but your search results will not be very good if other questions on your registration form are Yes/No questions.

That’s why I recommend changing the answer to “Yes I was referred”.

With regards to the code, if the code in the above reply was everything, then you’re missing lines 13-16 from the example.

The support post ‘Run a report on a registration question’ 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