LLMS_BBP_Shortcode_Course_Forums_List


Description Description


Source Source

File: includes/shortcodes/class.llms.bbp.shortcode.course.forums.list.php

class LLMS_BBP_Shortcode_Course_Forums_List extends LLMS_Shortcode_Course_Element {

	/**
	 * Shortcode tag
	 * @var  string
	 */
	public $tag = 'lifterlms_bbp_course_forums';

	/**
	 * Retrieve the forum ids associated with the course
	 * @return   array
	 * @since    3.12.0
	 * @version  3.12.1
	 */
	private function get_forums() {

		global $post;

		$course = llms_get_post( $post );
		if ( $course ) {
			return $course->get( 'bbp_forum_ids' );
		}

		return array();

	}

	/**
	 * Call the template function for the course element
	 * @return   void
	 * @since    3.12.0
	 * @version  3.12.0
	 */
	protected function template_function() {

		$forums = $this->get_forums();

		if ( $forums ) {
			echo '<div class="llms-bbp-course-forums-wrap">';
				echo '<ul class="llms-bbp-course-forums-list">';
			foreach ( $forums as $forum_id ) : ?>
					<li><a class="llms-bbp-forum-title" href="<?php bbp_forum_permalink( $forum_id ); ?>">
						<?php bbp_forum_title( $forum_id ); ?>
					</a></li>
				<?php endforeach;
				echo '</ul>';
			echo '</div>';
		}

	}

}


Top ↑

Methods Methods


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.





Permalink: