Buy a Support License | Donate | Support
Version: 2.1.21
Author: Seth Shoultes
Author URI: http://www.shoultes.net
Contributors:
Ben Dunkle http://field2.com - Icon Design - Thanks Ben!!
Chris Reynolds (jazzs3quence) http://arcanepalette.com - minor bugfixes
Changes:
2.1.21
Made some very minor updates.
2.1.20
removed deprecated split() and simplepie fetch calls in event_regis.php and includes/manage_events.php
2.1.19
Changed the name of the admin_register_head function to espresso_admin_register_head.
2.1.18
Changed name to Event Espresso.
Added fix to display content above the events.
2.1.17
Added detailed instructions for page settings.
2.1.16
Removed some extra space from the end of the event_register_attendees.php file. It was causing problems with header already being sent.
2.1.15
Fixed the rest of the places that were using is_active='yes'.
2.1.14
Fixed the bug with events disappearing when updating. This was being caused by the is_active field storing the data (Y or N instead of yes or no) when I updated the radio buttons.
2.1.13
Fixed the problems with the radio buttons not staying checked.
2.1.12
Fixed short tags and fixed a conflict with the pagination class, renamed it to event_regis_pagination.
2.1.11
Fixed the problem with free events showing payment button.
2.1.10
Fixed a problem with the email link to PayPal.
2.1.9
Several updates to the admin style.
2.1.8
Fixed problem with not escaping qoutes
2.1.7
Fixed some of the database insert functions
2.1.6
Minor fixes
2.1.5
Somehow the other changes didn't take effect!
2.1.4
Removed some old code.
2.1.3
Fixed database security holes.
2.1.2
Minor fixes throughout.
2.1.1
Added the ability to copy/duplicate an event.
Fixed a bug with the event questions/answers not showing in the Excel export.
Added event titles to the event url's for better SEO.
2.1.0
Removed the events_organization database table, we are now using the native Wordpress options database table to store the organization settings. This has speeded up the regsistration process considerably.
*/
/* Copyright 2010 SETH SHOULTES (email: seth@smartwebutah.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
error_reporting(E_ALL ^ E_NOTICE);
//Define static variables
define("EVNT_RGR_PLUGINPATH", "/" . plugin_basename( dirname(__FILE__) ) . "/");
define("EVNT_RGR_PLUGINFULLURL", WP_PLUGIN_URL . EVNT_RGR_PLUGINPATH );
//Install/Update Tables when plugin is activated
require("includes/database_install.php");
register_activation_hook(__FILE__,'events_data_tables_install');
//Event questions/options
require("includes/event_form_config.php");
//Payment Page/PayPal Buttons - Used to display the payment options and the payment link in the email. Used with the {EVENTREGPAY} tag
require("includes/paypal.class.php");
require("includes/payment_page.php");
//The calendar pop function
require("includes/tc_calendar.php");
//Events Listing - Shows the events on your page. Used with the {EVENTREGIS} tag
require("includes/get_event_details.php");
require("includes/display_all_events.php");
//List Attendees - Used with the {EVENTATTENDEES} tag
require("includes/attendee_list.php");
//Widget - Display the list of events in your sidebar
require("includes/widget.php");
//Admin Widget - Display event stats in your admin dashboard
require("includes/event_regis_dashboard_widget.php");
//Payment processing - Used for onsite payment processing. Used with the {EVENTPAYPALTXN} tag
require("includes/process_payments.php");
//Build the admin header for the plugin
require("includes/admin_header.php");
add_action('admin_head', 'espresso_admin_register_head');
//Event Registration Subpage - Configure Organization
require("includes/organization_config_mnu.php");
//Event Registration Subpage - Add/Delete/Edit Events
require("includes/manage_events.php");
//Event Registration Subpage - View Attendees
require("includes/event_registration_reports.php");
require("includes/edit_attendee_record.php");
//require("includes/admin_list_attendees.php");
//Event Registration Subpage - Enter Attendee Payments
require("includes/admin_reports.php");
require("includes/admin_process_payments.php");
require("includes/list_attendee_payments.php");
require("includes/enter_attendee_payments.php");
//Event Registration Subpage - Plugin Support
require("includes/admin_event_categories.php");
require("includes/event_regis_categories.php");
//Event Registration Subpage - Plugin Support
require("includes/admin_support.php");
//Main form events page
require("includes/event_register_attendees.php");
//Event Registration Main Admin Page
function event_regis_main_mnu(){
/* The following functions are what I wish to add to the main menu page
1. Display current count of attendees for active event (show event name, description and id)- shows by default
*/
organization_config_mnu();
}
/**
* Add a settings link to the Plugins page, so people can go straight from the plugin page to the
* settings page.
*/
function event_regis_filter_plugin_actions( $links, $file ){
// Static so we don't call plugin_basename on every plugin row.
static $this_plugin;
if ( ! $this_plugin ) $this_plugin = plugin_basename(__FILE__);
if ( $file == $this_plugin ){
$org_settings_link = '' . __('Settings') . '';
$events_link = '' . __('Events') . '';
array_unshift( $links, $org_settings_link, $events_link ); // before other links
}
return $links;
}
add_filter( 'plugin_action_links', 'event_regis_filter_plugin_actions', 10, 2 );
function add_event_registration_menus() {
add_menu_page('PayPal Events Registration', 'Event Manager', 'administrator', __FILE__, 'event_regis_main_mnu', EVNT_RGR_PLUGINFULLURL.'images/events_icon_16.png');
add_submenu_page(__FILE__, 'Configure Organization', 'Configure Organization', 'administrator', __FILE__, 'event_regis_main_mnu');
add_submenu_page(__FILE__, 'Event Setup', 'Event Setup', 'administrator', 'events', 'event_regis_manage_events');
add_submenu_page(__FILE__, 'Manage Event Categories', 'Event Categories', 'administrator', 'event_categories', 'event_regis_categories_config_mnu');
add_submenu_page(__FILE__, 'Regform Setup', 'Regform Setup', 'administrator', 'form', 'event_form_config');
//add_submenu_page(__FILE__, 'View Attendees', 'View Attendees', 8, 'attendees', 'event_registration_reports');
add_submenu_page(__FILE__, 'Attendees/Payments', 'Attendees/Payments', 'administrator', 'admin_reports', 'event_admin_reports');
add_submenu_page(__FILE__, 'Help/Support', 'Help/Support', 'administrator', 'support', 'event_regis_support');
}
//ADMIN MENU
add_action('admin_menu', 'add_event_registration_menus');
// Enable the ability for the event_funct to be loaded from pages
add_filter('the_content','event_regis_insert');
add_filter('the_content','event_regis_attendees_insert');
add_filter('the_content','event_regis_pay_insert');
add_filter('the_content','event_paypal_txn_insert');
// Function to deal with loading the events into pages
function event_regis_insert($content)
{
if (preg_match('{EVENTREGIS}',$content))
{
ob_start();
event_regis_run();
$buffer = ob_get_contents();
ob_end_clean();
$content = str_replace('{EVENTREGIS}',$buffer,$content);
}
return $content;
}
function event_regis_attendees_insert($content)
{
if (preg_match('{EVENTATTENDEES}',$content))
{
ob_start();
event_attendee_list_run();
$buffer = ob_get_contents();
ob_end_clean();
$content = str_replace('{EVENTATTENDEES}',$buffer,$content);
}
return $content;
}
function event_regis_pay_insert($content)
{
if (preg_match('{EVENTREGPAY}',$content))
{
ob_start();
event_regis_pay();
$buffer = ob_get_contents();
ob_end_clean();
$content = str_replace('{EVENTREGPAY}',$buffer,$content);
}
return $content;
}
function event_paypal_txn_insert($content)
{
if (preg_match('{EVENTPAYPALTXN}',$content))
{
$content = str_replace('{EVENTPAYPALTXN}',event_paypal_txn(),$content);
}
return $content;
}
/*********Shortcode support starts here************/
// [SINGLEEVENT single_event_id="your_event_identifier"]
function show_single_event($atts) {
extract(shortcode_atts(array('single_event_id' => 'No ID Supplied'), $atts));
$single_event_id = "{$single_event_id}";
ob_start();
register_attendees($single_event_id);
$buffer = ob_get_contents();
ob_end_clean();
return $buffer;
}
add_shortcode('SINGLEEVENT', 'show_single_event');
// [EVENT_REGIS_CATEGORY event_category_id="your_category_identifier"]
function show_event_category($atts) {
extract(shortcode_atts(array('event_category_id' => 'No Category ID Supplied'), $atts));
$event_category_id = "{$event_category_id}";
ob_start();
display_event_regis_categories($event_category_id);
$buffer = ob_get_contents();
ob_end_clean();
return $buffer;
}
add_shortcode('EVENT_REGIS_CATEGORY', 'show_event_category');
/*********Shortcode support ends here************/
//Date formatting function starts here
function event_date_display($date){
if (empty($date)){
echo 'NO DATE SUPPLIED';
}else{
list($year, $month, $day) = explode("-", $date); // fixed by jazzs3quence 9/10/2010
$event_date_display = date('M d, Y', mktime(0, 0, 0, $month, $day, $year));
}
return $event_date_display;
}
//Run the program
function event_regis_run(){
global $wpdb;
$events_attendee_tbl = get_option('events_attendee_tbl');
$events_detail_tbl = get_option('events_detail_tbl');
$org_options = get_option('events_organization_settings');
$events_listing_type =$org_options['events_listing_type'];
$event_page_id =$org_options['event_page_id'];
if ($events_listing_type == ""){ echo "
Please setup Organization in the Admin Panel!
";}
if ($events_listing_type == 'single'){
if ($_REQUEST['regevent_action'] == "post_attendee"){add_attedees_to_db();}
else if ($_REQUEST['regevent_action'] == "pay"){event_regis_pay();} //Linked to from confirmation email
else if ($_REQUEST['regevent_action'] == "register"){register_attendees();}
else if ($_REQUEST['regevent_action'] == "paypal_txn"){event_regis_paypal_txn();} //Runs the paypal transaction
else if ($regevent_action == "process"){}
else {register_attendees();}
}
if ($events_listing_type == 'all'){
if ($_REQUEST['regevent_action'] == "post_attendee"){add_attedees_to_db();}
else if ($_REQUEST['regevent_action'] == "pay"){event_regis_pay();}
else if ($_REQUEST['regevent_action'] == "register"){register_attendees();}
else if ($_REQUEST['regevent_action'] == "paypal_txn"){process_paypal_txn();}
else if ($regevent_action == "process"){}
else {display_all_events();}
}
}
function event_form_build(&$question, $answer="") {
$required = '';
if ($question->required == "Y") {
$required = ' class="r"';
}
switch ($question->question_type) {
case "TEXT":
echo "id\" name=\"TEXT-$question->id\" size=\"40\" title=\"$question->question\" value=\"$answer\" />\n";
break;
case "TEXTAREA":
echo "\n";
break;
case "SINGLE":
$values = explode(",", $question->response);
$answers = explode(",", $answer);
foreach ($values as $key => $value) {
$checked = in_array($value, $answers)? " checked=\"checked\"": "";
echo "
\n";
}
break;
case "MULTIPLE":
$values = explode(",", $question->response);
$answers = explode(",", $answer);
foreach ($values as $key => $value) {
$checked = in_array($value, $answers)? " checked=\"checked\"": "";
echo "
\n";
}
break;
case "DROPDOWN":
$values = explode(",", $question->response);
$answers = $answer;
echo "";
break;
default:
break;
}
}
function add_attedees_to_db(){
global $wpdb;
$org_options = get_option('events_organization_settings');
$Organization =$org_options['organization'];
$Organization_street1 =$org_options['organization_street1'];
$Organization_street2=$org_options['organization_street2'];
$Organization_city =$org_options['organization_city'];
$Organization_state=$org_options['organization_state'];
$Organization_zip =$row['organization_zip'];
$contact =$org_options['contact_email'];
$registrar = $org_options['contact_email'];
$paypal_id =$org_options['paypal_id'];
$paypal_cur =$org_options['currency_format'];
$return_url = $org_options['return_url'];
$cancel_return = $org_options['cancel_return'];
$notify_url = $org_options['notify_url'];
$events_listing_type =$org_options['events_listing_type'];
$default_mail=$org_options['default_mail'];
$conf_message =$org_options['message'];
$events_attendee_tbl = get_option('events_attendee_tbl');
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$hear = $_POST['hear'];
$num_people = $_POST ['num_people'];
$event_id=$_POST['event_id'];
$payment = $_POST['payment'];
$wpdb->query($wpdb->prepare("INSERT INTO ".$events_attendee_tbl." (lname ,fname ,address ,city ,state ,zip ,email ,phone ,hear, quantity, payment, event_id ) VALUES ('$lname', '$fname', '$address', '$city', '$state', '$zip', '$email', '$phone', '$hear','$num_people', '$payment', '$event_id')"));
$attendee_id = $wpdb->get_var("SELECT LAST_INSERT_ID()");
// Insert Extra From Post Here
$events_question_tbl = get_option('events_question_tbl');
$events_answer_tbl = get_option('events_answer_tbl');
$questions = $wpdb->get_results("SELECT * from `$events_question_tbl` where event_id = '$event_id'");
if ($questions) {
foreach ($questions as $question) {
switch ($question->question_type) {
case "TEXT":
case "TEXTAREA":
case "SINGLE":
$post_val = $_POST[$question->question_type . '-' . $question->id];
$wpdb->query($wpdb->prepare("INSERT into `$events_answer_tbl` (registration_id, question_id, answer)
values ('$attendee_id', '$question->id', '$post_val')"));
break;
case "MULTIPLE":
$values = explode(",", $question->response);
$value_string = '';
foreach ($values as $key => $value) {
$post_val = $_POST[$question->question_type . '-' . $question->id . '-' . $key];
if ($key > 0 && !empty($post_val))
$value_string .= ',';
$value_string .= $post_val;
}
$wpdb->query($wpdb->prepare("INSERT into `$events_answer_tbl` (registration_id, question_id, answer)
values ('$attendee_id', '$question->id', '$value_string')"));
break;
}
}
}
$events_detail_tbl = get_option('events_detail_tbl');
$sql = "SELECT * FROM ". $events_detail_tbl ." WHERE id='".$event_id."'";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc ($result)){
$event_name=$row['event_name'];
$event_desc=$row['event_desc']; // BHC
$display_desc=$row['display_desc'];
$event_identifier=$row['event_identifier'];
$reg_limit = $row['reg_limit'];
$cost=$row['event_cost'];
$start_time = $row['start_time'];
$end_time = $row['end_time'];
$active=$row['is_active'];
$send_mail= $row['send_mail'];
$conf_mail= $row['conf_mail'];
$start_date = $row['start_date'];
$end_date = $row['end_date'];
}
$headers = "MIME-Version: 1.0\r\n";
$headers .= "From: " . $Organization . " <". $contact . ">\r\n";
$headers .= "Reply-To: " . $Organization . " <" . $contact . ">\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
// Email Confirmation to Registrar
$distro=$registrar;
$message=("$fname $lname has signed up on-line for $event_name.\n\nEmail address is $email.");
wp_mail($distro, $event_name, $message, $headers);
//Email Confirmation to Attendee
$payment_link = get_option('siteurl') . "/?page_id=" . $return_url . "&id=".$attendee_id;
//Email Confirmation to Attendee
$SearchValues = array(
"[fname]",
"[lname]",
"[phone]",
"[event]",
"[description]",
"[cost]",
"[qst1]",
"[qst2]",
"[qst3]",
"[qst4]",
"[contact]",
"[company]",
"[co_add1]",
"[co_add2]",
"[co_city]",
"[co_state]",
"[co_zip]",
"[payment_url]",
"[start_date]",
"[start_time]",
"[end_date]",
"[end_time]");
$ReplaceValues = array(
$fname,
$lname,
$phone,
$event_name,
$event_desc,
$cost,
$question1,
$question2,
$question3,
$question4,
$contact,
$Organization,
$Organization_street1,
$Organization_street2,
$Organization_city,
$Organization_state,
$Organization_zip,
$payment_link,
$start_date,
$start_time,
$end_date,
$end_time);
$custom = str_replace($SearchValues, $ReplaceValues, $conf_mail);
$default_replaced = str_replace($SearchValues, $ReplaceValues, $conf_message);
$distro="$email";
$message_top = "
This is a free event. Details have been sent to your email.
'; }else{ $event_message = 'Payment must be made to complete registration. Please click the button below to pay for your registration.
'; } ?>Your Registration data has been added to our records.
"; while ($row = mysql_fetch_assoc ($result)){ $id = $row['id']; $lname = $row['lname']; $fname = $row['fname']; $address = $row['address']; $city = $row['city']; $state = $row['state']; $zip = $row['zip']; $email = $row['email']; $phone = $row['phone']; $date = $row['date']; $payment_status = $row['payment_status']; $txn_type = $row['txn_type']; $amount_pd = $row['amount_pd']; $payment_date = $row['payment_date']; $event_id = $row['event_id']; echo "There are two ways to upgrade. Purchase a premium support license directly from Event Espresso, from the WP Plugins App Store or using the button below.
Advanced Events Registration must be configured. Go to the Organization Settings page to configure the plugin "Page Settings."
Advanced Events Registration must be configured. Go to the Organization Settings page to configure the plugin "Page Settings."