Making WordPress.org

Changeset 5626


Ignore:
Timestamp:
07/07/2017 05:39:52 PM (7 years ago)
Author:
SergeyBiryukov
Message:

Support Theme: Add two views to user profiles to allow for browsing topics ordered by recent activity:

  • "Active Topics" shows the user's topics with recent replies, ordered by latest reply.
  • "Topics Replied To" shows all topics the user has replied to (including topics started by others), ordered by latest reply.

Fixes #2470.

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support
Files:
1 added
5 edited
3 copied

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/bbpress/content-single-user.php

    r5619 r5626  
    2525
    2626        <div id="bbp-user-body">
    27             <?php if ( bbp_is_favorites()                     ) bbp_get_template_part( 'user', 'favorites'       ); ?>
    28             <?php if ( bbp_is_subscriptions()                 ) bbp_get_template_part( 'user', 'subscriptions'   ); ?>
     27            <?php if ( bbp_is_favorites()                               ) bbp_get_template_part( 'user', 'favorites'         ); ?>
     28            <?php if ( bbp_is_subscriptions()                           ) bbp_get_template_part( 'user', 'subscriptions'     ); ?>
    2929
    3030            <?php
     
    3434            ?>
    3535
    36             <?php if ( bbp_is_single_user_topics()            ) bbp_get_template_part( 'user', 'topics-created'  ); ?>
    37             <?php if ( bbp_is_single_user_replies()           ) bbp_get_template_part( 'user', 'replies-created' ); ?>
    38             <?php if ( wporg_support_is_single_user_reviews() ) bbp_get_template_part( 'user', 'reviews-written' ); ?>
    39             <?php if ( bbp_is_single_user_edit()              ) bbp_get_template_part( 'form', 'user-edit'       ); ?>
    40             <?php if ( bbp_is_single_user_profile()           ) bbp_get_template_part( 'user', 'profile'         ); ?>
     36            <?php if ( bbp_is_single_user_topics()                      ) bbp_get_template_part( 'user', 'topics-created'    ); ?>
     37            <?php if ( bbp_is_single_user_replies()                     ) bbp_get_template_part( 'user', 'replies-created'   ); ?>
     38            <?php if ( wporg_support_is_single_user_reviews()           ) bbp_get_template_part( 'user', 'reviews-written'   ); ?>
     39            <?php if ( wporg_support_is_single_user_active_topics()     ) bbp_get_template_part( 'user', 'active-topics'     ); ?>
     40            <?php if ( wporg_support_is_single_user_topics_replied_to() ) bbp_get_template_part( 'user', 'topics-replied-to' ); ?>
     41            <?php if ( bbp_is_single_user_edit()                        ) bbp_get_template_part( 'form', 'user-edit'         ); ?>
     42            <?php if ( bbp_is_single_user_profile()                     ) bbp_get_template_part( 'user', 'profile'           ); ?>
    4143        </div>
    4244    </div>
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/bbpress/loop-single-reply-topic.php

    r5622 r5626  
    1 <ul id="bbp-topic-<?php bbp_topic_id(); ?>" <?php bbp_topic_class(); ?>>
     1<?php $topic_id = bbp_get_reply_topic_id(); ?>
     2
     3<ul id="bbp-topic-<?php bbp_topic_id( $topic_id ); ?>" <?php bbp_topic_class( $topic_id ); ?>>
    24
    35    <li class="bbp-topic-title">
    46
    5         <?php if ( bbp_is_user_home() ) : ?>
    6 
    7             <?php if ( bbp_is_favorites() ) : ?>
    8 
    9                 <span class="bbp-topic-action">
    10 
    11                     <?php do_action( 'bbp_theme_before_topic_favorites_action' ); ?>
    12 
    13                     <?php bbp_user_favorites_link( array( 'before' => '', 'favorite' => '+', 'favorited' => '&times;' ) ); ?>
    14 
    15                     <?php do_action( 'bbp_theme_after_topic_favorites_action' ); ?>
    16 
    17                 </span>
    18 
    19             <?php elseif ( bbp_is_subscriptions() ) : ?>
    20 
    21                 <span class="bbp-topic-action">
    22 
    23                     <?php do_action( 'bbp_theme_before_topic_subscription_action' ); ?>
    24 
    25                     <?php bbp_user_subscribe_link( array( 'before' => '', 'subscribe' => '+', 'unsubscribe' => '&times;' ) ); ?>
    26 
    27                     <?php do_action( 'bbp_theme_after_topic_subscription_action' ); ?>
    28 
    29                 </span>
    30 
    31             <?php endif; ?>
    32 
    33         <?php endif; ?>
    34 
    357        <?php do_action( 'bbp_theme_before_topic_title' ); ?>
    368
    37         <a class="bbp-topic-permalink" href="<?php bbp_topic_permalink(); ?>"><?php bbp_topic_title(); ?></a>
     9        <a class="bbp-topic-permalink" href="<?php bbp_topic_permalink( $topic_id ); ?>"><?php bbp_topic_title( $topic_id ); ?></a>
    3810
    3911        <?php do_action( 'bbp_theme_after_topic_title' ); ?>
    4012
    41         <?php bbp_topic_pagination(); ?>
     13        <?php bbp_topic_pagination( array( 'topic_id' => $topic_id ) ); ?>
    4214
    4315        <?php do_action( 'bbp_theme_before_topic_meta' ); ?>
     
    4719            <?php do_action( 'bbp_theme_before_topic_started_by' ); ?>
    4820
    49             <span class="bbp-topic-started-by"><?php printf( __( 'Started by: %1$s', 'wporg-forums' ), bbp_get_topic_author_link( array( 'size' => '14' ) ) ); ?></span>
     21            <span class="bbp-topic-started-by"><?php printf( __( 'Started by: %1$s', 'wporg-forums' ), bbp_get_topic_author_link( array( 'post_id' => $topic_id, 'size' => '14' ) ) ); ?></span>
    5022
    5123            <?php do_action( 'bbp_theme_after_topic_started_by' ); ?>
    5224
    53             <?php if ( ( bbp_is_single_view() && ! wporg_support_is_compat_view() ) || ( bbp_is_single_forum() && bbp_get_topic_forum_id() != bbp_get_forum_id() ) || bbp_is_single_user_topics() ) : ?>
     25            <?php do_action( 'bbp_theme_before_topic_started_in' ); ?>
    5426
    55                 <?php do_action( 'bbp_theme_before_topic_started_in' ); ?>
     27            <span class="bbp-topic-started-in"><?php printf( __( 'in: <a href="%1$s">%2$s</a>', 'wporg-forums' ), bbp_get_forum_permalink( bbp_get_topic_forum_id( $topic_id ) ), bbp_get_forum_title( bbp_get_topic_forum_id( $topic_id ) ) ); ?></span>
    5628
    57                 <span class="bbp-topic-started-in"><?php printf( __( 'in: <a href="%1$s">%2$s</a>', 'wporg-forums' ), bbp_get_forum_permalink( bbp_get_topic_forum_id() ), bbp_get_forum_title( bbp_get_topic_forum_id() ) ); ?></span>
    58 
    59                 <?php do_action( 'bbp_theme_after_topic_started_in' ); ?>
    60 
    61             <?php endif; ?>
     29            <?php do_action( 'bbp_theme_after_topic_started_in' ); ?>
    6230
    6331        </p>
     
    6937    </li>
    7038
    71     <li class="bbp-topic-voice-count"><?php bbp_topic_voice_count(); ?></li>
     39    <li class="bbp-topic-voice-count"><?php bbp_topic_voice_count( $topic_id ); ?></li>
    7240
    73     <li class="bbp-topic-reply-count"><?php bbp_show_lead_topic() ? bbp_topic_reply_count() : bbp_topic_post_count(); ?></li>
     41    <li class="bbp-topic-reply-count"><?php bbp_show_lead_topic() ? bbp_topic_reply_count( $topic_id ) : bbp_topic_post_count( $topic_id ); ?></li>
    7442
    7543    <li class="bbp-topic-freshness">
     
    7745        <?php do_action( 'bbp_theme_before_topic_freshness_link' ); ?>
    7846
    79         <?php bbp_topic_freshness_link(); ?>
     47        <?php bbp_topic_freshness_link( $topic_id ); ?>
    8048
    8149        <?php do_action( 'bbp_theme_after_topic_freshness_link' ); ?>
     
    8553            <?php do_action( 'bbp_theme_before_topic_freshness_author' ); ?>
    8654
    87             <span class="bbp-topic-freshness-author"><?php bbp_author_link( array( 'post_id' => bbp_get_topic_last_active_id(), 'size' => 14 ) ); ?></span>
     55            <span class="bbp-topic-freshness-author"><?php bbp_author_link( array( 'post_id' => bbp_get_topic_last_active_id( $topic_id ), 'size' => 14 ) ); ?></span>
    8856
    8957            <?php do_action( 'bbp_theme_after_topic_freshness_author' ); ?>
     
    9260    </li>
    9361
    94 </ul><!-- #bbp-topic-<?php bbp_topic_id(); ?> -->
     62</ul><!-- #bbp-topic-<?php bbp_topic_id( $topic_id ); ?> -->
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/bbpress/loop-single-topic.php

    r5049 r5626  
    5151            <?php do_action( 'bbp_theme_after_topic_started_by' ); ?>
    5252
    53             <?php if ( ( bbp_is_single_view() && ! wporg_support_is_compat_view() ) || ( bbp_is_single_forum() && bbp_get_topic_forum_id() != bbp_get_forum_id() ) || bbp_is_single_user_topics() ) : ?>
     53            <?php if (
     54                        ( bbp_is_single_view() && ! wporg_support_is_compat_view() )
     55                    ||
     56                        ( bbp_is_single_forum() && bbp_get_topic_forum_id() != bbp_get_forum_id() )
     57                    ||
     58                        bbp_is_single_user_topics()
     59                    ||
     60                        wporg_support_is_single_user_active_topics()
     61                    ) : ?>
    5462
    5563                <?php do_action( 'bbp_theme_before_topic_started_in' ); ?>
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/bbpress/user-active-topics.php

    r5622 r5626  
    22
    33/**
    4  * User Reviews Written
     4 * User Active Topics
    55 *
    66 * @package bbPress
     
    88 */
    99
    10 do_action( 'bbp_template_before_user_reviews_written' ); ?>
     10do_action( 'bbp_template_before_user_active_topics' ); ?>
    1111
    12 <div id="bbp-user-topics-started" class="bbp-user-topics-started">
    13     <h2 class="entry-title"><?php esc_html_e( 'Reviews Written', 'wporg-forums' ); ?></h2>
     12<div id="bbp-user-active-topics" class="bbp-user-active-topics">
     13    <h2 class="entry-title"><?php esc_html_e( 'Active Topics', 'wporg-forums' ); ?></h2>
    1414    <div class="bbp-user-section">
    1515
     
    2525
    2626            <p><?php bbp_is_user_home()
    27                 ? esc_html_e( 'You have not written any reviews.',      'wporg-forums' )
    28                 : esc_html_e( 'This user has not written any reviews.', 'wporg-forums' );
     27                ? esc_html_e( 'You have not created any topics.',      'wporg-forums' )
     28                : esc_html_e( 'This user has not created any topics.', 'wporg-forums' );
    2929            ?></p>
    3030
     
    3232
    3333    </div>
    34 </div><!-- #bbp-user-topics-started -->
     34</div><!-- #bbp-user-active-topics -->
    3535
    36 <?php do_action( 'bbp_template_after_user_reviews_written' );
     36<?php do_action( 'bbp_template_after_user_active_topics' );
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/bbpress/user-details.php

    r5617 r5626  
    5252            <?php if ( defined( 'WPORG_SUPPORT_FORUMS_BLOGID' ) && WPORG_SUPPORT_FORUMS_BLOGID == get_current_blog_id() ) : ?>
    5353                <li class="<?php if ( wporg_support_is_single_user_reviews() ) :?>current<?php endif; ?>">
    54                     <span class='bbp-user-replies-created-link'>
     54                    <span class='bbp-user-reviews-link'>
    5555                        <a href="<?php bbp_user_profile_url(); ?>reviews/" title="<?php
    5656                            /* translators: %s: user's display name */
     
    6060                </li>
    6161            <?php endif; ?>
     62
     63            <li class="<?php if ( wporg_support_is_single_user_active_topics() ) :?>current<?php endif; ?>">
     64                <span class='bbp-user-active-topics-link'>
     65                    <a href="<?php bbp_user_profile_url(); ?>active/" title="<?php
     66                        /* translators: %s: user's display name */
     67                        printf( esc_attr__( "%s's Active Topics", 'wporg-forums' ), bbp_get_displayed_user_field( 'display_name' ) );
     68                    ?>"><?php esc_html_e( 'Active Topics', 'wporg-forums' ); ?></a>
     69                </span>
     70            </li>
     71
     72            <li class="<?php if ( wporg_support_is_single_user_topics_replied_to() ) :?>current<?php endif; ?>">
     73                <span class='bbp-user-topics-replied-to-link'>
     74                    <a href="<?php bbp_user_profile_url(); ?>replied-to/" title="<?php
     75                        /* translators: %s: user's display name */
     76                        printf( esc_attr__( 'Topics %s Has Replied To', 'wporg-forums' ), bbp_get_displayed_user_field( 'display_name' ) );
     77                    ?>"><?php esc_html_e( 'Topics Replied To', 'wporg-forums' ); ?></a>
     78                </span>
     79            </li>
    6280
    6381            <?php if ( function_exists( 'bbp_is_engagements_active' ) && bbp_is_engagements_active() ) : ?>
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/bbpress/user-reviews-written.php

    r5617 r5626  
    1010do_action( 'bbp_template_before_user_reviews_written' ); ?>
    1111
    12 <div id="bbp-user-topics-started" class="bbp-user-topics-started">
     12<div id="bbp-user-reviews-written" class="bbp-user-reviews-written">
    1313    <h2 class="entry-title"><?php esc_html_e( 'Reviews Written', 'wporg-forums' ); ?></h2>
    1414    <div class="bbp-user-section">
     
    3232
    3333    </div>
    34 </div><!-- #bbp-user-topics-started -->
     34</div><!-- #bbp-user-reviews-written -->
    3535
    3636<?php do_action( 'bbp_template_after_user_reviews_written' );
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/bbpress/user-topics-replied-to.php

    r5622 r5626  
    22
    33/**
    4  * User Reviews Written
     4 * User Topics Replied To
    55 *
    66 * @package bbPress
     
    88 */
    99
    10 do_action( 'bbp_template_before_user_reviews_written' ); ?>
     10do_action( 'bbp_template_before_user_topics_replied_to' ); ?>
    1111
    12 <div id="bbp-user-topics-started" class="bbp-user-topics-started">
    13     <h2 class="entry-title"><?php esc_html_e( 'Reviews Written', 'wporg-forums' ); ?></h2>
     12<div id="bbp-user-topics-replied-to" class="bbp-user-topics-replied-to">
     13    <h2 class="entry-title"><?php esc_html_e( 'Topics Replied To', 'wporg-forums' ); ?></h2>
    1414    <div class="bbp-user-section">
    1515
    16         <?php if ( bbp_get_user_topics_started() ) : ?>
     16        <?php if ( bbp_get_user_replies_created() ) : ?>
    1717
    18             <?php bbp_get_template_part( 'pagination', 'topics' ); ?>
     18            <?php bbp_get_template_part( 'pagination', 'replies' ); ?>
    1919
    20             <?php bbp_get_template_part( 'loop',       'topics' ); ?>
     20            <?php bbp_get_template_part( 'loop',       'reply-topics' ); ?>
    2121
    22             <?php bbp_get_template_part( 'pagination', 'topics' ); ?>
     22            <?php bbp_get_template_part( 'pagination', 'replies' ); ?>
    2323
    2424        <?php else : ?>
    2525
    2626            <p><?php bbp_is_user_home()
    27                 ? esc_html_e( 'You have not written any reviews.',      'wporg-forums' )
    28                 : esc_html_e( 'This user has not written any reviews.', 'wporg-forums' );
     27                ? esc_html_e( 'You have not replied to any topics.',      'wporg-forums' )
     28                : esc_html_e( 'This user has not replied to any topics.', 'wporg-forums' );
    2929            ?></p>
    3030
     
    3232
    3333    </div>
    34 </div><!-- #bbp-user-topics-started -->
     34</div><!-- #bbp-user-topics-replied-to -->
    3535
    36 <?php do_action( 'bbp_template_after_user_reviews_written' );
     36<?php do_action( 'bbp_template_after_user_topics_replied_to' );
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php

    r5618 r5626  
    262262
    263263/**
    264  * Check if the current page is a user's reviews page.
    265  *
    266  * @return bool True if the page is a user's reviews page, false otherwise.
     264 * Check if the current page is a user's "Reviews Written" page.
     265 *
     266 * @return bool True if the page is a "Reviews Written" page, false otherwise.
    267267 */
    268268function wporg_support_is_single_user_reviews() {
    269269    return (bool) get_query_var( 'wporg_single_user_reviews' );
     270}
     271
     272/**
     273 * Check if the current page is a user's "Active Topics" page.
     274 *
     275 * @return bool True if the page is an "Active Topics" page, false otherwise.
     276 */
     277function wporg_support_is_single_user_active_topics() {
     278    return (bool) get_query_var( 'wporg_single_user_active_topics' );
     279}
     280
     281/**
     282 * Check if the current page is a user's "Topics Replied To" page.
     283 *
     284 * @return bool True if the page is a "Topics Replied To" page, false otherwise.
     285 */
     286function wporg_support_is_single_user_topics_replied_to() {
     287    return (bool) get_query_var( 'wporg_single_user_topics_replied_to' );
    270288}
    271289
Note: See TracChangeset for help on using the changeset viewer.