Support

Home Forums Event Espresso Premium Add New Registration Status

Add New Registration Status

Posted: November 25, 2020 at 3:47 am


subotai

November 25, 2020 at 3:47 am

Hi!
Is there a filter/hook to add custom registration status or other way to tell that an attendee was not present during the event ?

We have to list attendees for an event and check one by one if the person was present or not.

I would like to add a status like ‘RNP’ => ‘Not présent during event’

Thanks !


Tony

  • Support Staff

November 25, 2020 at 4:59 am

Hi there,

Event Espresso has a check-in feature that can be used to show attendance:

https://eventespresso.com/wiki/registrations-ver-4-0/#40_checkins

Are you using tickets for the event with a barcode shown?

If soRegistrations can be checked in/out when they attend events using the EE4 Mobile Apps and/or the Barcode scanner add-on.

So if you have the registration object you can then check the checkin status of that registration so see if it is checked in, checked out or nether (didn’t attend).

Will that work for you?


subotai

November 25, 2020 at 6:19 am

Ok, thanks !!!
Did not see how Check-ins work !

The result wanted is here, before the “light blue section” : https://moveo.revesdiab.fr/evenements/limpact-du-sommeil-sur-le-diabete/

In the last Cell of each row, I would like to provide the ability for the author of the event to change the check-in status then with a link doing an AJAX call.

If the attendee has never been vérified => checkin_status_never
If the attendee was present => checkin_status_in
If the attendee was not present => checkin_status_out


Tony

  • Support Staff

November 25, 2020 at 6:26 am

Ok, so do you have the EE_Registration object or an EE_Attendee/Contact?


subotai

November 25, 2020 at 6:26 am

Maybe the function toggle_checkin_status($DTT_ID = null, $verify = false) can be used ? Passing the constant wanted ?

const checkin_status_in = 1;
const checkin_status_out = 0;


subotai

November 25, 2020 at 6:30 am

Yes I have the EE_Registration object ready in my loop. I’m working with content-espresso_event_attendees.php template in my chid theme

Here is my code if you don’t mind :

`
$registrations = array();
if ($contact instanceof EE_Attendee) {
$registrations = EEM_Registration::instance()->get_all(array(
array(
‘ATT_ID’ => $contact->ID(),
‘EVT_ID’ => $event->ID()
),
));
}
foreach ($registrations as $registration) {
if ($registration instanceof EE_Registration) {
$reg_status = $registration->status_ID();
?>
<tr>
<td>
<?php
echo $registration->pretty_status(true);
?>
</td>
<td><?php echo $contact->full_name(); ?></td>
<td><?php echo $contact->email(); ?></td>
<td>
<?php // CHECK FOR CHECKIN STATUS AND SHOW BUTTON TO CHECK IN OR OUT ?>
</td>
</tr>
<?php
}
}


Tony

  • Support Staff

November 25, 2020 at 6:41 am

$current_status = $registration->check_in_status_for_datetime(); will return the current checkin status.

if ( $current_status === EE_Checkin::status_checked_in ) {
    // Checked in
} elseif ( $current_status === EE_Checkin::status_checked_out ) {
    // Checked out
} else {
    // Never checked in (and therefore never checked out)
    // Could also compare using $current_status === EE_Checkin::status_checked_never
}

$registration->toggle_checkin_status(); toggles the check from its current status to in or out.

checked_never -> checked_in
checked_in -> checked_out
checked_out -> checked_in

When you check a registration in it ‘s checked in against a Datetime, not an event which is why both of the above take DTT_ID. If you don’t supply one the check-in record is assigned to the ‘primary datetime’ for that event.


subotai

November 25, 2020 at 7:11 am

Thank you so much !
It almost solved all my problem !

Now I’m handling a 500 error in my AJAX call :

    $registration_id = $_POST['REG_ID'];
    $registration = EEM_Registration::instance()->get_all(array(
        array(
            'REG_ID' => $registration_id
        ),
    ));
    $registration->toggle_checkin_status();

The last line gives me 500 error


subotai

November 25, 2020 at 7:14 am

Ok sorry, I was calling -> get_all wich returns an array of EE_registration …

That’s my code now :

    $registration_id = $_POST['REG_ID'];
    $registration = EEM_Registration::instance()->get_one_by_ID($registration_id);
    $registration->toggle_checkin_status();

The toggle-checkin_status() works now !


Tony

  • Support Staff

November 25, 2020 at 7:21 am

Ok sorry, I was calling -> get_all wich returns an array of EE_registration …

Yep, if you just want a single object and know it’s ID, use get_one_by_ID()

I’m glad it’s working for you now.


subotai

November 25, 2020 at 7:49 am

Thanks a lot for the help Tony ! Everything works fine !


Tony

  • Support Staff

November 25, 2020 at 11:36 am

You’re most welcome.

The support post ‘Add New Registration Status’ 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