plugin = $plugin; $this->hooks(); } /** * Initiate our hooks. * * @since 5.8.3 */ public function hooks() { add_action( 'wp_dashboard_setup', array( $this, 'init' ) ); } const WID = 'ssa-dashboard-upcoming-appointments-widget'; /** * Hook to wp_dashboard_setup to add the widget. */ public static function init() { $current_staff_id = ssa()->staff_model->get_staff_id_for_user_id( get_current_user_id() ); if ( current_user_can( 'ssa_manage_others_appointments' ) || ( current_user_can( 'ssa_manage_appointments' ) && $current_staff_id !== null ) ) { // Register the widget... wp_add_dashboard_widget( self::WID, // A unique slug/ID. __( 'Your Upcoming Appointments', 'simply-schedule-appointments' ), // Visible name for the widget. array( 'SSA_Dashboard_Upcoming_Appointments_Widget', 'widget' ) // Callback for the main widget content. ); } } /** * Load the widget code */ public static function widget() { echo do_shortcode( "[ssa_admin_upcoming_appointments appointment_type_displayed=true customer_id='']" ); } }