Fix attendee export
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 27 Aug 2019 16:55:53 +0000 (12:55 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 27 Aug 2019 16:55:53 +0000 (12:55 -0400)
Need to have the custom fields per registration in the attendee export.

classes/data/dataRegRequestRegistrant.php
index.php
readme.txt

index 5ff98b5..0b047e0 100755 (executable)
@@ -387,25 +387,25 @@ class GlmDataRegistrationsRequestRegistrant extends GlmDataAbstract
         if ( !isset( $listResult['list'] ) ) {
             return false;
         }
-        $registrants = $listResult['list'];
-        $registrantCount = $this->getStats(str_replace('T.', '', $whereEvent));
+        $registrants     = $listResult['list'];
+        $registrantCount = $this->getStats( str_replace( 'T.', '', $whereEvent ) );
 
         // Make sure we received registrants
-        if (!is_array($registrants) || count($registrants) == 0) {
+        if ( !is_array( $registrants ) || count( $registrants ) == 0) {
             return false;
         }
 
         $customFieldsPluginActive = apply_filters( 'glm-members-customfields-plugin-active', false );
 
         // For each registrant
-        foreach ($registrants as $registrantKey=>$registrantVal) {
+        foreach ( $registrants as $registrantKey => $registrantVal ) {
 
             // Try to get account
             $registrants[$registrantKey]['account'] = false;
-            if ($registrantVal['account']) {
-                require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataAccount.php';
-                $Accounts = new GlmDataRegistrationsAccount($this->wpdb, $this->config);
-                $registrants[$registrantKey]['account'] = $Accounts->getEntry($registrantVal['account']);
+            if ( $registrantVal['account'] ) {
+                require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH . '/data/dataAccount.php';
+                $Accounts = new GlmDataRegistrationsAccount( $this->wpdb, $this->config );
+                $registrants[$registrantKey]['account'] = $Accounts->getEntry( $registrantVal['account'] );
             }
 
             // Try to get any per Event custom field data
@@ -424,6 +424,19 @@ class GlmDataRegistrationsRequestRegistrant extends GlmDataAbstract
                         }
                     }
                 }
+                // Check for event custom field per registation
+                $fid      = 'glm_reg_customfields_reg_event_' . $eventId;
+                $cRegId   = $registrantVal['reg_request_event'];
+                $cRegData = apply_filters( 'glm-members-customfields-form-data-recall', '', $fid, $cRegId, false );
+                if ( isset( $cRegData ) && is_array( $cRegData ) && !empty( $cRegData ) ) {
+                    $fields = $cRegData['form'];
+                    if ( isset( $fields ) && is_array( $fields ) ) {
+                        foreach ( $fields as $cField ) {
+                            $custom_data[$cField['field_name']] = $cField['stored'];
+                        }
+                    }
+                }
+
                 // Check for level custom fields also
                 // Find all reg_class for this event
                 $reg_classes = $this->wpdb->get_results(
index 28fb907..4aee833 100755 (executable)
--- a/index.php
+++ b/index.php
@@ -3,7 +3,7 @@
  * Plugin Name: GLM Associate - Event Registrations Add-On
  * Plugin URI: http://www.gaslightmedia.com/
  * Description: Add-on to integrate registrations into Events add-on.
- * Version: 1.4.2
+ * Version: 1.4.3
  * Author: Gaslight Media
  * Author URI: http://www.gaslightmedia.com/
  * License: GPL2
@@ -17,7 +17,7 @@
  * @package glmMembersRegistrationsAddOn
  * @author Chuck Scott <cscott@gaslightmedia.com>
  * @license http://www.gaslightmedia.com Gaslightmedia
- * @version 1.4.2
+ * @version 1.4.3
  */
 
 // Check that we're being called by WordPress.
@@ -48,7 +48,7 @@ if (!defined('ABSPATH')) {
  *  or updating that last position will result in cache-busting. Be
  *  sure to remove that 4th postion when doing a hotfix or release!
  */
-define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_VERSION', '1.4.2');
+define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_VERSION', '1.4.3');
 define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_VERSION', '1.0.4');
 
 // This is the minimum version of the GLM Members DB plugin require for this plugin.
index 39c22ae..a954dee 100755 (executable)
@@ -25,7 +25,10 @@ e.g.
 1. Activate the plugin through the 'Plugins' menu in WordPress
 
 == Changelog ==
-= 1.4.) =
+= 1.4.3 =
+* Bug fix for getting attendee custom field data (per registration questions)
+
+= 1.4.2 =
 * Bug fix for the subject for Notifications to Event Contacts
 
 = 1.4.1 =