Support

Home Forums Event Espresso Premium Attendee Shortcode – order events by start date and include other info

Attendee Shortcode – order events by start date and include other info

Posted: July 2, 2012 at 4:52 am


rdyble

July 2, 2012 at 4:52 am

Hi, I am looking for a bit of help with two things relating to the attendee shortcodes:

  1. Ordering the events in chronological order, not in the order they
    were added to event espresso
  2. Adding the date before/after the event name (as I have the same course running at the same venue on different dates)
  3. Including the answers to custom questions against each attendee (e.g. gender, dietary requirements etc).

Ideally what I’m looking for is for each event to be listed in tabular form like this:


[Event Start Date] Name of Event

Venue Address

| Participant Name | Question 1 | Question 2 |
| John Smith | Male | No fish |


Any help gratefully received.
Russ


Josh

  • Support Staff

July 2, 2012 at 1:12 pm

The attendee shortcode does not have an order by event start parameter, so I would suggest using the “event_identifier” parameter to list out the events as you would like them to appear.

Use the event time template code to add the date: https://eventespresso.com/wiki/shortcodes-template-variables/#time-date
This would get added to the attendee_list.php template. This template can be copied over to /wp-content/uploads/espresso/templates so you do not lose your changes when you update Event Espresso.

Use the ee_answers shortcode to add the custom question answers: https://eventespresso.com/wiki/answers-shortcode/


rdyble

July 5, 2012 at 3:23 pm

Hi, thanks for for – I have the date sorted and have made one answer appear… the problem is I can’t seem to put a space or punctuation between the name and answers.

What I am looking to have is:
[firstname] [lastname] ([Question11] / [Question12])

Any ideas how I need to modify the code I have to achieve this?

=========================================
get_results($sql);
foreach ($events as $event){
$event_id = $event->id;
$event_name = stripslashes_deep($event->event_name);
if (!$this_is_a_reg_page){
$event_desc = do_shortcode(stripslashes_deep($event->event_desc));
}

        //This variable is only available using the espresso_event_status function which is loacted in the Custom Files Addon (https://eventespresso.com/download/plugins-and-addons/custom-files-addon/)
        $event_status = function_exists('espresso_event_status') ? ' - ' . espresso_event_status($event_id) : '';
        //Example usage in the event title:
        /* */

?>

  • <!—->

get_results($a_sql);
foreach ($attendees as $attendee){
$id = $attendee->id;
$lname = $attendee->lname;
$fname = $attendee->fname;
$custom_question_12 = ”.do_shortcode(‘[EE_ANSWER q=”12″ a=”‘.$id.'”]’);
$city = $attendee->city;
$state = $attendee->state;
$country = $attendee->state;
$email = $attendee->email;
$gravatar = $show_gravatar == ‘false’? get_avatar( $email, $size = ‘100’, $default = ‘http://www.gravatar.com/avatar/’ ) : ”;
$custom_question_12 = ‘ ‘.do_shortcode(‘[EE_ANSWER q=”11″ a=”‘.$id.'”]’); $city_state = $city != ” || $state != ” ? ” . ($city != ” ? $city :”) . ($state != ” ? ‘, ‘ . $state :’ ‘) :”;

    //These are example variables to show answers to questions
    //$custom_question_12 = ''.do_shortcode('[EE_ANSWER q="12" a="'.$id.'"]');
    $custom_question_11 = ''.do_shortcode('[EE_ANSWER q="11" a="'.$id.'"]');

?>
<?php echo stripslashes_deep($fname . ' ' . $lname) . ($custom_question_11 != ' ' ? $custom_question_11 :'') .'’; ?>

<?php
}
}
}

=============================


Josh

  • Support Staff

July 5, 2012 at 3:51 pm

It should be something like:

<?php echo '<p><strong>' . stripslashes_deep($fname . ' ' . $lname) . '</strong>' . ($custom_question_1 != '' ? $custom_question_1 :'') . '<span>/</span>' . ($custom_question_2 != '' ? $custom_question_2 :'') . '</p>'; ?> 

The support post ‘Attendee Shortcode – order events by start date and include other info’ 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