Include past registration history in Admin Email notification

  • Cory S
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 5 days ago #108331 by Cory S
I have about a 50% return rate for my participants, and I like to send them a personal note when they register again for an event. Currently, when I receive a registration notification, I go login to the Admin page and search for their name in Registrants to see if they've previously registered.

It would be great if on the Admin Registration notification email, it did a quick search in the Registrants table and included a table of the prior events the individual registered for.

Maybe this could be handled by adding a [TAG] for registration history lookup?

Thanks,
Cory

Please Log in or Create an account to join the conversation.

  • Cory S
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 3 days ago #108390 by Cory S
Tuan,

I went ahead and implemented this on my system. I'm hoping that you can integrate into future version. I didn't use the Override functionality, so the changes mentioned are in the core classes. I also didn't implement to work with Group registrations, so I'm sure that requires a bit more work.

File Attachment:

File Name: Registrati...tory.zip
File Size:16 KB

File Attachment:

File Name: Registrati...tory.zip
File Size:16 KB


To use: put the TAG [REGISTRATION_HISTORY] in an email template.

Both files referenced below attached.

List of changes:

com_eventbooking/site/helper/registration.php

Added following 2 lines right at line 2827, right after "$replaces line:
Code:
// Registration history tag $replaces['registration_history'] = static::getRegistrantHistory($config, $row, $loadCss, $form);

Added new method getRegistrantHistory() above getMemberDetail() method:
Code:
/** * Get Registrant history, used for [REGISTRATION_HISTORY] tag * * @param RADConfig $config * @param EventbookingTableRegistrant $row * @param bool $loadCss * @param RADForm $form * @param bool $toAdmin * * @return string */ public static function getRegistrantHistory($config, $row, $loadCss = true, $form = null, $toAdmin = true) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $data = array(); $Itemid = JFactory::getApplication()->input->getInt('Itemid', 0); if ($toAdmin) { $query->clear(); $query->select('r.first_name, r.last_name, r.address, r.register_date, e.title') ->from('#__eb_registrants AS r') ->innerJoin('#__eb_events AS e ON r.event_id = e.id') ->where('email = ' . $db->quote($row->email)) ->order('register_date'); $db->setQuery($query); $data['rowEventHistory'] = $db->loadObjectList(); } return EventbookingHelperHtml::loadCommonLayout('emailtemplates/tmpl/email_reghistory_detail.php', $data); }

Created new email template file: emailtemplates/tmpl/email_reghistory_detail.php
Code:
<?php /** * @package Joomla * @subpackage Event Booking */ defined('_JEXEC') or die; $nullDate = JFactory::getDbo()->getNullDate(); if (!empty($rowEventHistory)) { ?> <h3 class="eb-heading">Past Registrations</h3> <table class="table table-striped table-bordered table-condensed"> <thead> <tr> <th> First </th> <th class="eb-text-right"> Last </th> <th class="center"> Address </th> <th class="eb-text-right"> Registration Date </th> <th class="eb-text-right"> Event </th> </tr> </thead> <tbody> <?php foreach ($rowEventHistory as $event) { ?> <tr> <td> <?php echo JText::_($event->first_name); ?> </td> <td> <?php echo JText::_($event->last_name); ?> </td> <td> <?php echo JText::_($event->address); ?> </td> <td> <?php echo JText::_($event->register_date); ?> </td> <td> <?php echo JText::_($event->title); ?> </td> </tr> <?php } ?> </tbody> </table> <?php } ?>
Attachments:

Please Log in or Create an account to join the conversation.

Moderators: Tuan Pham Ngoc