403]);
}
function ticketdrum_display_custom_field_admin($form_id,$form_editor_wrapper_id,$formdata_input_id)
{
?>
$form_id,
'wrapper' => $form_editor_wrapper_id,
'input' => $formdata_input_id,
]).'); });');
?>
get_file_data(dirname(__DIR__).'/ticketdrum.php',['Version'=>'Version'])['Version'].' (db '.TICKETDRUM_DB_VERSION.')',
'WordPress' => $wp_version.(is_multisite()?' (multisite)':''),
'PHP' => PHP_VERSION,
'MySQL' => $wpdb->db_version(),
'Theme' => $theme->get('Name').' '.$theme->get('Version'),
'Server' => sanitize_text_field(wp_unslash($_SERVER['SERVER_SOFTWARE'] ?? 'unknown')),
'GD extension' => function_exists('imagecreatetruecolor')?'yes':'no (QR ticket PDFs need it)',
'Site connected' => $connected?'yes':'no',
'Account ID' => $connected?get_option('ticketdrum_account_id'):'not connected',
'Stripe mode' => $ticketdrum_stripe_mode,
'Stripe live' => $stripe_live?'linked':'not linked',
'Stripe test' => $stripe_test?'linked':'not linked',
'Currency' => get_option('ticketdrum_currency','usd'),
'Tax mode' => get_option('ticketdrum_tax_mode','none'),
'Events' => (int)$wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM %i",TICKETDRUM_EVENTS_TABLE)),
'Orders' => (int)$wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM %i",TICKETDRUM_PURCHASES_TABLE)),
'WP_DEBUG' => (defined('WP_DEBUG') && WP_DEBUG)?'on':'off',
];
$report = '';
foreach ($lines as $label=>$value)
$report.= str_pad($label,16).': '.$value."\n";
return $report;
}
function ticketdrum_system_info_panel()
{
$report = ticketdrum_system_info_report();
if ($report=='') return;
?>
get_var($wpdb->prepare("SELECT COUNT(*) FROM %i",TICKETDRUM_EVENTS_TABLE))>0;
$on_a_page = (int)$wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_status='publish' AND (post_content LIKE '%wp:ticketdrum/display%' OR post_content LIKE '%[ticketdrum%')")>0;
if ($stripe_connected && $has_event && $on_a_page)
{
update_option('ticketdrum_onboarding_dismissed',1); //All done - never show again
return;
}
$step = function($done,$label,$url){
return ''.($done?'✓ '.$label.'':'☐ '.$label.'').'';
};
$onboarding_html = '
'.
/* translators: the tags wrap the heading */
__('Get started with TicketDrum - three steps to your first ticket sale:','ticketdrum').'
'.
$step($stripe_connected,esc_html__('Connect your Stripe account (this is how you get paid)','ticketdrum'),admin_url('admin.php?page=ticketdrum_settings&tab=stripe')).
$step($has_event,esc_html__('Create your first event and add tickets to it','ticketdrum'),admin_url('admin.php?page=ticketdrum_events&action=add')).
$step($on_a_page,esc_html__('Add the TicketDrum block to a page so people can buy','ticketdrum'),admin_url('post-new.php?post_type=page')).
'
'.esc_html__('Dismiss this checklist','ticketdrum').'
';
echo wp_kses_post($onboarding_html);
}
add_action('admin_notices','ticketdrum_onboarding_notice');
//One review request, once the plugin has proved itself: after the first door check-in or the
//fifth order. TicketDrum screens only, never while the onboarding checklist is still up, and
//either link retires it for good.
function ticketdrum_review_notice()
{
global $wpdb;
$screen_page = sanitize_key(wp_unslash($_GET['page'] ?? ''));
if (strpos($screen_page,'ticketdrum')!==0) return;
if (!current_user_can('manage_options')) return;
if (get_option('ticketdrum_review_notice_done')) return;
if (ticketdrum_is_connected() && !get_option('ticketdrum_onboarding_dismissed')) return;
$checked_in = (int)$wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM %i WHERE checkins NOT IN ('','[]')",TICKETDRUM_PURCHASES_TABLE))>0;
$orders = (int)$wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM %i WHERE status='paid'",TICKETDRUM_PURCHASES_TABLE));
if (!$checked_in && $orders<5) return;
$review_url = wp_nonce_url(add_query_arg('ticketdrum_review_notice','review'),'ticketdrum_review_notice');
$dismiss_url = wp_nonce_url(add_query_arg('ticketdrum_review_notice','dismiss'),'ticketdrum_review_notice');
?>