'bbp_widget_login',
'description' => __( 'The login widget.', 'bbpress' )
) );
parent::WP_Widget( false, __( 'bbPress Login Widget', 'bbpress' ), $widget_ops );
}
/**
* Displays the output, the login form
*
* @since bbPress (r2827)
*
* @param mixed $args Arguments
* @param array $instance Instance
* @uses apply_filters() Calls 'bbp_login_widget_title' with the title
* @uses get_template_part() To get the login/logged in form
*/
function widget( $args, $instance ) {
extract( $args );
$title = apply_filters( 'bbp_login_widget_title', $instance['title'] );
$register = apply_filters( 'bbp_login_widget_register', $instance['register'] );
$lostpass = apply_filters( 'bbp_login_widget_lostpass', $instance['lostpass'] );
echo $before_widget;
if ( !empty( $title ) )
echo $before_title . $title . $after_title;
if ( !is_user_logged_in() ) : ?>
'widget_display_views',
'description' => __( 'A list of views.', 'bbpress' )
) );
parent::WP_Widget( false, __( 'bbPress View List', 'bbpress' ), $widget_ops );
}
/**
* Displays the output, the view list
*
* @since bbPress (r3020)
*
* @param mixed $args Arguments
* @param array $instance Instance
* @uses apply_filters() Calls 'bbp_view_widget_title' with the title
* @uses bbp_get_views() To get the views
* @uses bbp_view_url() To output the view url
* @uses bbp_view_title() To output the view title
*/
function widget( $args, $instance ) {
// Only output widget contents if views exist
if ( bbp_get_views() ) :
extract( $args );
$title = apply_filters( 'bbp_view_widget_title', $instance['title'] );
echo $before_widget;
echo $before_title . $title . $after_title; ?>
$args ) : ?>
'widget_display_forums',
'description' => __( 'A list of forums.', 'bbpress' )
) );
parent::WP_Widget( false, __( 'bbPress Forum List', 'bbpress' ), $widget_ops );
}
/**
* Displays the output, the forum list
*
* @since bbPress (r2653)
*
* @param mixed $args Arguments
* @param array $instance Instance
* @uses apply_filters() Calls 'bbp_forum_widget_title' with the title
* @uses get_option() To get the forums per page option
* @uses current_user_can() To check if the current user can read
* private() To resety name
* @uses bbp_set_query_name() To set the query name to 'bbp_widget'
* @uses bbp_reset_query_name() To reset the query name
* @uses bbp_has_forums() The main forum loop
* @uses bbp_forums() To check whether there are more forums available
* in the loop
* @uses bbp_the_forum() Loads up the current forum in the loop
* @uses bbp_forum_permalink() To display the forum permalink
* @uses bbp_forum_title() To display the forum title
*/
function widget( $args, $instance ) {
extract( $args );
$title = apply_filters( 'bbp_forum_widget_title', $instance['title'] );
$parent_forum = !empty( $instance['parent_forum'] ) ? $instance['parent_forum'] : '0';
$forums_query = array(
'post_parent' => $parent_forum,
'posts_per_page' => get_option( '_bbp_forums_per_page', 50 ),
'orderby' => 'menu_order',
'order' => 'ASC'
);
bbp_set_query_name( 'bbp_widget' );
if ( bbp_has_forums( $forums_query ) ) :
echo $before_widget;
echo $before_title . $title . $after_title; ?>
'widget_display_topics',
'description' => __( 'A list of recent topics, sorted by popularity or freshness.', 'bbpress' )
) );
parent::WP_Widget( false, __( 'bbPress Topics List', 'bbpress' ), $widget_ops );
}
/**
* Displays the output, the topic list
*
* @since bbPress (r2653)
*
* @param mixed $args
* @param array $instance
* @uses apply_filters() Calls 'bbp_topic_widget_title' with the title
* @uses bbp_set_query_name() To set the query name to 'bbp_widget'
* @uses bbp_reset_query_name() To reset the query name
* @uses bbp_has_topics() The main topic loop
* @uses bbp_topics() To check whether there are more topics available
* in the loop
* @uses bbp_the_topic() Loads up the current topic in the loop
* @uses bbp_topic_permalink() To display the topic permalink
* @uses bbp_topic_title() To display the topic title
* @uses bbp_get_topic_last_active_time() To get the topic last active
* time
* @uses bbp_get_topic_id() To get the topic id
* @uses bbp_get_topic_reply_count() To get the topic reply count
*/
function widget( $args, $instance ) {
extract( $args );
$title = apply_filters( 'bbp_topic_widget_title', $instance['title'] );
$max_shown = !empty( $instance['max_shown'] ) ? (int) $instance['max_shown'] : 5;
$show_date = !empty( $instance['show_date'] ) ? 'on' : false;
$parent_forum = !empty( $instance['parent_forum'] ) ? $instance['parent_forum'] : 'any';
$pop_check = ( $instance['pop_check'] < $max_shown || empty( $instance['pop_check'] ) ) ? -1 : $instance['pop_check'];
// Query defaults
$topics_query = array(
'author' => 0,
'post_parent' => $parent_forum,
'posts_per_page' => $max_shown > $pop_check ? $max_shown : $pop_check,
'posts_per_page' => $max_shown,
'show_stickies' => false,
'order' => 'DESC',
);
bbp_set_query_name( 'bbp_widget' );
// Topics exist
if ( bbp_has_topics( $topics_query ) ) :
// Sort by time
if ( $pop_check < $max_shown ) :
echo $before_widget;
echo $before_title . $title . $after_title; ?>
'widget_display_replies',
'description' => __( 'A list of bbPress recent replies.', 'bbpress' )
) );
parent::WP_Widget( false, 'bbPress Reply List', $widget_ops );
}
/**
* Displays the output, the replies list
*
* @since bbPress (r2653)
*
* @param mixed $args
* @param array $instance
* @uses apply_filters() Calls 'bbp_reply_widget_title' with the title
* @uses bbp_set_query_name() To set the query name to 'bbp_widget'
* @uses bbp_reset_query_name() To reset the query name
* @uses bbp_has_replies() The main reply loop
* @uses bbp_replies() To check whether there are more replies available
* in the loop
* @uses bbp_the_reply() Loads up the current reply in the loop
* @uses bbp_get_reply_author_link() To get the reply author link
* @uses bbp_get_reply_author() To get the reply author name
* @uses bbp_get_reply_id() To get the reply id
* @uses bbp_get_reply_url() To get the reply url
* @uses bbp_get_reply_excerpt() To get the reply excerpt
* @uses bbp_get_reply_topic_title() To get the reply topic title
* @uses get_the_date() To get the date of the reply
* @uses get_the_time() To get the time of the reply
*/
function widget( $args, $instance ) {
extract( $args );
$title = apply_filters( 'bbp_replies_widget_title', $instance['title'] );
$max_shown = !empty( $instance['max_shown'] ) ? $instance['max_shown'] : '5';
$show_date = !empty( $instance['show_date'] ) ? 'on' : false;
// Query defaults
$replies_query = array(
'post_status' => join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ),
'posts_per_page' => $max_shown,
'order' => 'DESC'
);
// Set the query name
bbp_set_query_name( 'bbp_widget' );
// Get replies and display them
if ( bbp_has_replies( $replies_query ) ) :
echo $before_widget;
echo $before_title . $title . $after_title; ?>