Skip to:
Content
Pages
Categories
Search
Top
Bottom

Last replies on sidebar with

  • Hello,

    I am looking for a way to display in my sidebar the latest replies, not just the avatar and name of the topic like the widget, but the avatar, the user name and a link to his profile, the link and name of the topic and particularly an extract of his reply.

    I really do not see how i can do this, could you help me?

    A link to a tutorial, or other would be perfect

    Thank you in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • up?


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Use the code in the bbp-core-widgets.php file as your guide. It is it’s own tutorial.

    thank you for help.

    I found the right file, I found the good part, I think it was leave I should use.

    function widget( $args, $instance ) {

    extract( $args );

    $title = apply_filters( ‘bbp_replies_widget_title’, $instance );

    $max_shown = !empty( $instance ) ? $instance : ’5′;

    $show_date = !empty( $instance ) ? ‘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; ?>

      <?php while ( bbp_replies() ) : bbp_the_reply(); ?>

    • <?php

      $author_link = bbp_get_reply_author_link( array( ‘type’ => ‘both’, ‘size’ => 14 ) );

      $reply_link = ‘‘ . bbp_get_reply_topic_title() . ‘‘;

      /* translators: bbpress replies widget: 1: reply author, 2: reply link, 3: reply date, 4: reply time */

      printf( _x( $show_date == ‘on’ ? ‘%1$s on %2$s, %3$s, %4$s’ : ‘%1$s on %2$s’, ‘widgets’, ‘bbpress’ ), $author_link, $reply_link, get_the_date(), get_the_time() );

      ?>

    • <?php endwhile; ?>

    <?php echo $after_widget;

    endif;

    bbp_reset_query_name();

    }

    I miss it more than learning how to change it: D

    thank you I go little by little.

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.