LLMS_BBP_Widget_Course_Forums_List
LifterLMS bbPress forms list widget
Contents
Source Source
File: includes/widgets/class.llms.bbp.widget.course.forums.list.php
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | class LLMS_BBP_Widget_Course_Forums_List extends WP_Widget { /** * Constructor * * @since 3.12.0 * @version 3.12.0 */ public function __construct() { $options = array ( 'classname' => 'llms-bbp-widget-course-forums' , 'description' => esc_html__( 'Displays a list of bbPress forums associated with the course.' , 'lifterlms' ), ); parent::__construct( 'llms_bbp_widget_course_forums_list' , esc_html__( 'LifterLMS Course Forums List' , 'lifterlms' ), $options ); } /** * Output the widget * * @param array $args arguments passed to the widget * @param array $instance instance information * @return void * @since 3.12.0 * @version 3.12.0 */ public function widget( $args , $instance ) { $id = get_the_ID(); if ( 'course' !== get_post_type( $id ) ) { $course = llms_get_post_parent_course( $id ); } else { $course = llms_get_post( $id ); } if ( ! $course ) { return ; } if ( ! $course ->get( 'bbp_forum_ids' ) ) { return ; } echo $args [ 'before_widget' ]; if ( ! empty ( $instance [ 'title' ] ) ) { echo $args [ 'before_title' ] . apply_filters( 'widget_title' , $instance [ 'title' ] ) . $args [ 'after_title' ]; } echo do_shortcode( '[lifterlms_bbp_course_forums]' ); echo $args [ 'after_widget' ]; } /** * Output widget options form * * @param array $instance instance data * @return void * @since 3.12.0 * @version 3.24.0 */ public function form( $instance ) { $title = isset( $instance [ 'title' ] ) ? $instance [ 'title' ] : __( 'Course Forums' , 'lifterlms' ); ?> <p> <label for = "<?php echo $this->get_field_id( 'title' ); ?>" ><?php esc_html_e( 'Title:' , 'lifterlms' ); ?></label> <input class = "widefat" id= "<?php echo $this->get_field_id( 'title' ); ?>" name= "<?php echo $this->get_field_name( 'title' ); ?>" type= "text" value= "<?php echo esc_attr( $title ); ?>" > </p> <?php } } |
Expand full source code Collapse full source code View on GitHub
Methods Methods
- __construct — Constructor
- form — Output widget options form
- widget — Output the widget
Changelog Changelog
Version | Description |
---|---|
3.24.0 | Unknown. |
3.12.0 | Introduced. |