Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example of how to add additional registration counts to to the event publish metabox
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_action('AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add', 'tw_ee_add_total_reg_count_to_event_publish_metabox', 20, 1);
function tw_ee_add_total_reg_count_to_event_publish_metabox( $cpt_model_obj ) {
//Sanity check to confirm we have an EE event object.
if( !$cpt_model_obj instanceof EE_Event ) {
return;
}
$view_all_reg_link = EEH_HTML::link(
add_query_arg(
array(
'route' => 'default',
//'_reg_status' => EEM_Registration::status_id_cancelled,
'event_id' => $cpt_model_obj->ID(),
),
REG_ADMIN_URL
),
esc_html__('View All Registrations', 'event_espresso'),
esc_html__('View all registrations for this event', 'event_espresso')
);
$view_all_link_html = EEH_HTML::span(
'',
'',
'dashicons dashicons-groups ee-icon-size-20'
);
$view_all_link_html .= ' ' . $view_all_reg_link . ' : ';
$view_all_link_html .= $cpt_model_obj->count_related(
'Registration',
array(
array(
'REG_deleted' => 0,
//'STS_ID' => EEM_Registration::status_id_cancelled,
),
)
);
echo EEH_HTML::div(
$view_all_link_html,
'',
'misc-pub-section'
);
}
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_action('AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add', 'tw_ee_add_cancelled_reg_count_to_event_publish_metabox', 10, 1);
function tw_ee_add_cancelled_reg_count_to_event_publish_metabox( $cpt_model_obj ) {
//Sanity check to confirm we have an EE event object.
if( !$cpt_model_obj instanceof EE_Event ) {
return;
}
$view_cancelled_reg_link = EEH_HTML::link(
add_query_arg(
array(
'route' => 'default',
'_reg_status' => EEM_Registration::status_id_cancelled,
'event_id' => $cpt_model_obj->ID(),
),
REG_ADMIN_URL
),
esc_html__('Cancelled Registrations', 'event_espresso'),
esc_html__('View cancelled registrations for this event', 'event_espresso')
);
$view_cancelled_link_html = EEH_HTML::span(
'',
'',
'dashicons dashicons-groups ee-icon-color-ee-grey ee-icon-size-20'
);
$view_cancelled_link_html .= ' ' . $view_cancelled_reg_link . ' : ';
$view_cancelled_link_html .= $cpt_model_obj->count_related(
'Registration',
array(
array(
'REG_deleted' => 0,
'STS_ID' => EEM_Registration::status_id_cancelled,
),
)
);
echo EEH_HTML::div(
$view_cancelled_link_html,
'',
'misc-pub-section'
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.