本文整理汇总了PHP中espresso_member_data函数的典型用法代码示例。如果您正苦于以下问题:PHP espresso_member_data函数的具体用法?PHP espresso_member_data怎么用?PHP espresso_member_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了espresso_member_data函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: espresso_is_my_event
function espresso_is_my_event($event_id)
{
global $wpdb;
if (current_user_can('administrator') || espresso_member_data('role') == 'espresso_event_admin') {
return true;
}
}
示例2: edit_event_venue
function edit_event_venue()
{
global $wpdb;
$id = $_REQUEST['id'];
$sql = "SELECT * FROM " . EVENTS_VENUE_TABLE . " v WHERE v.id ='" . $id . "' ";
if (function_exists('espresso_member_data') && espresso_member_data('role') == 'espresso_event_manager') {
$sql .= " AND v.wp_user = '" . espresso_member_data('id') . "' ";
}
//echo $sql;
$results = $wpdb->get_results($sql);
if (!$wpdb->num_rows > 0) {
return;
}
foreach ($results as $result) {
$venue_id = $result->id;
$name = stripslashes_deep($result->name);
$address = stripslashes_deep($result->address);
$address2 = stripslashes_deep($result->address2);
$city = stripslashes_deep($result->city);
$state = stripslashes_deep($result->state);
$zip = stripslashes_deep($result->zip);
$country = stripslashes_deep($result->country);
$meta = unserialize($result->meta);
$last_locale_id = $wpdb->get_var("SELECT locale_id FROM " . EVENTS_LOCALE_REL_TABLE . " WHERE venue_id='" . $id . "'");
}
?>
<!--Add event display-->
<div id="add-edit-venue" class="metabox-holder">
<div class="postbox">
<h3>
<?php
_e('Edit Venue:', 'event_espresso');
?>
<?php
echo stripslashes($name);
?>
</h3>
<div class="inside">
<form method="post" action="<?php
echo $_SERVER['REQUEST_URI'];
?>
">
<input type="hidden" name="venue_id" value="<?php
echo $venue_id;
?>
">
<input type="hidden" name="action" value="update">
<table width="100%" border="0">
<tr>
<td align="left" valign="top">
<ul>
<li>
<label for="name">
<?php
_e('Name', 'event_espresso');
?>
</label>
<input type="text" id="name" name="name" size="25" value="<?php
echo $name;
?>
">
</li>
<li>
<label for="address">
<?php
_e('Address', 'event_espresso');
?>
</label>
<input type="text" id="address" name="address" size="25" value="<?php
echo $address;
?>
">
</li>
<li>
<label for="address2">
<?php
_e('Address 2', 'event_espresso');
?>
</label>
<input type="text" id="address2" name="address2" size="25" value="<?php
echo $address2;
?>
">
</li>
<li>
<label for="city">
<?php
_e('City', 'event_espresso');
?>
</label>
<input type="text" id="city" name="city" size="25" value="<?php
echo $city;
?>
">
</li>
<li>
<label for="state">
<?php
_e('State', 'event_espresso');
//.........这里部分代码省略.........
示例3: event_espresso_edit_list
function event_espresso_edit_list()
{
global $wpdb, $org_options;
define('EVT_ADMIN_URL', admin_url('admin.php?page=events'));
$max_rows = isset($_REQUEST['max_rows']) & !empty($_REQUEST['max_rows']) ? absint($_REQUEST['max_rows']) : 50;
$start_rec = isset($_REQUEST['start_rec']) && !empty($_REQUEST['start_rec']) ? absint($_REQUEST['start_rec']) : 0;
$records_to_show = " LIMIT {$max_rows} OFFSET {$start_rec} ";
//Dates
$curdate = date('Y-m-d');
$this_year_r = date('Y');
$this_month_r = date('m');
$days_this_month = date('t', strtotime($curdate));
$month_range = isset($_REQUEST['month_range']) && !empty($_REQUEST['month_range']) ? sanitize_text_field($_REQUEST['month_range']) : FALSE;
$category_id = isset($_REQUEST['category_id']) && !empty($_REQUEST['category_id']) ? sanitize_text_field($_REQUEST['category_id']) : FALSE;
$today_filter = isset($_REQUEST['today']) && $_REQUEST['today'] == 'true' ? TRUE : FALSE;
$this_month_filter = isset($_REQUEST['this_month']) && $_REQUEST['this_month'] == 'true' ? TRUE : FALSE;
$event_status = isset($_POST['event_status']) && !empty($_POST['event_status']) ? sanitize_text_field($_REQUEST['event_status']) : FALSE;
if (isset($_POST['delete_event'])) {
if (is_array($_POST['checkbox'])) {
while (list($key, $value) = each($_POST['checkbox'])) {
$del_id = $key;
event_espresso_delete_event($del_id);
}
}
?>
<div id="message" class="updated fade">
<p><strong>
<?php
_e('Event(s) have been permanently deleted.', 'event_espresso');
?>
</strong></p>
</div>
<?php
}
if (isset($_POST['perm_delete_event'])) {
if (is_array($_POST['checkbox'])) {
while (list($key, $value) = each($_POST['checkbox'])) {
$del_id = $key;
event_espresso_empty_event_trash($del_id);
}
}
?>
<div id="message" class="updated fade">
<p><strong>
<?php
_e('Event(s) have been permanently deleted.', 'event_espresso');
?>
</strong></p>
</div>
<?php
}
$recurrence_icon = '';
if (defined('EVENT_ESPRESSO_RECURRENCE_MODULE_ACTIVE')) {
$recurrence_icon = '<img src="' . EVENT_ESPRESSO_PLUGINFULLURL . 'images/arrow_rotate_clockwise.png" alt="Recurring Event" title="Recurring Event" class="re_fr" />';
}
require_once 'queries.php';
if (file_exists(EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/admin_reports_filters.php')) {
require_once EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/admin_reports_filters.php';
} else {
echo '<p><strong>' . __('Advanced filters are now available in the premium versions.', 'event_espresso') . '</strong> <a href="http://eventespresso.com/download/" target="_blank">' . __('Upgrade Now!', 'event_espresso') . '</a></p>';
//$total_events = espresso_total_events();
}
if ($month_range !== FALSE) {
$pieces = explode('-', $month_range, 3);
$year_r = $pieces[0];
$month_r = $pieces[1];
}
$group = '';
$sql = '';
//Check if the venue manager is turned on
$use_venue_manager = isset($org_options['use_venue_manager']) && $org_options['use_venue_manager'] == 'Y' ? TRUE : FALSE;
$is_regional_manager = FALSE;
//This checks to see if the user is a regional manager and creates a union to join the events that are in the users region based on the venue/locale combination
if (function_exists('espresso_member_data') && espresso_member_data('role') == 'espresso_group_admin') {
$is_regional_manager = TRUE;
$group = get_user_meta(espresso_member_data('id'), "espresso_group", TRUE);
if ($group != '0' && !empty($group)) {
$sql = "(SELECT e.id event_id, e.event_name, e.event_identifier, e.reg_limit, e.registration_start, ";
$sql .= " e.start_date, e.is_active, e.recurrence_id, e.registration_startT, e.wp_user ";
//Get the venue information
if ($use_venue_manager) {
$sql .= ", v.name AS venue_title, v.address AS venue_address, v.address2 AS venue_address2, v.city AS venue_city, v.state AS venue_state, v.zip AS venue_zip, v.country AS venue_country ";
} else {
$sql .= ", e.venue_title, e.phone, e.address, e.address2, e.city, e.state, e.zip, e.country ";
}
//Get the locale fields
if ($use_venue_manager) {
$sql .= ", lc.name AS locale_name, e.wp_user ";
}
$sql .= " FROM " . EVENTS_DETAIL_TABLE . " e ";
//Join the categories
if ($today_filter) {
$sql .= " JOIN " . EVENTS_CATEGORY_REL_TABLE . " cr ON cr.event_id = e.id ";
$sql .= " JOIN " . EVENTS_CATEGORY_TABLE . " c ON c.id = cr.cat_id ";
}
//Join the venues and locales
if (!empty($group) && $use_venue_manager) {
$sql .= " LEFT JOIN " . EVENTS_VENUE_REL_TABLE . " vr ON vr.event_id = e.id ";
$sql .= " LEFT JOIN " . EVENTS_VENUE_TABLE . " v ON v.id = vr.venue_id ";
//.........这里部分代码省略.........
示例4: add_event_espresso_menus
//.........这里部分代码省略.........
add_submenu_page('event_espresso', __('Event Espresso - General Settings', 'event_espresso'), __('General Settings', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_general']), 'event_espresso', 'organization_config_mnu');
//Event Setup
add_submenu_page('event_espresso', __('Event Espresso - Event Overview', 'event_espresso'), __('Event Overview', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_events']), 'events', 'event_espresso_manage_events');
//Seating chart management
if (defined('ESPRESSO_SEATING_CHART')) {
add_submenu_page('event_espresso', __('Event Espresso - Seating Chart', 'event_espresso'), __('Seating Chart', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_seating']), 'seating_chart', 'event_espresso_manage_seating_chart');
}
//Venues
if (isset($org_options['use_venue_manager']) && $org_options['use_venue_manager'] == 'Y' && $espresso_premium == true) {
add_submenu_page('event_espresso', __('Event Espresso - Venue Manager', 'event_espresso'), __('Venue Manager', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_venue_manager']), 'event_venues', 'event_espresso_venue_config_mnu');
//add_submenu_page('event_espresso', __('Event Espresso - Locales/Regions Manager','event_espresso'), __('Locale Manager','event_espresso'), 'administrator', 'event_locales', 'event_espresso_locale_config_mnu');
}
//Personnel
if (isset($org_options['use_personnel_manager']) && $org_options['use_personnel_manager'] == 'Y' && $espresso_premium == true) {
add_submenu_page('event_espresso', __('Event Espresso - Staff Manager', 'event_espresso'), __('Staff Manager', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_personnel_manager']), 'event_staff', 'event_espresso_staff_config_mnu');
}
//Form Questions
add_submenu_page('event_espresso', __('Event Espresso - Questions', 'event_espresso'), __('Questions', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_form_builder']), 'form_builder', 'event_espresso_questions_config_mnu');
//Questions Groups
add_submenu_page('event_espresso', __('Event Espresso - Question Groups', 'event_espresso'), __('Question Groups', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_form_groups']), 'form_groups', 'event_espresso_question_groups_config_mnu');
//EventCategories
add_submenu_page('event_espresso', __('Event Espresso - Manage Event Categories', 'event_espresso'), __('Categories', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_categories']), 'event_categories', 'event_espresso_categories_config_mnu');
do_action('action_hook_espresso_add_new_ee_submenu');
//Discounts
if (function_exists('event_espresso_discount_config_mnu') && $espresso_premium == true) {
add_submenu_page('event_espresso', __('Event Espresso - Promotional Codes', 'event_espresso'), __('Promotional Codes', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_discounts']), 'discounts', 'event_espresso_discount_config_mnu');
}
//Groupons
if (function_exists('event_espresso_groupon_config_mnu') && $espresso_premium == true) {
add_submenu_page('event_espresso', __('Groupons', 'event_espresso'), __('Groupon Codes', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_groupons']), 'groupons', 'event_espresso_groupon_config_mnu');
}
//Email Manager
if (function_exists('event_espresso_email_config_mnu') && $espresso_premium == true) {
add_submenu_page('event_espresso', __('Event Espresso - Email Manager', 'event_espresso'), __('Email Manager', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_event_emails']), 'event_emails', 'event_espresso_email_config_mnu');
}
//Event styles & templates
if (function_exists('event_espresso_manage_templates') && $espresso_premium == true) {
add_submenu_page('event_espresso', __('Event Espresso - Template Settings', 'event_espresso'), __('Template Settings', 'event_espresso'), 'administrator', 'template_confg', 'event_espresso_manage_templates');
}
//Calendar Settings
if (function_exists('espresso_calendar_config_mnu') && $espresso_premium == true) {
add_submenu_page('event_espresso', __('Event Espresso - Calendar Settings', 'event_espresso'), __('Calendar Settings', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_calendar']), 'espresso_calendar', 'espresso_calendar_config_mnu');
}
//Payment Settings
if (function_exists('event_espresso_gateways_options')) {
add_submenu_page('event_espresso', __('Event Espresso - Payment Settings', 'event_espresso'), __('Payment Settings', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_payment_gateways']), 'payment_gateways', 'event_espresso_gateways_options');
}
//Member Settings
if (function_exists('event_espresso_member_config_mnu') && $espresso_premium == true) {
add_submenu_page('event_espresso', __('Event Espresso - Member Settings', 'event_espresso'), __('Member Settings', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_members']), 'members', 'event_espresso_member_config_mnu');
}
//MailChimp Integration Settings
if (function_exists('event_espresso_mailchimp_settings') && $espresso_premium == true) {
add_submenu_page('event_espresso', __('Event Espresso - MailChimp Integration', 'event_espresso'), __('MailChimp Integration', 'event_espresso'), 'administrator', 'espresso-mailchimp', 'event_espresso_mailchimp_settings');
}
//Ticketing Settings
if (function_exists('espresso_ticket_config_mnu') && $espresso_premium == true) {
add_submenu_page('event_espresso', __('Event Espresso - Ticket Customization', 'event_espresso'), __('Ticket Templates', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_ticketing']), 'event_tickets', 'espresso_ticket_config_mnu');
}
//Facebook Event Integration Settings
if (function_exists('espresso_fb_settings') && $espresso_premium == true) {
add_submenu_page('event_espresso', __('Event Espresso - Facebook Settings', 'event_espresso'), __('Facebook Settings', 'event_espresso'), 'administrator', 'espresso_facebook', 'espresso_fb_settings');
}
//Reports
if (function_exists('espresso_reports') && $espresso_premium == true) {
add_submenu_page('event_espresso', __('Event Espresso - Reports', 'event_espresso'), __('Reports', 'event_espresso'), 'administrator', 'espresso_reports', 'espresso_reports');
}
//Attendee Import
if (function_exists('espresso_attendee_import') && $espresso_premium == true) {
add_submenu_page('event_espresso', __('Event Espresso - Attendee Import Tool', 'event_espresso'), __('Attendee Import', 'event_espresso'), 'administrator', 'espresso_attendee_import', 'espresso_attendee_import');
}
//Voucher Import
if (function_exists('espresso_voucher_import') && $espresso_premium == true) {
add_submenu_page('event_espresso', __('Event Espresso - Voucher Import Tool', 'event_espresso'), __('Voucher Import', 'event_espresso'), 'administrator', 'espresso_voucher_import', 'espresso_voucher_import');
}
//Social Media Settings
if (function_exists('espresso_social_config_mnu') && $espresso_premium == true) {
add_submenu_page('event_espresso', __('Event Espresso - Social Media Settings', 'event_espresso'), __('Social Media', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_social']), 'espresso_social', 'espresso_social_config_mnu');
}
//Addons
// add_submenu_page('event_espresso', __('Event Espresso - Addons', 'event_espresso'), __('Addons', 'event_espresso'), 'administrator', 'admin_addons', 'event_espresso_addons_mnu');
//Test Drive Pro
if ($espresso_premium != true) {
add_submenu_page('event_espresso', __('Event Espresso - Test Drive Pro', 'event_espresso'), __('Test Drive Pro', 'event_espresso'), 'administrator', 'test_drive', 'event_espresso_test_drive');
}
//Help/Support
add_submenu_page('event_espresso', __('Event Espresso - Help/Support', 'event_espresso'), __('<span style="color: red;">Help/Support</span>', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_support']), 'support', 'event_espresso_support');
add_submenu_page('events', __('Event Espresso - Permissions Settings', 'event_espresso'), '<span class="ee_menu_group" onclick="return false;">' . __('Permissions', 'event_espresso') . '</span>', 'administrator', 'espresso_permissions', 'espresso_permissions_config_mnu');
//Permissions settings
if (function_exists('espresso_manager_version') && $espresso_premium == true) {
add_submenu_page('event_espresso', __('Event Espresso - Event Manager Permissions', 'event_espresso'), __('User Permissions', 'event_espresso'), 'administrator', 'espresso_permissions', 'espresso_permissions_config_mnu');
add_submenu_page('event_espresso', __('Event Espresso - Event Manager Roles', 'event_espresso'), __('User Roles', 'event_espresso'), 'administrator', 'roles', 'espresso_permissions_roles_mnu');
if ($org_options['use_venue_manager'] == 'Y' && function_exists('espresso_permissions_user_groups')) {
if (espresso_member_data('role') == "administrator") {
add_submenu_page('event_espresso', __('Event Espresso - Locales/Regions', 'event_espresso'), __('Locales/Regions', 'event_espresso'), apply_filters('espresso_management_capability', 'administrator', $espresso_manager['espresso_manager_venue_manager']), 'event_locales', 'event_espresso_locale_config_mnu');
}
add_submenu_page('event_espresso', __('Event Espresso - Regional Managers', 'event_espresso'), __('Regional Managers', 'event_espresso'), 'administrator', 'event_groups', 'espresso_permissions_user_groups');
}
}
}
示例5: espresso_edit_this
function espresso_edit_this($event_id)
{
global $espresso_premium;
if ($espresso_premium != true) {
return;
}
global $current_user;
wp_get_current_user();
$curauth = wp_get_current_user();
$user_id = $curauth->ID;
$user = new WP_User($user_id);
foreach ($user->roles as $role) {
//echo $role;
//Build the edit event link
$edit_link = '<a class="post-edit-link" href="' . site_url() . '/wp-admin/admin.php?page=events&action=edit&event_id=' . $event_id . '">' . __('Edit Event') . '</a>';
switch ($role) {
case 'administrator':
case 'espresso_event_admin':
case 'espresso_event_manager':
case 'espresso_group_admin':
//If user is an event manager, then show the edit link for their events
if (function_exists('espresso_member_data') && espresso_member_data('role') == 'espresso_eventmanager' && espresso_member_data('id') != espresso_is_my_event($event_id)) {
return;
}
return $edit_link;
break;
}
}
}
示例6: event_espresso_staff_config_mnu
//.........这里部分代码省略.........
<table id="table" class="widefat manage-discounts">
<thead>
<tr>
<th class="manage-column column-cb check-column" id="cb" scope="col" style="width:2.5%;"><input type="checkbox"></th>
<th class="manage-column column-comments num" id="id" style="padding-top:7px; width:2.5%;" scope="col" title="Click to Sort"><?php
_e('ID', 'event_espresso');
?>
</th>
<th class="manage-column column-title" id="name" scope="col" title="Click to Sort" style="width:20%;"><?php
_e('Name', 'event_espresso');
?>
</th>
<?php
if (function_exists('espresso_is_admin') && espresso_is_admin() == true) {
?>
<th class="manage-column column-creator" id="creator" scope="col" title="Click to Sort" style="width:10%;"><?php
_e('Creator', 'event_espresso');
?>
</th>
<?php
}
?>
<th class="manage-column column-author" id="start" scope="col" title="Click to Sort" style="width:20%;"><?php
_e('Shortcode', 'event_espresso');
?>
</th>
</tr>
</thead>
<tbody>
<?php
$limitstaff = false;
global $espresso_manager;
if (function_exists('espresso_member_data')) {
if (function_exists('espresso_member_data') && espresso_member_data('role') == 'espresso_group_admin') {
if ($espresso_manager['event_manager_staff'] == "Y") {
$limitstaff = true;
}
} else {
if (function_exists('espresso_member_data') && espresso_member_data('role') == 'espresso_event_manager') {
$limitstaff = true;
}
}
}
$sql = "SELECT * FROM " . EVENTS_PERSONNEL_TABLE . " p";
if ($limitstaff) {
$sql .= " JOIN {$wpdb->users} u on u.ID = p.wp_user WHERE p.wp_user = " . $current_user->ID;
}
$wpdb->query($sql);
if ($wpdb->num_rows > 0) {
$results = $wpdb->get_results($sql . " ORDER BY p.id ASC");
foreach ($results as $result) {
$staff_id = $result->id;
$name = isset($result->name) ? stripslashes_deep($result->name) : '';
$staff_desc = isset($result->staff_desc) ? stripslashes_deep($result->staff_desc) : '';
$wp_user = isset($result->wp_user) ? $result->wp_user : '';
?>
<tr>
<td class="check-column" style="padding:7px 0 22px 5px; vertical-align:top;"><input name="checkbox[<?php
echo $staff_id;
?>
]" type="checkbox" title="Delete <?php
echo stripslashes($name);
?>
"></td>
<td class="column-comments" style="padding-top:3px;"><?php
示例7: espresso_generate_events_page_list_table_sql
/**
* espresso_get_events_page_list_table_results
*
* @access public
* @param boolean $count whether this query will return field data or COUNT events or SUM attendee quantity
* @param boolean $attendees whether this query will return data from the events table or the attendee table
* @param string $filters whether a particular filter is active or not; mostly used in conjunction with the $count parameter ie: COUNT events this_month
* @param mixed boolean | array $group_admin_locales array og R&P member group IDs or FALSE if not used
* @return string
*/
function espresso_generate_events_page_list_table_sql($count = FALSE, $attendees = FALSE, $filters = '', $group_admin_locales = FALSE)
{
global $org_options, $espresso_premium;
if (!$group_admin_locales) {
$member_id = FALSE;
}
$max_rows = isset($_REQUEST['max_rows']) & !empty($_REQUEST['max_rows']) ? absint($_REQUEST['max_rows']) : 50;
$max_rows = min($max_rows, 100000);
$start_rec = isset($_REQUEST['start_rec']) && !empty($_REQUEST['start_rec']) ? absint($_REQUEST['start_rec']) : 0;
$records_to_show = ' LIMIT ' . $max_rows . ' OFFSET ' . $start_rec;
//Dates
$curdate = date('Y-m-d');
$this_year_r = date('Y');
$this_month_r = date('m');
$days_this_month = date('t', strtotime($curdate));
// event date filters
$month_range = isset($_REQUEST['month_range']) && !empty($_REQUEST['month_range']) ? sanitize_text_field($_REQUEST['month_range']) : FALSE;
$this_month_filter = isset($_REQUEST['this_month']) && $_REQUEST['this_month'] == 'true' ? TRUE : FALSE;
$today_filter = isset($_REQUEST['today']) && $_REQUEST['today'] == 'true' ? TRUE : FALSE;
// attendee date filters
$this_month_filter = isset($_REQUEST['this_month_a']) && $_REQUEST['this_month_a'] == 'true' ? TRUE : $this_month_filter;
$today_filter = isset($_REQUEST['today_a']) && $_REQUEST['today_a'] == 'true' ? TRUE : $today_filter;
// toggle filters based on value passed from "count functions" (date filters)
switch ($filters) {
case 'this_month':
$month_range = FALSE;
$this_month_filter = TRUE;
$today_filter = FALSE;
break;
case 'today':
$month_range = FALSE;
$this_month_filter = FALSE;
$today_filter = TRUE;
break;
case 'none':
$month_range = FALSE;
$this_month_filter = FALSE;
$today_filter = FALSE;
break;
}
$event_id = isset($_REQUEST['event_id']) && $_REQUEST['event_id'] != '' ? absint($_REQUEST['event_id']) : FALSE;
$category_id = isset($_REQUEST['category_id']) && !empty($_REQUEST['category_id']) ? absint($_REQUEST['category_id']) : FALSE;
$event_status = isset($_REQUEST['event_status']) && !empty($_REQUEST['event_status']) ? sanitize_text_field($_REQUEST['event_status']) : FALSE;
$payment_status = isset($_REQUEST['payment_status']) ? wp_strip_all_tags($_REQUEST['payment_status']) : FALSE;
if ($month_range) {
$pieces = explode('-', $month_range, 3);
$year_r = $pieces[0];
$month_r = $pieces[1];
}
//Check if the venue manager is turned on
$use_venue_manager = isset($org_options['use_venue_manager']) && $org_options['use_venue_manager'] == 'Y' ? TRUE : FALSE;
$SQL = '';
$close_union = FALSE;
//Roles & Permissions
//This checks to see if the user is a regional manager and creates a union to join the events that are in the users region based on the venue/locale combination
if (!$group_admin_locales && function_exists('espresso_member_data') && current_user_can('espresso_group_admin') && !current_user_can('administrator')) {
$member_id = espresso_member_data('id');
$group_admin_locales = get_user_meta($member_id, 'espresso_group', TRUE);
$group_admin_locales = is_array($group_admin_locales) ? implode(',', $group_admin_locales) : FALSE;
if ($group_admin_locales) {
$SQL .= '( ';
$SQL .= espresso_generate_events_page_list_table_sql($count, $attendees, $filters, $group_admin_locales);
$SQL .= ' ) UNION ( ';
$close_union = TRUE;
}
}
//If this is an event manager
$event_manager = function_exists('espresso_member_data') && (current_user_can('espresso_event_manager') && !current_user_can('administrator')) ? true : false;
$event_admin = function_exists('espresso_member_data') && current_user_can('espresso_event_admin') ? true : false;
$SQL .= 'SELECT ';
if ($count && $attendees) {
// count attendees
$SQL .= 'SUM(a.quantity) quantity';
} else {
if (!$count && $attendees) {
// get attendees
$SQL .= 'a.*, e.id event_id, e.event_name, checked_in';
} else {
if ($count && !$attendees) {
// count events
$SQL .= 'COUNT(e.id) events';
//, t.start_time
} else {
if (!$count && !$attendees) {
// get events
$SQL .= 'e.id event_id, e.event_name, e.event_identifier, e.registration_start, e.registration_startT, e.registration_end, e.registration_endT, e.start_date, e.end_date, e.is_active, e.recurrence_id, e.wp_user, e.event_status, e.reg_limit';
//, t.start_time
}
}
}
//.........这里部分代码省略.........
示例8: add_event_to_db
function add_event_to_db($recurrence_arr = array())
{
global $wpdb, $org_options, $current_user, $espresso_premium;
//Security check using nonce
if (empty($_POST['nonce_verify_insert_event']) || !wp_verify_nonce($_POST['nonce_verify_insert_event'], 'espresso_verify_insert_event_nonce')) {
if (!isset($recurrence_arr['bypass_nonce'])) {
print '<h3 class="error">' . __('Sorry, there was a security error and your event was not saved.', 'event_espresso') . '</h3>';
return;
}
}
//Set FEM to false
$use_fem = FALSE;
$is_espresso_event_manager = false;
//If using FEM
if (isset($_REQUEST['ee_fem_action']) && $_REQUEST['ee_fem_action'] == 'ee_fem_add') {
$use_fem = TRUE;
if (function_exists('espresso_member_data') && espresso_member_data('role') == 'espresso_event_manager') {
global $espresso_manager;
$event_manager_approval = isset($espresso_manager['event_manager_approval']) && $espresso_manager['event_manager_approval'] == 'Y' ? true : false;
$is_espresso_event_manager = TRUE;
}
}
//Don't show sql errors if using the FEM
if ($use_fem === FALSE) {
$wpdb->show_errors();
}
static $recurrence_id = null;
if (defined('EVENT_ESPRESSO_RECURRENCE_TABLE')) {
require_once EVENT_ESPRESSO_RECURRENCE_FULL_PATH . "functions/re_functions.php";
$recurrence_id = array_key_exists('recurrence_id', $recurrence_arr) ? $recurrence_arr['recurrence_id'] : Null;
if ($_POST['recurrence'] == 'Y' && count($recurrence_arr) < 2) {
if (is_null($recurrence_id)) {
$recurrence_id = add_recurrence_master_record();
}
$re_params = array('start_date' => $_POST['recurrence_type'] == 'a' ? sanitize_text_field($_POST['recurrence_start_date']) : sanitize_text_field($_POST['recurrence_manual_dates']), 'event_end_date' => $_POST['recurrence_type'] == 'a' ? sanitize_text_field($_POST['recurrence_event_end_date']) : sanitize_text_field($_POST['recurrence_manual_end_dates']), 'end_date' => $_POST['recurrence_type'] == 'a' ? sanitize_text_field($_POST['recurrence_end_date']) : sanitize_text_field($_POST['end_date']), 'registration_start' => sanitize_text_field($_POST['recurrence_regis_start_date']), 'registration_end' => sanitize_text_field($_POST['recurrence_regis_end_date']), 'frequency' => sanitize_text_field($_POST['recurrence_frequency']), 'interval' => sanitize_text_field($_POST['recurrence_interval']), 'type' => sanitize_text_field($_POST['recurrence_type']), 'weekdays' => isset($_POST['recurrence_weekday']) ? $_POST['recurrence_weekday'] : '', 'repeat_by' => $_POST['recurrence_repeat_by'], 'recurrence_regis_date_increment' => $_POST['recurrence_regis_date_increment'], 'recurrence_manual_dates' => $_POST['recurrence_manual_dates'], 'recurrence_manual_end_dates' => $_POST['recurrence_manual_end_dates'], 'recurrence_id' => $recurrence_id, 'adding_to_db' => 'Y');
$recurrence_dates = $_POST['recurrence_type'] == 'm' ? find_recurrence_manual_dates($re_params) : find_recurrence_dates($re_params);
}
}
//echo_f('re array', $recurrence_dates);
if (defined('EVENT_ESPRESSO_RECURRENCE_MODULE_ACTIVE') && $_POST['recurrence'] == 'Y' && count($recurrence_arr) == 0) {
//skip the first insert because we do not have the start dates
} else {
$event_meta = array();
//will be used to hold event meta data
//Filters the event description based on user level
$user_access = apply_filters('filter_hook_espresso_event_unfiltered_description', current_user_can('administrator'));
$_REQUEST['event_desc'] = is_admin() || $user_access ? $_REQUEST['event_desc'] : apply_filters('filter_hook_espresso_event_wp_kses_post_description', wp_kses_post($_REQUEST['event_desc']));
$event_code = uniqid($current_user->ID . '-');
$event_name = !empty($_REQUEST['event']) ? sanitize_text_field($_REQUEST['event']) : $event_code;
if (!isset($_REQUEST['event_identifier']) || $_REQUEST['event_identifier'] == '') {
$event_identifier = sanitize_title_with_dashes($event_name . '-' . $event_code);
} else {
$event_identifier = sanitize_title_with_dashes($_REQUEST['event_identifier']) . $event_code;
}
$event_desc = !empty($_REQUEST['event_desc']) ? $_REQUEST['event_desc'] : '';
$display_desc = !empty($_REQUEST['display_desc']) ? sanitize_text_field($_REQUEST['display_desc']) : 'Y';
$display_reg_form = !empty($_REQUEST['display_reg_form']) ? sanitize_text_field($_REQUEST['display_reg_form']) : 'Y';
$externalURL = isset($_REQUEST['externalURL']) ? sanitize_text_field($_REQUEST['externalURL']) : '';
$post_type = !empty($_REQUEST['espresso_post_type']) ? sanitize_text_field($_REQUEST['espresso_post_type']) : '';
$reg_limit = !empty($_REQUEST['reg_limit']) ? sanitize_text_field($_REQUEST['reg_limit']) : '999999';
$_REQUEST['reg_limit'] = $reg_limit;
$allow_multiple = !empty($_REQUEST['allow_multiple']) ? sanitize_text_field($_REQUEST['allow_multiple']) : 'N';
$additional_limit = !empty($_REQUEST['additional_limit']) && $_REQUEST['additional_limit'] > 0 ? sanitize_text_field($_REQUEST['additional_limit']) : '5';
$_REQUEST['additional_limit'] = $additional_limit;
$member_only = !empty($_REQUEST['member_only']) ? sanitize_text_field($_REQUEST['member_only']) : 'N';
$is_active = !empty($_REQUEST['is_active']) ? sanitize_text_field($_REQUEST['is_active']) : 'Y';
$event_status = !empty($_REQUEST['event_status']) ? sanitize_text_field($_REQUEST['event_status']) : 'A';
$use_coupon_code = !empty($_REQUEST['use_coupon_code']) ? sanitize_text_field($_REQUEST['use_coupon_code']) : 'N';
$ticket_id = empty($_REQUEST['ticket_id']) ? 0 : sanitize_text_field($_REQUEST['ticket_id']);
//Get the first instance of the start and end times
$start_time = !empty($_REQUEST['start_time'][0]) ? sanitize_text_field($_REQUEST['start_time'][0]) : '8:00 AM';
$_REQUEST['event_start_time'] = $start_time;
$end_time = !empty($_REQUEST['end_time'][0]) ? sanitize_text_field($_REQUEST['end_time'][0]) : '5:00 PM';
$_REQUEST['event_end_time'] = $end_time;
// Add Timezone
$timezone_string = isset($_REQUEST['timezone_string']) ? sanitize_text_field($_REQUEST['timezone_string']) : '';
//Early discounts
$early_disc = !empty($_REQUEST['early_disc']) ? sanitize_text_field($_REQUEST['early_disc']) : '';
$early_disc_date = !empty($_REQUEST['early_disc_date']) ? sanitize_text_field($_REQUEST['early_disc_date']) : '';
$early_disc_percentage = !empty($_REQUEST['early_disc_percentage']) ? sanitize_text_field($_REQUEST['early_disc_percentage']) : '';
//Alternate email address field
$alt_email = !empty($_REQUEST['alt_email']) ? sanitize_text_field($_REQUEST['alt_email']) : '';
//Send a custom emal
$send_mail = !empty($_REQUEST['send_mail']) ? sanitize_text_field($_REQUEST['send_mail']) : 'N';
//Custom email content
$conf_mail = !empty($_REQUEST['conf_mail']) ? esc_html($_REQUEST['conf_mail']) : '';
//Use a premade custom email
$email_id = isset($_REQUEST['email_name']) ? (int) $_REQUEST['email_name'] : '0';
//Venue Information
$venue_title = isset($_REQUEST['venue_title']) ? sanitize_text_field($_REQUEST['venue_title']) : '';
$venue_url = isset($_REQUEST['venue_url']) ? sanitize_text_field($_REQUEST['venue_url']) : '';
$venue_phone = isset($_REQUEST['venue_phone']) ? sanitize_text_field($_REQUEST['venue_phone']) : '';
$venue_image = isset($_REQUEST['venue_image']) ? sanitize_text_field($_REQUEST['venue_image']) : '';
//Virtual location
$virtual_url = !empty($_REQUEST['virtual_url']) ? sanitize_text_field($_REQUEST['virtual_url']) : '';
$virtual_phone = !empty($_REQUEST['virtual_phone']) ? sanitize_text_field($_REQUEST['virtual_phone']) : '';
//Address/venue information
$address = isset($_REQUEST['address']) ? sanitize_text_field($_REQUEST['address']) : '';
$address2 = isset($_REQUEST['address2']) ? sanitize_text_field($_REQUEST['address2']) : '';
$city = isset($_REQUEST['city']) ? sanitize_text_field($_REQUEST['city']) : '';
//.........这里部分代码省略.........
示例9: event_espresso_discount_config_mnu
function event_espresso_discount_config_mnu()
{
global $wpdb;
?>
<div class="wrap">
<div id="icon-options-event" class="icon32"> </div>
<h2><?php
echo _e('Manage Event Promotional Codes', 'event_espresso');
?>
<?php
if (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'edit' && $_REQUEST['action'] != 'new') {
echo '<a href="admin.php?page=discounts&action=new" class="button add-new-h2" style="margin-left: 20px;">' . __('Add New Code', 'event_espresso') . '</a>';
}
?>
</h2>
<?php
ob_start();
if (isset($_REQUEST['action'])) {
switch ($_REQUEST['action']) {
case 'add':
require_once "add_discount.php";
add_discount_to_db();
//Add the discount to the DB
break;
case 'new':
require_once "new_discount.php";
add_new_event_discount();
//Add new discount form
break;
case 'edit':
require_once "edit_discount.php";
edit_event_discount();
//Edit discount form
break;
case 'update':
require_once "update_discount.php";
update_event_discount();
//Update discount in DB
break;
case 'delete_discount':
require_once "delete_discount.php";
delete_event_discount();
//Delete discount in DB
break;
}
}
if (!empty($_REQUEST['delete_discount'])) {
//This is for the delete checkboxes
require_once "delete_discount.php";
delete_event_discount();
}
?>
<form id="form1" name="form1" method="post" action="<?php
echo $_SERVER["REQUEST_URI"];
?>
">
<table id="table" class="widefat manage-discounts">
<thead>
<tr>
<th class="manage-column column-cb check-column" id="cb" scope="col" style="width:2.5%;"><input type="checkbox"></th>
<th class="manage-column column-comments num" id="id" style="padding-top:7px; width:2.5%;" scope="col" title="Click to Sort"><?php
_e('ID', 'event_espresso');
?>
</th>
<th class="manage-column column-title" id="name" scope="col" title="Click to Sort" style="width:20%;"><?php
_e('Name', 'event_espresso');
?>
</th>
<?php
if (function_exists('espresso_is_admin') && espresso_is_admin() == true) {
?>
<th class="manage-column column-creator" id="creator" scope="col" title="Click to Sort" style="width:10%;"><?php
_e('Creator', 'event_espresso');
?>
</th>
<?php
}
?>
<th class="manage-column column-author" id="start" scope="col" title="Click to Sort" style="width:20%;"><?php
_e('Amount', 'event_espresso');
?>
</th>
<th class="manage-column column-date" id="begins" scope="col" title="Click to Sort" style="width:20%;"><?php
_e('Percentage', 'event_espresso');
?>
</th>
</tr>
</thead>
<tbody>
<?php
$sql = "SELECT * FROM " . EVENTS_DISCOUNT_CODES_TABLE;
if (function_exists('espresso_member_data') && (espresso_member_data('role') == 'espresso_event_manager' || espresso_member_data('role') == 'espresso_group_admin')) {
$sql .= " WHERE wp_user = '" . espresso_member_data('id') . "' ";
}
$event_discounts = $wpdb->get_results($sql);
if ($wpdb->num_rows > 0) {
foreach ($event_discounts as $event_discount) {
$discount_id = $event_discount->id;
//.........这里部分代码省略.........
示例10: event_espresso_venue_config_mnu
//.........这里部分代码省略.........
?>
</th>
<?php
if (function_exists('espresso_is_admin') && espresso_is_admin() == true && $espresso_premium == true) {
?>
<th class="manage-column column-creator" id="creator" scope="col" title="Click to Sort" style="width:20%;"><?php
_e('Locale', 'event_espresso');
?>
</th>
<?php
}
?>
<?php
if (function_exists('espresso_is_admin') && espresso_is_admin() == true && $espresso_premium == true) {
?>
<th class="manage-column column-creator" id="creator" scope="col" title="Click to Sort" style="width:20%;"><?php
_e('Creator', 'event_espresso');
?>
</th>
<?php
}
?>
<th class="manage-column column-author" id="start" scope="col" title="Click to Sort" style="width:20%;"><?php
_e('Shortcode', 'event_espresso');
?>
</th>
</tr>
</thead>
<tbody>
<?php
global $espresso_manager;
// If user is an event manager, then show only their venues
$sql = "( SELECT v.* FROM " . EVENTS_VENUE_TABLE . " v ";
if (function_exists('espresso_member_data') && espresso_member_data('role') == 'espresso_group_admin') {
if ($espresso_manager['event_manager_venue'] == "Y") {
// show only venues inside their assigned locales.
$group = get_user_meta(espresso_member_data('id'), "espresso_group", true);
$sql .= " LEFT JOIN " . EVENTS_LOCALE_REL_TABLE . " l ON l.venue_id = v.id ";
$sql .= " WHERE l.locale_id IN (" . implode(",", $group) . ")";
$sql .= ") UNION ( ";
$sql .= "SELECT v.* FROM " . EVENTS_VENUE_TABLE . " v ";
}
}
if (function_exists('espresso_member_data') && (espresso_member_data('role') == 'espresso_event_manager' || espresso_member_data('role') == 'espresso_group_admin')) {
$sql .= " WHERE v.wp_user = " . $current_user->ID;
}
$sql .= ")";
#echo $sql;
#exit("TEST");
$wpdb->query($sql);
if ($wpdb->num_rows > 0) {
$results = $wpdb->get_results($sql . " ORDER BY id ASC");
foreach ($results as $result) {
$venue_id = $result->id;
$name = isset($result->name) ? stripslashes_deep($result->name) : '';
$venue_desc = isset($result->venue_desc) ? stripslashes_deep($result->venue_desc) : '';
$wp_user = isset($result->wp_user) ? $result->wp_user : '';
?>
<tr>
<td class="check-column" style="padding:7px 0 22px 5px; vertical-align:top;"><input name="checkbox[<?php
echo $venue_id;
?>
]" type="checkbox" title="Delete <?php
echo stripslashes($name);
?>
"></td>
示例11: event_espresso_categories_config_mnu
//.........这里部分代码省略.........
<table id="table" class="widefat manage-categories">
<thead>
<tr>
<th class="manage-column column-cb check-column" id="cb" scope="col" style="width:2.5%;"><input type="checkbox"></th>
<th class="manage-column column-comments num" id="id" style="padding-top:7px; width:2.5%;" scope="col" title="Click to Sort"><?php
_e('ID', 'event_espresso');
?>
</th>
<th class="manage-column column-title" id="name" scope="col" title="Click to Sort" style="width:20%;"><?php
_e('Name', 'event_espresso');
?>
</th>
<?php
if (function_exists('espresso_is_admin') && espresso_is_admin() == true) {
?>
<th class="manage-column column-creator" id="creator" scope="col" title="Click to Sort" style="width:10%;"><?php
_e('Creator', 'event_espresso');
?>
</th>
<?php
}
?>
<th class="manage-column column-author" id="start" scope="col" title="Click to Sort" style="width:20%;"><?php
_e('Shortcode', 'event_espresso');
?>
</th>
</tr>
</thead>
<tbody>
<?php
$sql = "SELECT * FROM " . EVENTS_CATEGORY_TABLE . " c";
if (function_exists('espresso_member_data') && (espresso_member_data('role') == 'espresso_event_manager' || espresso_member_data('role') == 'espresso_group_admin')) {
$sql .= " JOIN {$wpdb->users} u on u.ID = c.wp_user WHERE c.wp_user = " . $current_user->ID;
}
$wpdb->query($sql);
if ($wpdb->num_rows > 0) {
$results = $wpdb->get_results($sql . " ORDER BY c.id ASC");
foreach ($results as $result) {
$category_id = $result->id;
$category_name = stripslashes($result->category_name);
$category_identifier = stripslashes($result->category_identifier);
$category_desc = stripslashes($result->category_desc);
$display_category_desc = stripslashes($result->display_desc);
$wp_user = $result->wp_user;
?>
<tr>
<td class="check-column" style="padding:7px 0 22px 5px; vertical-align:top;"><input name="checkbox[<?php
echo $category_id;
?>
]" type="checkbox" title="Delete <?php
echo stripslashes($category_name);
?>
"></td>
<td class="column-comments" style="padding-top:3px;"><?php
echo $category_id;
?>
</td>
<td class="post-title page-title column-title"><strong><a href="admin.php?page=event_categories&action=edit&id=<?php
echo $category_id;
?>
"><?php
echo $category_name;
?>
</a></strong>
示例12: espresso_event_question_groups
function espresso_event_question_groups($question_groups = array(), $add_attendee_question_groups = array(), $event_id = 0)
{
global $wpdb, $org_options, $espresso_premium;
?>
<div id="event-questions" class="postbox event-questions-lists">
<div class="handlediv" title="Click to toggle"><br />
</div>
<h3 class="hndle"><span>
<?php
echo sprintf(__('Event Questions for Primary Attendee', 'event_espresso'), '');
?>
</span></h3>
<div class="inside">
<p><strong>
<?php
_e('Question Groups', 'event_espresso');
?>
</strong><br />
<?php
_e('Add a pre-populated', 'event_espresso');
?>
<a href="admin.php?page=form_groups" target="_blank">
<?php
_e('group', 'event_espresso');
?>
</a>
<?php
_e('of', 'event_espresso');
?>
<a href="admin.php?page=form_builder" target="_blank">
<?php
_e('questions', 'event_espresso');
?>
</a>
<?php
_e('to your event. The personal information group is required for all events.', 'event_espresso');
?>
</p>
<?php
$g_limit = $espresso_premium != true ? 'LIMIT 0,2' : '';
$sql = "SELECT qg.* FROM " . EVENTS_QST_GROUP_TABLE . " qg JOIN " . EVENTS_QST_GROUP_REL_TABLE . " qgr ON qg.id = qgr.group_id ";
if (function_exists('espresso_member_data')) {
$wpdb->get_results("SELECT wp_user FROM " . EVENTS_DETAIL_TABLE . " WHERE id = '" . $event_id . "'");
$wp_user = $wpdb->last_result[0]->wp_user != '' ? $wpdb->last_result[0]->wp_user : espresso_member_data('id');
$sql .= " WHERE ";
if ($wp_user == 0 || $wp_user == 1) {
$sql .= " (wp_user = '0' OR wp_user = '1') ";
} else {
//$sql .= " wp_user = '" . $wp_user . "' ";
$sql .= " (wp_user = '" . $wp_user . "' OR wp_user = '0' OR wp_user = '1')";
}
} else {
$sql .= " WHERE wp_user = '0' OR wp_user = '1' ";
}
$sql .= " GROUP BY qg.id ORDER BY qg.group_order {$g_limit} ";
$q_groups = $wpdb->get_results($sql);
$num_rows = $wpdb->num_rows;
$html = '';
if ($num_rows > 0) {
foreach ($q_groups as $question_group) {
$question_group_id = $question_group->id;
$question_group_description = $question_group->group_description;
$group_name = $question_group->group_name;
//$checked = $question_group->system_group == 1 ? ' checked="checked" ' : '';
$checked = is_array($question_groups) && array_key_exists($question_group_id, $question_groups) || $question_group->system_group == 1 ? ' checked="checked" ' : '';
$visibility = $question_group->system_group == 1 ? 'style="visibility:hidden"' : '';
$group_id = isset($group_id) ? $group_id : '';
$html .= '<p id="event-question-group-' . $question_group_id . '"><input value="' . $question_group_id . '" type="checkbox" ' . $checked . $visibility . ' name="question_groups[' . $question_group_id . ']" ' . $checked . ' /> <a href="admin.php?page=form_groups&action=edit_group&group_id=' . $question_group_id . '" title="edit" target="_blank">' . $group_name . '</a></p>';
}
if ($num_rows > 10) {
$top_div = '<div style="height:250px;overflow:auto;">';
$bottom_div = '</div>';
} else {
$top_div = '';
$bottom_div = '';
}
$html = $top_div . $html . $bottom_div;
echo $html;
} else {
echo __('There seems to be a problem with your questions. Please contact support@eventespresso.com', 'event_espresso');
}
if ($espresso_premium != true) {
echo __('Need more questions?', 'event_espresso') . ' <a href="http://eventespresso.com/download/" target="_blank">' . __('Upgrade Now!', 'event_espresso') . '</a>';
}
?>
</div>
</div>
<?php
if ($espresso_premium == true) {
?>
<div id="event-questions-additional" class="postbox event-questions-lists">
<div class="handlediv" title="Click to toggle"><br>
</div>
<h3 class="hndle"><span>
<?php
_e('Event Questions for Additional Attendees', 'event_espresso');
?>
</span></h3>
<div class="inside">
<p><strong>
//.........这里部分代码省略.........
示例13: espresso_total_attendees_this_month
function espresso_total_attendees_this_month()
{
//Get total attendees this month
global $wpdb;
//Dates
$curdate = date("Y-m-d");
$pieces = explode('-', $curdate, 3);
$this_year_r = $pieces[0];
$this_month_r = $pieces[1];
$days_this_month = date('t', strtotime($curdate));
$asql3 = "(";
if (function_exists('espresso_member_data') && espresso_member_data('role') == 'espresso_group_admin') {
$group = get_user_meta(espresso_member_data('id'), "espresso_group", true);
$asql3 .= "SELECT SUM(a.quantity) quantity FROM " . EVENTS_ATTENDEE_TABLE . " a ";
$asql3 .= " LEFT JOIN " . EVENTS_DETAIL_TABLE . " e ON e.id=a.event_id ";
if (!empty($group)) {
$asql3 .= " JOIN " . EVENTS_VENUE_REL_TABLE . " r ON r.event_id = e.id ";
$asql3 .= " JOIN " . EVENTS_LOCALE_REL_TABLE . " l ON l.venue_id = r.venue_id ";
}
$asql3 .= " WHERE date BETWEEN '" . event_espresso_no_format_date($this_year_r . '-' . $this_month_r . '-01', $format = 'Y-m-d') . "' AND '" . event_espresso_no_format_date($this_year_r . '-' . $this_month_r . '-' . $days_this_month, $format = 'Y-m-d') . "' ";
$asql3 .= !empty($group) ? " AND l.locale_id IN (" . implode(",", $group) . ") " : '';
$asql3 .= " AND a.quantity >= 1 ";
//AND (a.payment_status='Completed' OR a.payment_status='Pending') ";
$asql3 .= " AND e.event_status != 'D' ";
$asql3 .= ") UNION (";
}
$asql3 .= "SELECT SUM(a.quantity) quantity FROM " . EVENTS_ATTENDEE_TABLE . " a ";
$asql3 .= " LEFT JOIN " . EVENTS_DETAIL_TABLE . " e ON e.id=a.event_id ";
$asql3 .= " WHERE a.date BETWEEN '" . event_espresso_no_format_date($this_year_r . '-' . $this_month_r . '-01', $format = 'Y-m-d') . "' AND '" . event_espresso_no_format_date($this_year_r . '-' . $this_month_r . '-' . $days_this_month, $format = 'Y-m-d') . "' ";
if (function_exists('espresso_member_data') && (espresso_member_data('role') == 'espresso_event_manager' || espresso_member_data('role') == 'espresso_group_admin')) {
$asql3 .= " AND e.wp_user = '" . espresso_member_data('id') . "' ";
}
$asql3 .= " AND a.quantity >= 1 ";
//AND (a.payment_status='Completed' OR a.payment_status='Pending') ";
$asql3 .= " AND e.event_status != 'D' ";
$asql3 .= ")";
//echo $asql3;
$total_a_this_month = 0;
$wpdb->query($asql3);
if ($wpdb->num_rows > 0 && $wpdb->last_result[0]->quantity != NULL) {
$total_a_this_month = $wpdb->last_result[0]->quantity + (isset($wpdb->last_result[1]->quantity) ? $wpdb->last_result[1]->quantity : 0);
}
return $total_a_this_month;
}
示例14: event_espresso_form_group_new
function event_espresso_form_group_new()
{
global $wpdb;
?>
<div id="add-edit-new-group" class="metabox-holder">
<div class="postbox">
<div title="Click to toggle" class="handlediv"><br /></div>
<h3 class="hndle"><?php
_e('Add New Group', 'event_espresso');
?>
</h3>
<div class="inside">
<form id="add-new-group" name="newgroup" method="post" action="<?php
echo $_SERVER["REQUEST_URI"];
?>
">
<p class="intro"><?php
_e('Add new group using the form below.', 'event_espresso');
?>
</p>
<table id="table-add-group" class="ee-tables" border="0">
<tr>
<td class="a" valign="top">
<fieldset id="general-group-info">
<legend><?php
_e('Group Information', 'event_espresso');
?>
</legend>
<ul>
<li>
<label for="group_name"><?php
_e('Group Name:', 'event_espresso');
?>
<em title="<?php
_e('This field is required', 'event_espresso');
?>
"> *</em></label>
<input class="group-name" name="group_name" id="group_name" size="50" value="" type="text" />
</li>
<li>
<label for="group_order"><?php
_e('Group Order:', 'event_espresso');
?>
</label>
<input name="group_order" id="group_order" size="6" value="" type="text" />
</li>
<li>
<label for="group_description"><?php
_e('Description:', 'event_espresso');
?>
</label>
<textarea name="group_description" cols="40" rows="5"></textarea>
</li>
<li>
<label for="show_group_name"><?php
_e('Show group name on registration page?', 'event_espresso');
?>
</label>
<input type="checkbox" name="show_group_name" id="show_group_name" value="1" checked="checked" />
</li>
<li>
<label for="show_group_description"><?php
_e('Show group description on registration page?', 'event_espresso');
?>
</label>
<input type="checkbox" name="show_group_description" id="show_group_description" value="1" checked="checked" />
</li>
</ul>
</fieldset>
</td>
<td class="b" valign="top">
<fieldset id="questions-for-group">
<legend><?php
_e('Add questions', 'event_espresso');
?>
</legend>
<ul id="add-quest">
<li><p><?php
_e('Select questions to add to group:', 'event_espresso');
?>
</p></li>
<?php
$sql = "SELECT * FROM " . EVENTS_QUESTION_TABLE;
$sql .= " WHERE ";
if (function_exists('espresso_member_data')) {
if (espresso_member_data('id') == 0 || espresso_member_data('id') == 1) {
$sql .= " (wp_user = '0' OR wp_user = '1') ";
} else {
$sql .= " wp_user = '" . espresso_member_data('id') . "' ";
}
} else {
$sql .= " (wp_user = '0' OR wp_user = '1') ";
}
$sql .= " ORDER BY sequence, id ASC ";
//.........这里部分代码省略.........
示例15: event_espresso_questions_config_mnu
function event_espresso_questions_config_mnu()
{
global $wpdb;
//Update the questions when re-ordering
if (!empty($_REQUEST['update_sequence'])) {
$rows = explode(",", $_POST['row_ids']);
for ($i = 0; $i < count($rows); $i++) {
$wpdb->query("UPDATE " . EVENTS_QUESTION_TABLE . " SET sequence=" . $i . " WHERE id='" . $rows[$i] . "'");
}
die;
}
// get counts
$sql = "SELECT id FROM " . EVENTS_QUESTION_TABLE;
$wpdb->get_results($sql);
$total_questions = $wpdb->num_rows;
if (function_exists('espresso_is_admin') && espresso_is_admin() == true) {
$sql .= " WHERE ";
if (espresso_member_data('id') == 0 || espresso_member_data('id') == 1) {
$sql .= " (wp_user = '0' OR wp_user = '1') ";
} else {
$sql .= " wp_user = '" . espresso_member_data('id') . "' ";
}
}
$wpdb->get_results($sql);
$total_self_questions = $wpdb->num_rows;
?>
<div class="wrap">
<div id="icon-options-event" class="icon32"> </div>
<h2><?php
echo _e('Manage Questions', 'event_espresso');
?>
<?php
if (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'edit_question' && $_REQUEST['action'] != 'new_question') {
echo '<a href="admin.php?page=form_builder&action=new_question" class="button add-new-h2" style="margin-left: 20px;">' . __('Add New Question', 'event_espresso') . '</a>';
}
?>
</h2>
<div id="poststuff" class="metabox-holder has-right-sidebar">
<?php
event_espresso_display_right_column();
?>
<div id="post-body">
<?php
if (function_exists('espresso_is_admin') && espresso_is_admin() == true) {
?>
<div style="margin-bottom: 10px;">
<ul class="subsubsub" style="margin-bottom: 0;clear:both;">
<li><strong><?php
_e('Questions', 'event_espresso');
?>
: </strong> </li>
<li><a <?php
echo !isset($_REQUEST['self']) && !isset($_REQUEST['all']) || isset($_REQUEST['self']) && $_REQUEST['self'] == 'true' ? ' class="current" ' : '';
?>
href="admin.php?page=form_builder&self=true"><?php
_e('My Questions', 'event_espresso');
?>
<span class="count">(<?php
echo $total_self_questions;
?>
)</span> </a> | </li>
<li><a <?php
echo isset($_REQUEST['all']) && $_REQUEST['all'] == 'true' ? ' class="current" ' : '';
?>
href="admin.php?page=form_builder&all=true"><?php
_e('All Questions', 'event_espresso');
?>
<span class="count">(<?php
echo $total_questions;
?>
)</span> </a></li>
</ul>
<div class="clear"></div>
</div>
<?php
}
?>
<div id="post-body-content">
<div class="meta-box-sortables ui-sortables">
<?php
//Update the question
if (isset($_REQUEST['edit_action']) && $_REQUEST['edit_action'] == 'update') {
require_once "questions/update_question.php";
event_espresso_form_builder_update();
}
//Figure out which view to display
if (isset($_REQUEST['action'])) {
switch ($_REQUEST['action']) {
case 'insert':
if (file_exists(EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/form-builder/questions/insert_question.php')) {
require_once EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/form-builder/questions/insert_question.php';
event_espresso_form_builder_insert();
} else {
require_once EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/pricing_table.php';
}
break;
case 'new_question':
//.........这里部分代码省略.........