LLMS_Admin_Events_Promo
LLMS_Admin_Events_Promo class.
Contents
Source Source
File: includes/admin/class-llms-admin-events-promo.php
class LLMS_Admin_Events_Promo {
/**
* Constructor.
*
* @since 7.8.0
*/
public function __construct() {
// Only show promo if the events plugin is not active.
if ( class_exists( 'LLMS_Events_Plugin' ) ) {
return;
}
add_filter( 'llms_metabox_fields_lifterlms_course_options', array( $this, 'add_course_promo_tab' ) );
add_filter( 'llms_metabox_fields_lifterlms_membership', array( $this, 'add_membership_promo_tab' ) );
add_filter( 'llms_metabox_fields_lifterlms_lesson', array( $this, 'add_lesson_promo_tab' ) );
}
/**
* Add an Events promo tab to Course Options.
*
* @since 7.8.0
*
* @param array $tabs Existing tabs.
* @return array
*/
public function add_course_promo_tab( $tabs ) {
$tabs[] = array(
'title' => __( 'Events', 'lifterlms' ),
'fields' => array(
array(
'id' => '_llms_events_promo',
'type' => 'custom-html',
'label' => '',
'value' => $this->get_promo_html(),
),
),
);
return $tabs;
}
/**
* Add an Events promo tab to Membership.
*
* @since 7.8.0
*
* @param array $tabs Existing tabs.
* @return array
*/
public function add_membership_promo_tab( $tabs ) {
$tabs[] = array(
'title' => __( 'Events', 'lifterlms' ),
'fields' => array(
array(
'id' => '_llms_events_promo',
'type' => 'custom-html',
'label' => '',
'value' => $this->get_promo_html(),
),
),
);
return $tabs;
}
/**
* Add an Events promo tab to Lesson Settings.
*
* @since 7.8.0
*
* @param array $tabs Existing tabs.
* @return array
*/
public function add_lesson_promo_tab( $tabs ) {
$tabs[] = array(
'title' => __( 'Events', 'lifterlms' ),
'fields' => array(
array(
'id' => '_llms_events_promo',
'type' => 'custom-html',
'label' => '',
'value' => $this->get_promo_html(),
),
),
);
return $tabs;
}
/**
* Get the promo HTML.
*
* @since 7.8.0
*
* @return string
*/
private function get_promo_html() {
$html = '<div class="llms-metabox" style="padding:20px;text-align:center;">';
$html .= '<div class="dashicons dashicons-calendar-alt" style="color:#2271b1;margin-bottom:12px;"></div>';
$html .= '<h3>' . esc_html__( 'Schedule Events for Your Students', 'lifterlms' ) . '</h3>';
$html .= '<p>' . esc_html__( 'Add live events, webinars, and in-person sessions to your courses and memberships. Students can subscribe to calendar feeds and never miss an event.', 'lifterlms' ) . '</p>';
$html .= '<a href="https://lifterlms.com/product/lifterlms-events/?utm_source=LifterLMS%20Plugin&utm_medium=Course%20Editor&utm_campaign=Events%20Promo" target="_blank" class="llms-button-primary">';
$html .= esc_html__( 'Get LifterLMS Events', 'lifterlms' );
$html .= '</a>';
$html .= '</div>';
return $html;
}
}
Expand full source code Collapse full source code View on GitHub
Methods Methods
- __construct — Constructor.
- add_course_promo_tab — Add an Events promo tab to Course Options.
- add_lesson_promo_tab — Add an Events promo tab to Lesson Settings.
- add_membership_promo_tab — Add an Events promo tab to Membership.
- get_promo_html — Get the promo HTML.
Changelog Changelog
| Version | Description |
|---|---|
| 7.8.0 | Introduced. |