$endTime = 0;
$status = false;
$memberOnly = false;
+ $memberContact = false;
echo '<br style="clear: right;">';
echo '<pre>$actionData: ' . print_r( $actionData, true ) . '</pre>';
- if ( isset( $actionData['request']['memberOnly'] )
- && $memberOnly = filter_var( $actionData['request']['memberOnly'], FILTER_VALIDATE_BOOLEAN ) ) {
+ if ( isset( $actionData['request']['member_only'] )
+ && $memberOnly = filter_var( $actionData['request']['member_only'], FILTER_VALIDATE_BOOLEAN ) ) {
- $config = apply_filters( 'glm_associate_config', '' );
- $contact_user = ( isset( $config['loggedInUser']['contactUser'] ) ) ? $config['loggedInUser']['contactUser']: null;
- if ( !$contact_user ) {
-
- return array(
- 'status' => $status,
- 'menuItemRedirect' => false,
- 'modelRedirect' => false,
- 'view' => 'front/events/error.html',
- 'data' => array(),
- );
- }
- echo '<br style="clear: right;">';
- echo '<pre>$contact_user: ' . print_r( $contact_user, true ) . '</pre>';
+ $config = apply_filters( 'glm_associate_config', '' );
+ $memberContact = ( isset( $config['loggedInUser']['contactUser'] ) ) ? $config['loggedInUser']['contactUser']: null;
+ echo '<pre>$memberContact: ' . print_r( $memberContact, true ) . '</pre>';
}
if( ! wp_script_is( 'jquery-ui', 'enqueued' ) ){
$view = 'frontAdd';
// populate category dropdown
$categories = new GlmDataEventsCategories($this->wpdb, $this->config);
- $emailInfo = new GlmDataEventsManagement($this->wpdb, $this->config);
- $emailInfo = $emailInfo->getEntry(1);
+ $emailInfo = new GlmDataEventsManagement($this->wpdb, $this->config);
+ $emailInfo = $emailInfo->getEntry(1);
// get and validate recipient email address, put into an array to pass to wp_mail
$toEmail = $emailInfo['to_email'];
}
// mySql transactions
$eventData = array(
- 'status' => '20',
- 'created' => $date,
- 'updated' => $date,
- 'name' => $name,
- 'intro' => $intro,
- 'descr' => $descr,
- 'image' => $imageName,
- 'file1' => $fileName,
- 'file1_descr' => $fileDescr,
- 'cost' => $cost,
- 'free' => $free,
- 'url' => $url,
- 'contact_phone' => $contactPhone,
- 'admin_name' => $admin_name,
- 'admin_phone' => $adminPhone,
- 'admin_email' => $adminEmail,
- 'contact_name' => $contactFirst . " " . $contactLast,
- 'contact_email' => $contactEmail,
- 'admin_org' => $admin_org
+ 'status' => '20',
+ 'created' => $date,
+ 'updated' => $date,
+ 'name' => $name,
+ 'intro' => $intro,
+ 'descr' => $descr,
+ 'image' => $imageName,
+ 'file1' => $fileName,
+ 'file1_descr' => $fileDescr,
+ 'cost' => $cost,
+ 'free' => $free,
+ 'url' => $url,
+ 'contact_phone' => $contactPhone,
+ 'admin_name' => $admin_name,
+ 'admin_phone' => $adminPhone,
+ 'admin_email' => $adminEmail,
+ 'contact_name' => $contactFirst . " " . $contactLast,
+ 'contact_email' => $contactEmail,
+ 'admin_org' => $admin_org
);
$eventDataFormat = array(
'%d',
'%s',
'%s'
);
+ if ( $memberOnly && $memberContact ) {
+ $eventData['ref_type'] = $memberContact['ref_type'];
+ $eventData['ref_dest'] = $memberContact['ref_dest'];
+ $eventDataFormat[] = '%d';
+ $eventDataFormat[] = '%d';
+ }
$this->wpdb->insert(
GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'events',
$eventData,
: ( $this->config['settings']['event_default_state'] ) ? $this->config['settings']['event_default_state']: 'MI';
// Compile template data
$templateData = array(
- 'states' => $this->config['states'],
- 'state_def' => $default_state,
- 'siteBaseUrl' => GLM_MEMBERS_EVENTS_SITE_BASE_URL,
- 'currentUrl' => $_SERVER['HTTP_REFERER'],
- 'categories' => $eventCategories,
- 'fromDate' => $fromDate,
- 'event' => $newEvent,
- 'permalink' => $permalink,
- 'title' => $title,
- 'to_email' => $to_email,
- 'from_email' => $fromEmail,
- 'notification' => $emailNotification,
- 'mainImgUrl' => GLM_MEMBERS_PLUGIN_MEDIA_URL . '/images/large/'
+ 'memberOnly' => $memberOnly,
+ 'memberContact' => $memberContact,
+ 'states' => $this->config['states'],
+ 'state_def' => $default_state,
+ 'siteBaseUrl' => GLM_MEMBERS_EVENTS_SITE_BASE_URL,
+ 'currentUrl' => $_SERVER['HTTP_REFERER'],
+ 'categories' => $eventCategories,
+ 'fromDate' => $fromDate,
+ 'event' => $newEvent,
+ 'permalink' => $permalink,
+ 'title' => $title,
+ 'to_email' => $to_email,
+ 'from_email' => $fromEmail,
+ 'notification' => $emailNotification,
+ 'mainImgUrl' => GLM_MEMBERS_PLUGIN_MEDIA_URL . '/images/large/'
);
//error_reporting(E_ALL ^ E_NOTICE);